Defining a variable to run a test with a selected browser
If you run a test from the command line, as part of a schedule from HCL OneTest™ Performance, or from IBM® Rational® Quality Manager, you can define a variable in the test to specify the web browser to use for running the test. The reserved name for the variable is RTW_WebUI_Browser_Selection. After defining the variable, if you run the test from test workbench, the browser selected in the Run configuration dialog box takes precedence over the browser specified in the variable.
Before you begin
Now, HCL OneTest™ UI creates a test variable automatically whenever a new Web UI test is recorded or when an old test is used that does not already have this variable defined.
Procedure
- In the Test Navigator, browse to the test and double-click
it.The test opens.
- To create a container
for the test variables that you create in a test:
- To define a variable in a test:
- Select the newly created test variable node.
- Click .
- Enter the name of the variable, which is a reserved name for this selection variable: RTW_WebUI_Browser_Selection.
- Click OK.
- In the Visible in section, select This test only to restrict data to the current test only. Even if another test has a variable with the same name, that variable will not change. Select All tests for this user to share the value of this variable when the test runs in a compound test. For the variable to be shared, both tests must have a variable with the same name and must have this option enabled.
- Assign a specific value to the variable and initialize
the variable:
- Save the test.
What to do next
You can now run the test from the workbench, from the command line, as part of a schedule, or from Rational® Quality Manager.
You can use this test variable in If conditions to assign different behavior for different browsers. Doing so allows you to create more robust tests that will run successfully in more than one browser.