Run API tests in a GUI test - Use-case scenario

Relevant for: GUI tests only

This use-case scenario describes an example of how to incorporate tests for the API (service) layer of your application into a GUI test.

For the purposes of this scenario, you will be using a flight booking application similar to the Flight GUI and Flight API applications provided with the OpenText Functional Testing installation and used in the GUI tutorial for Web applications.

Application description

In your application, you have four different pages, which correspond to the different tasks involved in booking a flight:

Logging in to the booking site Login page
Finding flight options based on customer selections Flight Finder page
Selecting a flight from the list of flight options Select Flight page
Booking and confirming a customer's flight selection Book Flight page

In addition, your application has a number of API processes to help the application process flight booking requests:

Finding user login credentials in the database Login operation
Searching for a list of all available flights and displaying the flight list FindFlights operation
Creating a flight order CreateFlight operation
Confirming a flight booking ConfirmBookFlight operation
Updating a flight order UpdateFlightOrder operation
Deleting a flight order DeleteFlightOrder operation
Deleting all flight orders DeleteAllFlightOrders operation

Back to top

Create your test

To set up your GUI and API tests:

  1. Create a separate GUI action for each application page, giving it the same name as the page name.

  2. Create a separate test for each API process, naming each test with the process name.

  3. In order to fully test your application, you decide to place an API test after each GUI test. The API test checks to see whether the API processes run by that specific application's page (Login, Flight Finder, Select Flight, or Book Flight) are working correctly.

  4. In your GUI actions, you insert a call to the corresponding API test.

    The API test appears is displayed as nested inside the GUI action.

    For example:

    After you insert all the calls to the corresponding API tests, you have a call to an API test inside each of your GUI test actions as listed in the table below:

    GUI Test Action Name

    Calls API
    test

    Login Page Login
    Flight Finder Page FindFlights
    Select Flight Page CreateFlight
    Book Flight Page ConfirmBookFlig

Note: If you want to pass data from a API test to use in an GUI test, you must create a test output parameter in your API test. For details, see Edit Input/Output Property/Parameter Dialog Box (API Testing).

Back to top

Run the test

After adding the necessary calls to your API tests, you can run the test.

The GUI test executes each step the user interface in the flight booking application user interface.

For each API test call in the GUI test, OpenText Functional Testing compiles the API test and runs it. OpenText Functional Testing displays the API test steps running in the Output pane.

For example:

Back to top

Run results

After the test run is complete, you can check the test results for the GUI test, including calls to each of the API tests. The run results show the completion and pass/fail status for each step.

Back to top