Skip to main content

Building Tests 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) file.

Supported Spec Formats
  • Currently supported: Swagger OpenAPI 3 Postman Collection
  • Pending: RAML API Blueprint I/O Docs SOAP WSDL

What You'll Need#

Importing Your Spec File#

  1. Log in to Sauce Labs, then click API TESTING > Get Started.
    API Testing landing page
  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.
    Import OpenAPI / Postman button
  5. Select the file on your local machine you wish to upload.
  6. Select the folder your Snapshots tree where you'd like to save your file.
    Import to Snapshots folder
  7. Click Save.
    Import file to Project
  8. 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
  9. Click Send. The response body will then appear.
    Response Body

Run a Test#

Follow the instructions under our Quickstart doc, starting with the Generate Test step.

More Information#

Coming soon: you'll be able to create a test by referencing the URL that points to your spec file. This feature is still available on the Legacy (On-Prem) API Fortress.