Skip to main content

Building an API Test from a Spec File

Using the API Testing HTTP Client, you can generate tests from external endpoints or files such as an OpenAPI Specification (spec).

What You'll Need


Looking to import from Postman? See Importing Postman Collections.

Importing Your Spec File

  1. Log in to Sauce Labs, then click API Testing.

  2. Go into any Project.

  3. From within a Project, click the HTTP Client tab.
    HTTP Client Button

  4. Click the Import OpenAPI/Postman button, then Import OpenAPI/Postman Collection/.har and then, select and upload your file from your local machine.
    Import OpenAPI / Postman button

  5. Click on the folder in your Snapshots tree where you'd like to save your file.
    Import to Snapshots folder

  6. Click Save.
    Import file to Project

  7. After saving, you'll be able to view all of your endpoints under Snapshots, grouped by subdirectory. Click on the name of the request you'd like to test.
    Import to Snapshots folder

    The URL will populate in the Enter Request URL field.
    Sample request

    The response body will populate in the Body area.
    Response Body

Generate a Test

See the Quickstart guide for the steps to generate, run, publish, and view test results.

More Information