Running API Tests with GUI Tests

Relevant for: GUI tests only

If you have both GUI and API tests for your applications, you can run both tests together in a single unified test run.

Insert a call to an API test or action in any GUI test action. During the test run, UFT 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.


Licensing for calling API tests and actions

To call API tests and actions, you must be using a Unified Functional Testing Help Center license.

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

When running from UFT

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 does not open and the test does not run.

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

To see a demonstration of this functionality, go to the UFT Apps Marketplace page and select the Introduction to API Testing video.

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 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:

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 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.