Requirements
To test a SOAP service in ReadyAPI, you need a WSDL definition of this service. This definition describes operations of the service, and the format of requests and responses. ReadyAPI uses this information to simulate requests.
REST services can also have definitions. Most frequently-used definition formats are OpenAPI (formerly known as Swagger), WADL, and some others. You can load these definitions in ReadyAPI and create test cases based on information in these definitions.
In a general case, a REST service may have no definition at all. You can create tests for such services in ReadyAPI by recording requests to service URLs (this is called API Discovery). ReadyAPI will get information on request and response parameters based on the tracked traffic. However, this “observational” data is not as precise as information from a definition, so, we recommend using definitions when it is possible.
Web Service Definition We Will Use
We will create a test for the Petstore sample web service. This is a REST service. You can find its definition here –
https://petstore.swagger.io/v2/swagger.json
This definition has an OpenAPI 2.0 (Swagger) format. No need to download the definition now. ReadyAPI will do this later when we create a functional test. See below.
Create a Test
-
Open the start page, click Create Functional Test and, in the subsequent dialog, select API Definition:
-
In the subsequent wizard, specify the URL of your web service’s definition. In this tutorial, we will use the following URL:
https://petstore.swagger.io/v2/swagger.jsonClick Next to continue.
-
Select if you want to create a new project for the definition you have added, or add it to the existing project.
Note: If no projects are open in your workspace, the wizard will skip this step. In this case, ReadyAPI will create a new project and add the new test to it. Click Next to continue.
-
On this page of the wizard, you can select assertions to be added to the test. ReadyAPI adds the selected assertions to new test requests.
Assertions verify that your API works as expected. Later in this tutorial, we will describe them in more detail, but now, clear the selection and click Next.
-
Select if you want to have one test case for all operations defined for your web service, or use multiple test cases (one per each operation). Let’s use the latter option:
Click Finish to create a test.
-
ReadyAPI will create a test project and add test cases to it.
After that it will display one more dialog box, where you can run the created tests or add a data source to them. In this tutorial, we will not use these options. Close this dialog:
You can see the project in the Navigator panel on the left. On the next step of this tutorial, we will explore the created project, the service and its operations.