Skip to main content

Create Your First Test

This is a quickstart guide for getting up and running with a Sauce Labs API Test using the HTTP Client or Import from Postman/Spec File feature. Let's get started!

What You'll Need#

Create Project#

  1. Log in to Sauce Labs, then click API TESTING > Get Started.

    API Testing landing page
  2. To set up a test, you'll need a Project first. On the API Testing dashboard, click the Create Project button.

    Create a Project UI
  3. In the New Project window, enter your Project Name. Optionally, you can also add a Description and Notes). Click Save when you're finished.

    New Project window

    This will bring you to the Tests dashboard under the project you've just created.

Create Test#

  1. Click HTTP Client.
    HTTP Client

  2. Choose from one of the below methods:

    • Method 1: Type an API endpoint URL into the Enter request URL field. If you need an example for this test, try https://dog.ceo/api/breeds/list/all.

      Enter API URL

    • Method 2: Import an OpenAPI spec file or a Postman Collection (see Build from Spec doc or Import a Postman Collection doc). If you need an example to import for this test, you can find one in the Postman doc. Once you're finished, click the API call under Snapshots that you'd like to test. The URL will populate in the Enter Request URL field.
      Import spec file

Send Request#

  1. Click Send to submit your API request.
    Enter API Request save

    If the request was successful, the response will populate in the Body section, along with a success status.

Generate Test#

  1. Click Generate Test.

    Generate Test
  2. Enter your test details in the New Test window, then click Save. This will generate a series of functional tests for your specific API request. If you imported from a spec or Postman, the test component data will be based on your imported request and response data.

    Here is an example that shows the same test in Visual View versus Code View:

    Visual ViewSample Test Visual View
    Code ViewSample Test Code View

Run Test#

  1. Click the Run button to run your test.

  2. In the right-hand nav, under TEST RUNS, you'll see that a new line item has populated with the name of your test. If successful, you'll see a green checkmark indicator and Completed with success message.

    Test Runs Section

Review Test Results#

  1. To view your test results, hover your mouse over your test line item and click Open report document.

    Open Test Results
  2. Take a moment to verify each object in your test report, which displays information regarding your test. See Test Outcome Reports.
    Test Results Page

note

At this stage, your test is still an unpublished draft. Sauce Labs API Testing has a lot of tools that allow for comprehensive continuous integration testing.

Advanced/Optional Step

Go back to your test's Compose tab > Visual view and try adding more logic.

More Information#