1. Create Functional Test

Applies to ReadyAPI 3.54, last modified on September 23, 2024

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

  1. Open the start page, click Create Functional Test and, in the subsequent dialog, select API Definition:

    Functional testing with ReadyAPI: Create a functional test

    Click the image to enlarge it.

  2. 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.json
    Creating API functional tests in ReadyAPI: Enter web service definition

    Click the image to enlarge it.

    Click Next to continue.

  3. Select if you want to create a new project for the definition you have added, or add it to the existing project.

    Creating API functional tests in ReadyAPI: Specify project

    Click the image to enlarge it.

    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.

  4. 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.

    Creating API functional tests in ReadyAPI: The Add assertions page

    Click the image to enlarge it.

  5. 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:

    Creating API functional tests in ReadyAPI: Select test cases

    Click the image to enlarge it.

    Click Finish to create a test.

  6. 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:

    Creating API functional tests in ReadyAPI: Additional options

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.

Prev     Next

See Also

Creating Your First Functional Test
Working With APIs

Watch the video
 
Highlight search results