Run API Tests with GUI Tests

Relevant for: GUI tests only

UFT One enables you to run both GUI and API tests for in a single unified test run.

Call an API test or action from a GUI test action

Insert a call to an API test or action in any GUI test action. During the test run, UFT One pauses the steps of the GUI test, runs the API test or action in its entirety, and then continues the GUI test run.

During the run session, the Output pane displays a real-time log of the steps that are being performed in the API test.

For example:

Back to top

Licensing for calling API tests and actions

To call API tests and actions, you must be using one of the Unified Functional Testing (UFT) licenses. The earlier Functional Testing and QuickTest licenses do not support API testing.

If a UFT license type is not available, the run session behavior differs, depending on how you are running the test:

When running from UFT One

The GUI test runs until the step calling the API test is reached, and then fails.

When running from ALM If the GUI test contains a call to an API test, UFT One does not open and the test does not run.

For a use case scenario describing this process, see Run API tests in a GUI test - Use-case scenario.

Back to top

Insert or modify a call to an API test

Insert a new call

  1. Click the Insert Call to New Action button .
  2. Select Call to Existing API Test/Action.
Modify an existing call Right-click the step select Edit Call to API Test/Action.

Note: Do not insert a call to an API test or action that contains a call to a GUI test, as this can cause unexpected behavior.

UFT One inserts a step that calls the API test or action.

The call to the API test is displayed in the canvas as a call inside the relevant action of the GUI test.

For example, in the Editor:

RunAPITest "<API test name>"  

In the canvas:

Back to top

Use API test parameters in a GUI test

After you add a call to an API test or action, the input and output parameters are available for use in your GUI test.

Input parameters

If you want to use values for the API test input parameters during a GUI test run, specify the parameter value in the Call to API Test/Action Dialog Box.

When the API test is run during the GUI test, UFT One uses the values you specified for the appropriate parameters in the API test.

Output parameters

If you want to use values for the API test output parameters, you must assign a variable name to the output parameter in the Call to API Test/Action Dialog Box, or assign the API test output value to a variable or a data table parameter in the GUI test.

This variable or data table parameter is then available to use in other steps of the GUI test.

Back to top