Run a test or component

Relevant for: GUI tests, scripted GUI components, and API tests

Prerequisites

Do one of the following:

  • For GUI tests and components: Ensure that any required UFT One add-ins are loaded in the Add-in Manager when you open UFT One.

  • For API tests and components: Set the run mode as Release or Debug in the API Testing General pane in the Options dialog box.

    Note: Release mode runs the test more quickly, as it does not load the debugging mechanism.

Back to top

Set the number of iterations for the test

Do one of the following:

For GUI tests

 In the Run tab of the Test Settings dialog box, specify the number of iterations:

  • Run one iteration only. Runs the test only once, using only the first row in the global data table.

  • Run on all data rows. Runs the test with iterations using all rows in the global data table.

  • Run from data row __ to data row __. Runs the test with iterations using the values in the global data table for the specified row range.

    The first row in the data table contains the column names. Therefore, the data row number is always 1 lower than the row number in the data table display.

    For example, in the table below, Alex is listed in data row number 3, which is table row number 4.

For API tests
  1. In the canvas, select the Test Flow or Loop box

  2. In the Properties Pane, open the Input/Checkpoints tab .

  3. Set the number of iterations.

Back to top

Run an entire test or component

  1. In the toolbar, click the Run button .

  2. In the Run dialog box, choose where to save the run session results, and define any input parameters you want to use, as described in Run Dialog Box, and Run Dialog Box: Input Parameters Tab (For GUI and API tests and components).

  3. Click OK. The Run dialog box closes and the run session starts.

    When running a test, only keep the current action in focus in the document pane. Bringing other actions into focus can cause a general run error.

    If you run a test with external resource files saved in ALM, keep in mind that the resource files are not refreshed for each test run.

    As a result, any changes made during the current session are not reflected in a test run until you close and reload test and its resource files.

Back to top

Compile an API test or solution

Sometimes, your API tests may require you to compile files before running the test. For example, if a test step calls a DLL assembly that is created during the test, you need compile the test to ensure that it runs correctly.

To compile the test, use one of the following commands:

  • Run > Compile > Compile <test name>: Compiles the entire test, including all necessary assemblies.
  • Run > Compile > Recompile <test name>: Compiles the entire test after a change has been made in a part of the test.
  • Run > Compile > Clean <test name>: Removes intermediate and output files enabling you to get a fresh compile of these files

You can also use similar commands for the solution, if a solution contains only API tests: Compile Solution, Recompile Solution, and Clean Solution.

Back to top

Run to a selected step or action

  1. Do one of the following:

    For tests
    • Select Run > Run to Step.

    • Right-click a step and select Run to Step.

    • Right-click an action in the canvas and select Run to Action.

    For components Select Run > Run to Step.
  2. In the Run dialog box, choose where to save the run session results, and define any input parameters you want to use.

    The run starts at the beginning of the test or component and pauses at the selected step.

Back to top

Run a test or component from a selected step

  1. Make sure your application is in a state matching the step or action you want to run.
  2. Select the step or action where you want to start running the test or component

    • In the test flow canvas, select the action.

    • In the Keyword View, highlight a step or action row.

    • In the Editor, place your cursor in a line of VBScript.

    Note: Make sure that the step or action you choose is not dependent on previous steps, such as a retrieved value or a parameter defined in a previous step.

  3. Do one of the following:

    For tests
    • Select Run > Run from Step.

    • Select Run > Run Current Action.

    • Right-click the step and select Run from Step.

    • Right-click the action in the canvas and select Run from Action.

    For components Select Run > Run from Step
  4. In the Run dialog box, choose where to save the run session results, and define any input parameters you want to use.

    Note: When running part of a test within the scope of an action, you need to specify the action's parameters, not the test parameters, in the Input Parameters tab of the Run dialog box.

Back to top

Interrupt a run session

Do one of the following:

  • Click the Pause button in the toolbar. The run pauses. To resume running a paused run session, click the Run button.

  • Click the Stop button.

  • Perform a file operation (for example, open a different test or component or create a new test or component).

Back to top

Run an API test from the command line

You can also run API tests using the ServiceTestExecuter.exe application, located in the product's <UFT installation>/bin folder.

Note: To run a test from the command line, you must save and run the test at least once.

Use the following syntax to call this utility:

%ProgramFiles%\Micro Focus\UFT One\bin> ServiceTestExecuter.exe -test  

You can use any of the following arguments:

Parameter name

Description

-test

The full path of the test (required). Specify the test directory—not the solution directory.

-inParams

The full path of an XML file containing the input property values (optional).

-outParams

The full path of an XML file containing the output property values (optional).

-profile

The name of a Test profile (optional). For details, see Define API test properties or user/system variables.

-report

The directory in which to store the report.

Note: If you use the -inParams or -outParams arguments, the XML file must have this structure:

<TestParameters>
        <Values>
                <Arguments>
                     <a>1</a>
                     <b>2</b>
                </Arguments>
        </Values>
</TestParameters>

Back to top

View run results

By default, when the run session ends, the run results open.

Note: If you cleared the View results when run session ends check box in the Run Sessions pane of the Options dialog box (Tools > Options > General tab > Run Sessions node), the run results do not open at the end of the run session.

You can also optionally automatically upload your run results to ALM if you are running a test from ALM. This option is set in ALM as a site parameter for your project. For details, see the Application Lifecycle Management Administrator Guide.

Back to top