Record Test Case Tutorial

In this tutorial, we will record a simple interaction with a website and generate a test case based on this interaction.

1. Open the Discover API dialog

  • Select File > New Empty Project and select:

    Create a new project
  • Select Discover API in the flyout menu:

    The Use built-in browser option
  • Select Use the built-in browser and click Add API:

    API Discovery: The Use built-in browser option
  • Click Add API to start recording.

2. Specify definition

ReadyAPI will offer you to specify an API definition. It allows you to filter the recorded requests and show only those that were sent to the specified web services.

You can specify the URL of the definition file or the path to the file. In this tutorial, we will use the sample Swagger Petstore service:

      https://petstore.swagger.io/v2/swagger.json
    

Specify this URL in the Discover API dialog and click Add and Record:

API Discovery: Specify definition

3. Record requests

ReadyAPI shows the Recording Overview dialog after test recording has started.

  1. Enter https://petstore.swagger.io/ and press Enter:

    API Discovery: Entering the URL
  2. In the pet Everything about your Pets section, click the GET method that corresponds to the /pet/findByStatus resource and click Try it out.

    API Discovery: Expanding the findByStatus operation
  3. The editor will offer you to select one of the available values for the status parameter. Select available and click Execute:

    API Discovery: Sending findByStatus request
  4. Scroll down to the Responses section and find the response body. It contains a list of pets that is represented by the Pet object, for example:

    Copy the value of the id element.

    Getting a sample pet ID
  5. Go down to the store Access to Petstore orders section, click the POST method that corresponds to the /store/order resource, and click Try it out.

    Expanding the POST mehtod
  6. The editor will show a sample request body. Paste the copied pet ID to the petId parameter. For the quantity parameter, specify 1. Click Execute to send the request:

    Posting an order

On the next step of the tutorial, we will create a test case based on the recorded requests.

4. Create test

After you record the scenario, you can generate a test case:

  1. Click Generate services.

    ReadyAPI REST Discovery: Generate services
  2. In the Generate Services dialog, check the Generate Test Case option:

    Generating services
  3. Click OK and enter the test suite and test case names.

  4. Select Close REST Discovery and click OK:

    API Discovery: Closing API Discovery

ReadyAPI will create a test case with a sequence of recorded requests:

API Discovery: Created test case

See Also

Publication date: