Automatically generate API tests

Relevant for: API tests only

This task describes how to automatically generate API tests from external documents. 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.

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

Generate your test from a WSDL file

Using the API Test Generator Wizard, you can create full tests (with all steps and step property values entered) from a WSDL file:

  1. From the Start Menu, open the API Test Generator Wizard (Start > All Programs > HPE Software > HPEUnified Functional Testing > Tools > API Test Generator Wizard) 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:

    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.

    UFT 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 previously had tests created using SOAPUI, you can automatically import these files into UFT to create Web service tests.

  1. From the Start Menu, open the SOAPUI to API Test Converter (Start > All Programs > HPE Software > HPEUnified Functional Testing > Tools > SOAPUI to API Test Converter).

  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