Running tests in the headless mode

When you do not want to view the GUI of the application under test as the recorded test is played back on a web browser, you can choose to run the test in the headless mode. Running of tests in the headless mode is useful when you use an automated testing environment.

Before you begin

You must have recorded a single Web UI test, compound test with multiple Web UI tests, or an AFT Suite that you want to run in the headless mode.

About this task

The web browsers that support the running of tests in the headless mode are as follows:
  • Google Chrome
  • Microsoft Edge
  • Mozilla Firefox
Note: For information about the supported versions of the web browsers, see System Requirements for DevOps Test UI 2024.03 (11.0.1).

You can configure a single Web UI test, compound test with multiple Web UI tests, or an AFT Suite to run in the headless mode from Test UI or a remote agent computer by performing any of the following actions:

  • Select the Headless Mode option as a preference for the test playback, if you do not enter the headless attribute and its value in the AFT XML file of the recorded tests or AFT Suite. You must also select the web browser to be used for the playback.
  • Enter the headless attribute with its value set to true in the AFT XML file of the recorded test.
    Note: You must have entered the web browser to be used for the playback in the AFT XML file of the recorded tests or AFT Suite.

    For example, the entry in the AFT XML file can be as follows:

    <browser name=”chrome” headless=”true”/>

Notes:
  • To ensure that all Web UI tests in an AFT Suite run in the headless mode, you must enter the headless attribute with its value set to true in the AFT XML file. The tests run in the headless mode irrespective of the preferences configured for the tests in Test UI. The Web UI tests also run in the headless mode if you select the Run Distributed Tests option for the run.
  • If you entered the headless attribute with its value set to false in the AFT XML file of the AFT Suite, then none of the Web UI tests in the AFT Suite run in the headless mode.
Restriction: The playback of Web UI tests in the headless mode that contain multiple windows is not supported in the Chrome and Edge browsers.

Procedure

  1. Perform any of the following actions:
    • Select the Headless Mode option as a preference for the test playback. Go to Step 2.
    • Enter the headless attribute in the AFT XML file. Go to Step 3.
  2. Start Test UI and perform the following steps:
    1. Click Window > Preferences > Test > Test Execution > UI Test Playback > Browser tab.
    2. Identify the panel of the web browser that you want to use for the playback test.
    3. Select the Headless Mode option for the browser that you want to use to run tests in the headless mode.
    4. Click Apply and Close.
    5. Run the test.

    The test is run in the headless mode by using the selected browser.

  3. Open the AFT XML file for editing, and then perform the following steps:
    1. Search and find the browser element.
    2. Append the headless attribute along with the name of the browser that you want to use to the browser element row.
      For example, if you want to run the test in the headless mode by using the Chrome browser, the entry in the AFT XML file can be as follows:
      <browsers>
      <browser name=”chrome” headless=”true” />
      </browsers>
    3. Save and close the AFT XML file.
    4. Run the test.

    The test is run in the headless mode by using the selected browser.