If you run a test from the command line, as part of a schedule from IBM® DevOps Test Performance (Test Performance), or from IBM Engineering
Test Management, 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 takes precedence over the browser specified in the
variable.
Now, Test 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.
-
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:
-
Open the test, and in the Test Contents area, at the top of the
test, click Test Variables.
-
Select .
A container named Test Variables is created for the
user-defined variables.
-
Select the container to rename it.
The Test Variables Details area opens for you to type a
new name in the Name field.
-
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:
-
In Initial Value, ensure that the Text option is selected.
-
Use one of the following variables to specify a browser:
| Browser |
Variable |
Variable short form |
| Mozilla Firefox |
Firefox, Mozilla Firefox |
ff |
| Google Chrome |
Chrome, Google Chrome |
chrome |
| Internet Explorer v11 |
Internet Explorer, Microsoft Internet Explorer |
ie |
| Microsoft Edge |
Edge, Microsoft Edge |
edge |
| Apple Safari |
Safari, Apple Safari |
safari |
-
Save the test.
You can now run the test from the workbench, from the command line, as part of a schedule, or
from Engineering Test Management.
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.