Running the test on multiple browsers

After you create a single test of your application or Web page to use in different browsers, you still must run it to actually test the application or Web page. You have a number of options on how to run the test across different browser types.

Manually configure the browser type

UFT provides you the opportunity to select the browser type before each test run. You can do this in one of the following places:

  • The Web tab of the Record and Run Settings dialog box.

    In the Web tab, you can select the browser type from the drop-down list. Then, when you run the test, UFT opens the appropriate browser and runs the test.

  • A user-defined environment variable specified in the Environment pane of the Test Settings dialog box.

    UFT uses the BROWSER_ENV environment variable, and the requisite values for each browser type to enable you to set this variable before each test run. When you enter a value for the BROWSER_ENV variable, UFT automatically opens up the necessary browser (ignoring any other browser launch settings).

However, this requires manual intervention by the person running the test, and does not enable you to run subsequent tests of the application or Web page on the different browser types in sequence.

For details, see Configure the Record and Run settings to launch a browser or Use the BROWSER_ENV environment variable to launch a browser

Back to top

Instruct UFT to open a browser defined with a parameter

Instead of manually setting the browser before each test run (which thereby defeats the purpose of automated testing), you can insert a parameter into a test step that defines the browser to open. (You can also define a single reusable action that opens the browser, which can be reused in all the tests of your application or Web page.)

The values for this parameter (which are the .exe programs for each browser) are then defined in the Data pane. When UFT reaches this test step, it reads the data pane and decides which browser needs to open based on the selected data.

This removes the need for you or another person to manually configure settings or variables in a test before running the test, enabling you automatically test your application or Web page on all browser types and/or versions. If you create a reusable action with the step that opens the browser, the parameter and data must be added to every test that calls this external action.

For task details on how to set up automatic opening of browser types from UFT, see Launch a browser using a data table parameter.

Back to top

Use a test or data table parameter

In the Record and Run Settings dialog box (Web tab), you can instruct UFT to use either a test parameter or data table parameter to launch the browser. You set the parameter at the beginning of the test run (for a test parameter) or insert the BROWSER_ENV value in the Data table in the Data pane.

Then, when UFT runs the test, it launches the correct browser according to the values you inserted.

For details, see Launch a browser with a test parameter.

Back to top

Use a WebUtil.LaunchBrowser step

If you are using Business Process Testing to test your web applications, you should use a WebUtil.LaunchBrowser step to launch the appropriate browsers as needed within each component.

For each step, you provide an argument for the Browser parameter, which is the same as the environment variables for Web- based environments:

  • CHROME

  • CHROME_EMULATOR

  • CHROME_HEADLESS
  • EDGE

  • FF<VersionNumber>

  • FIREFOX

  • FIREFOX64

  • IE

  • IE64

  • PHANTOMJS

  • SAFARI

Back to top