Record Test Case Tutorial

Applies to ReadyAPI 3.56, last modified on November 21, 2024

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

    Click the image to enlarge it.

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

    API Discovery: The Use built-in browser option

    Click the image to enlarge it.

  • 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

    Click the image to enlarge it.

  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

    Click the image to enlarge it.

  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

    Click the image to enlarge it.

  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:

    XML

    <Pet>
      <category>
        <id>0</id>
        <name>string</name>
      </category>
      <id>545646666</id>
      <name>doggie</name>
      <photoUrls>
        <photoUrl>string</photoUrl>
      </photoUrls>
      <status>available</status>
      <tags>
        <tag>
          <id>0</id>
          <name>string</name>
        </tag>
      </tags>
    </Pet>

    Copy the value of the id element.

    Getting a sample pet ID

    Click the image to enlarge it.

  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

    Click the image to enlarge it.

  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

    Click the image to enlarge it.

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

    Click the image to enlarge it.

  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

Discovery Tutorial
Using ReadyAPI as Proxy

Highlight search results