Creating a test case

The following instructions show you how to create a test case using the API Manager.

  1. Log in to the API Manager.

  2. On the Home page, click the Test APIs tile.

  3. On the Test page, select a test suite.

  4. In the Create Test page, go to the Tests > Test Cases tab, and click Add.

  5. Select a test case creation method:

    test case creation method

    • From spec (build with smart generation): Generates a complete test case that leverages NLP to help developers and QAs test their APIs effectively in an efficient way
    • From Specification: Builds test case from OpenAPI specification
    • From API Endpoint: Generates test case from a specified endpoint
    • From scratch: Creates a test case with your own request and test conditions

  6. If you selected From spec (build with smart generation), click Next, then perform one of the following steps:Select one method

    1. Go to the Existing APIs tab:
      1. Select a predefined API.
      2. Click Next.
      3. Select a path.
      4. Enter the API name.
      5. Provide a brief description.
      6. Add tags.
      7. Click Next. You will see the message that the test case has been generated.
      8. Click Edit. You will see the generated test assertions. You may edit the test assertions as needed.
      9. Click Save.
      10. Click Run Test.
    2. Go to the Import tab, do one of the following:
      • Drag and drop a JSON or YAML file that has the API test case definition OR
      • Enter an URL for the API test case. Provide username, and password if required, for authentication.
      1. Click Next.
      2. Select a path.
      3. Enter the API name.
      4. Provide a brief description.
      5. Add tags.
      6. Click Next. You will see the message that the test case has been generated.
      7. Click Edit. You will see the generated test assertions. You may edit the test assertions as needed.
      8. Click Save.
      9. Click Run Test.
  7. If you selected From specification, click Next, then perform one of the following steps:Select one method

    1. Go to the Existing APIs tab:
      1. Select a predefined API.
      2. Click Next.
      3. Select a path.
      4. Enter the API name.
      5. Provide a brief description.
      6. Add tags.
      7. Click Next. You will see the message that the test case has been generated.
      8. Click Edit. You will see the generated test assertions. You may edit the test assertions as needed.
      9. Click Save.
      10. Click Run Test.
    2. Go to the Import tab, do one of the following:
      • Drag and drop a JSON or YAML file that has the API test case definition OR
      • Enter an URL for the API test case. Provide username, and password if required, for authentication.
      1. Click Next.
      2. Select a path.
      3. Enter the API name.
      4. Provide a brief description.
      5. Add tags.
      6. Click Next. You will see the message that the test case has been generated.
      7. Click Edit. You will see the generated test assertions. You may edit the test assertions as needed.
      8. Click Save.
      9. Click Run Test.
  8. If you selected From API Endpoint, click Next, then perform the following steps:API endpoint

    1. In the Request section, select a method, enter the API endpoint that was generated when you published the API, set the authorization if required, and click Send. You will see the response in the Response section.
    2. Click Next.
    3. Enter the test name, description, and tags, then click Next. You will see the message that the test case has been generated.
    4. Click Edit. You will see the generated test assertions. You may edit the test assertions as needed.
    5. Click Save.
    6. Click Run Test.
  9. If you selected From scratch, click Next, then perform the following steps:

    1. Enter the test name.
    2. Provide a brief description.
    3. Add tags.
    4. Click Next. You will see the message that the test case has been generated.
    5. Click Edit.
    6. Enter the API definition. Refer to the Test Defintion Syntax for a sample.
    7. Click Save.
    8. Click Run Test.

What to do next