Run local UFT One tests

This topic describes how to run UFT One tests stored on your local machine.

Run local UFT One tests

Configure a Bamboo build task to trigger a local UFT One test run.

To configure a Bamboo build task to run local tests:

  1. In your Bamboo build plan, create a job and add an task to the job.

  2. In the Task types window, open the Tests pane and select the UFT One File System Execution task.

    A new, empty task is added as part of your build plan.

  3. Configure the following details for your UFT One File System Execution task:

    Task description Optional. A description to understand the purpose of the task.
    Tests

    The tests, test batch file, or folder containing tests to run.

    Each line in this field should contain the path to a test, test batch file (.MTB file name), or folder on the machine where the tests are to be run.

    You can enter multiple tests as needed.

    Optionally, specify test parameters to pass to each test in the test batch file.

    You can also list the same test multiple times, each time with different parameters.

    Give your batch file an .mtbx extension, and use the following sample syntax:

    <Mtbx>
     <Test name="test1" path="c:\tests\APITest1">
     <Parameter name="A" value="abc" type="string"/>
     ….
     </Test>
     <Test name="test2" path="${WORKSPACE}\test2">
      <Parameter name="p1" value="123" type="int"/>
      <Parameter name="p4" value="123.4" type="float"/>
      ….
     </Test>
    </Mtbx>
    Timeout

    The amount of time (in seconds) to wait if there is a problem opening or running the test.

    If the field is left blank, there is no timeout.

    Archive and publish test tests results

    Instructs the server what to do with the test run results after the test run is complete. Select one of the following:

    • Always archive test reports. Saves all run results, both for passed and failed tests.

    • Do not archive test reports: No run results are saved, regardless of the test status.

    • Archive test report for failed tests: Only results for failed tests are saved.

    Note: If you are running tests using Digital Lab, see Integrate mobile tests and Bamboo section of the UFT One Help Center.

  4. When you're done, save your configuration.

    When the build runs, the test will run as a build task with the specified settings. A new artifact is added in the Artifacts tab of the build project.

    After the test run, the relevant build logs are saved in the Logs tab of the build execution results. You can view details about the test run and links to run results.

    The run result file name includes a timestamp of the run, which matches the Bamboo system variable bamboo.buildTimeStamp. This enables you to more easily refer to a specific result file in an automation script.

Back to top

View UFT One test run results

After a test run, UFT One automatically saves the run results to a selected location. Specify run results specific settings in the Run Sessions pane of the UFT One Options dialog box (Tools > Options > General tab > Run Sessions node).

To view the run results:

  1. In the Artifacts tab, click the appropriate artifact link to download the report.

  2. Unzip and open the run results file, then do one of the following options:

    • Open the run_results.html file to view the run results.

    • In the Run Results Viewer select and open the Results.xml file.

    The run result file name includes a timestamp of the run, which matches the Bamboo system variable bamboo.buildTimeStamp. This enables you to more easily refer to a specific result file in an automation script.

If you added multiple test tasks, the different tasks are differentiated by their 3-digit ID at the beginning of the task. You can see these when you view the artifacts in the Artifacts tab.

For example:

Back to top

Run tests as a specific Windows user

Supported on App Delivery Management plugin version 23.3 and later, and relevant for GUI and API testing

Note: To run tests as a specific Windows user, you must start the Bamboo agent using a command line.

You can run UFT One tests as a Windows user that is different from the currently logged-in Windows user.

To run tests as a specific Windows user

  1. In your build plan, click the Variables tab. On the Variables tab, click Add to add the following parameters:

    Parameter Type Description
    UFT_RUN_AS_USER_NAME String

    The name of the user to use to run the build plan.

    Note: If the authentication fails, specify the value in the UPN format username@DNS_domain_name.

    One of the following:

    • UFT_RUN_AS_USER_ENCODED_PASSWORD

    • UFT_RUN_AS_USER_PASSWORD

    Password

    The user's encoded or non-encoded password.

    To encode the password, use the Password Encoder tool (available from the Windows Start menu). For details, seePassword Encoder.

  2. Run your build plan with the parameters you added.

Back to top

Release the license when a build plan is aborted

Supported on App Delivery Management plugin version 23.3 and later

When you abort a build plan before it completes the test run, the UFT One license still remains in use.

To release the license, prepare a clean.vbs script and run the script directly from the command line after the plan is aborted.

Alternatively, you can add a script task to your build plan to let the task automatically release the license for you.

Note: If UFT One is visible and busy when the script runs, the cleanup.vbs might not be able to interrupt it. In that case, you need to stop UFT One manually and close it to release the license.

To release the license by running the script from the command line:

  1. On the client machine where UFT One is running, create a clean.vbs file with the following contents:

    Copy code
    On Error Resume Next
    Set qtApp = CreateObject("QuickTest.Application")
    If qtApp.Launched Then
    qtApp.Test.Stop
    qtApp.Test.Close
    End If
    qtApp.Quit
    Set qtApp = Nothing
  2. Run the script from the command line after you abort the build plan.

  3. Check whether the license was successfully released. See Check whether the license was released.

To add a script task that automatically releases the license to your build plan:

  1. Prepare a clean.vbs file. See Step 1.

  2. In your build plan, select Configure plan from the Actions dropdown to enter the Default plan configuration page.

    Then click the Other tab and make sure the Force stop hanging builds and clean up sub-processes option is selected.

  3. Select your job, click the Tasks tab, and then click Add task to add a Script task.

    Drag the Script task to place the task under the Final tasks section.

  4. Configure the Script task as follows:

    Task description Provide a description of the task.
    Interpreter Select /bin/sh or cmd.exe.
    Script location Select Inline.
    Script body

    Add either of the following syntax:

    Syntax 1 (recommended):

    start c:\cleanup.vbs

    Syntax 2:

    copy c:\cleanup.vbs /Y
    start cleanup.vbs

    Note: If you use the second syntax, then when the build plan runs, it copies the cleanup.vbs file to the plan's working directory on the remote Bamboo agent machine.

    When you abort the plan, the Script task automatically runs and closes UFT One to release the license.

    Note: We recommend that you run the remote Bamboo agent as the admin.

  5. Check whether the license was successfully released. See Check whether the license was released.

To check whether the license was released:

  1. On AutoPass License Server, click the Usage Reports menu.

  2. Under UFT Enterprise Concurrent User, click the History tab.

  3. In the table on the bottom of the page, check the CLIENT INFO column and find the record about your license.

    • If you can find the license record there, your license was successfully released.

    • If your license is on the In Use tab, your license remains in use.

Back to top