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) or HAR (HTTP Archive) file
note
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/HAR/Postman button, 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. - Click Send. The response body will then appear.
Run a Test
Follow the instructions under our Quickstart doc, starting with the Generate Test step.
More Information
- Importing Sauce Labs API Tests from Postman
- Features coming soon:
- Support for additional spec file formats: RAML, API Blueprint, I/O Docs, SOAP, WSDL
- Ability to create a test by referencing the URL that points to your spec file