Run API Tests (Windows only)

In addition to using OpenText Functional Testing for Developers to test your application's user interface, you can also run an OpenText Functional Testing API test as part of your test. This enables you to test your application's service layer with the UI layer in a fully unified test of your application.

The results from the OpenText Functional Testing API test are included as part of your OpenText Functional Testing for Developers test results.

Note: It is not necessary to have OpenText Functional Testing installed on your computer to run OpenText Functional Testing API tests.

Prerequisites

Before running OpenText Functional Testing API tests in OpenText Functional Testing for Developers, you must:

  • Save and run the test in OpenText Functional Testing at least once.
  • If you installed OpenText Functional Testing for Developers as part of OpenText Functional Testing, enable HTML Report in OpenText Functional Testing. For more details, see Set run result reporting options.
  • Install the Microsoft Access Database Engine 2016 if you are running an API test using Excel data sources.
  • Add the appropriate using or import statements:

    • using HP.LFT.SDK.APITesting.UFT
    • import com.hp.lft.sdk.apitesting.uft.APITestResult;
      import com.hp.lft.sdk.apitesting.uft.APITestRunner;

Run tests

To access and run API tests, use the APITestRunner.Run method:

In the Run method arguments, you can also pass input parameters for the API test as shown below.

This method returns an APITestResult object containing the results of the test - both the status of the test run and the test output parameters (if relevant).

The results for the API test run are displayed in the OpenText Functional Testing for Developers report, with a link to open the results of the entire OpenText Functional Testing API test. These results can also be found in the test's results folder (RunResults/ApiTestReport).

For more details on these classes and methods, see the .NET SDK Reference or Java SDK Reference.

Back to top

Use the results of the API test run in other steps

Back to top

Assign values for the input parameters of your API test

While each input parameter for your API test contains a default value (as set in OpenText Functional Testing), you can set the values to use for the input parameters as an argument of the APITestRunner.Run method.

Note: If you define the parameters manually, you must define values for all input parameters in the API test (even if the test has default values for the parameters).

Back to top

Select a specific profile for your API test

In OpenText Functional Testing, you can specify multiple profiles for each API test. You can select one of these profiles to use as an argument of the APITestRunner.Run method:

Back to top

Pass the value of your test's output parameters to other steps

If you add an output parameter to your API test, the value of this parameter is available with the APITestResult class in OpenText Functional Testing for Developers. The APITestResult class returns this value and you can assign for use in other parts of the test:

Back to top

See also: