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
- A Sauce Labs account (Log in or sign up for a free trial license)
- An existing API Testing Project. For details on how to create one, see API Testing Quickstart
- An OpenAPI Specification file (v3.0 or higher)
Looking to import from Postman? See Importing Postman Collections.
Importing Your Spec File
-
Log in to Sauce Labs, then click API Testing.
-
Go into any Project.
-
From within a Project, click the HTTP Client tab.
-
Click the Import OpenAPI/Postman button, then Import OpenAPI/Postman Collection/.har and then, select and upload your file from your local machine.
-
Click on the folder in your Snapshots tree where you'd like to save your file.
-
Click Save.
-
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.
The URL will populate in the Enter Request URL field.
The response body will populate in the Body area.
Generate a Test
See the Quickstart guide for the steps to generate, run, publish, and view test results.