Automatically generate API tests

Relevant for: API tests only

This task describes how to automatically generate API tests from external documents.

Note: This task is part of a higher-level task. For details, see Create an API test.

Overview

To create API tests using the full IDE functionality, you must fully understand your application's service layer: what processes are used, what parameters are passed between layers of the service, and other similar details. This can sometimes be very difficult.

However, if you want to quickly create a test of your application, OpenText Functional Testing provides tools to automatically generate an API test, including test steps and step property values.

This can be helpful if you have existing API resources (such as WSDL documents or other service model description documents) that need to be made into a functional test of your application's API.

Back to top

Generate your test from a WSDL file

This wizard takes the content from a WSDL file and creates a full API test, including all the steps in the test, and all the property values entered. After you select the appropriate file (which contains the meta description of your service), you select the methods to include in the generated test.

You can generate multiple and separate tests for a number of different testing aspects.

To generate an API test from a WSDL file:

  1. Open the API Test Generator Wizard (available from the Windows Start menu) and click Next.

  2. In the Select Service window, select from where to import your WSDL file:

    • URL: The URL in which this file is stored. Make sure that the URL is accessible when you try to select the service.

    • File: A location on the file system.

    If needed, enter the authentication and proxy settings if you are importing the WSDL from a URL location.

  3. Click Next.

  4. In the Select Methods window, select the methods to use in the test. These methods are created from the metadata specified in your WSDL file.

  5. In the Select Aspects window, select the types of tests you would like to create:

    Types of tests Description
    Positive Testing A full positive test that checks that the service's operations work as expected. This adds relevant checkpoints for each step (although these are not enabled by default).
    Standard Compliance Checks the service compliance with industry standards such as WS-I and SOAP.
    Security Testing - SQL Injection Vulnerability Checks if the service is vulnerable to SQL injections by injecting SQL statements and errors into relevant parameters.
    Security Testing - Cross-site Scripts (XSS) Attempts to hack the service by injecting code with relevant parameters that will disrupt its functionality.
    Boundary Testing - Extreme Values Provides invalid data types to the services and verifies they are not accepted.
    Boundary Testing - Null Values Provides NULL parameters to the components to verify they are not accepted.
  6. In the bottom of the Select Aspects window, specify where to save the created API test. By default, this folder is C:\GeneratedAPITests.

  7. Click Next.

    OpenText Functional Testing automatically generates the test. Generation progress and error details are displayed in the Generate window.

    If you need to view log details on the test generation, or open the test folder, you can access these from the Generate window.

Back to top

Generate your test from a SOAPUI test file

If you have previously created tests in SOAPUI, you can convert these tests into Web service API tests. The test is automatically generated, containing the steps and the test properties.

  1. Open the SOAPUI to API Test Converter (available from the Windows Start menu).

  2. In the SOAPUI to API Test Converter window, navigate to the directory in which your SOAPUI test was saved.

    Note: The SOAPUI test must be a SOAPUI project type. Other SOAPUI project types are not supported.

  3. Select a destination directory for the converted test and click Convert. A full API test (with a .st extension) is created in the specified folder.

    You can also use the following command line options to convert a test:

    soapUI2APITestCMD.exe /<source soapUI_file> /destination <destination directory>/logs <log_directory>
    

    Command Line Switch

    Description

    /source

    The absolute path to the soapUI file with an .xml extension, to be converted.

    /destination

    The absolute path of the folder to where the created API tests will be written.

    /logs
    (optional)

    The absolute path of the folder in which to write the log file. If this option is omitted, the log file is written to the destination folder.

    -? or /?

    Show the parameters and their usage. For example: soapUI2APITestCMD.exe -?

Back to top