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.
Using the API Test Generator Wizard, you can create full tests (with all steps and step property values entered) from a WSDL file:
Open the API Test Generator Wizard (available from the Windows Start menu) and click Next.
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.
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.
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.
In the bottom of the Select Aspects window, specify where to save the created API test. By default, this folder is C:\GeneratedAPITests.
UFT One 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.
If you previously had tests created using SOAPUI, you can automatically import these files into UFT One to create Web service tests.
Open the SOAPUI to API Test Converter (available from the Windows Start menu).
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.
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
The absolute path to the soapUI file with an .xml extension, to be converted.
The absolute path of the folder to where the created API tests will be written.
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 -?