As the number of APIs communicating with microservices in apps continues to increase, many bugs cannot be captured by UI testing alone. Our API Testing and Monitoring solution combines automated testing, reporting, debugging, diagnostics, and immediate data-driven insight in a centralized platform.
Running a functional test on an API takes seconds and will display a pass/fail status as well as the cause(s) for any failures, such as a broken endpoint, API flow, or a bug in the app itself. You can then reuse functional tests as end-to-end monitoring tests that run continuously, thereby maintaining accurate and reliable feedback loops. And by developing APIs in parallel with your testing, you can accelerate working and improve quality throughout development, staging, and production.
This Quickstart guide will get you up and running with a functional API Test. Let's get started!
What You'll Need
If your APIs are behind a firewall, you'll need to set up a Sauce Connect Proxy tunnel before proceeding.
Log in to Sauce Labs, then click API Testing.
From the list of test creation methods, click Use HTTP Client.
If you're seeing an existing list of Projects instead of the landing page shown above, click Create Project instead.
- In the Create a New Project window:
- Set the Create from dropdown to blank project.
- Enter your Project Name.
- Optionally, you can add Tags, a Description, Notes. For the purpose of this Quickstart, leave Access as-is.
- Click Save when you're finished.
For the purpose of this Quickstart, we'll test a
GET call from Dog CEO, a public API that generates a list of dog breeds.
In the HTTP Client tab > Enter request URL field, enter
Click Send to submit this HTTP request.
The JSON response — in this case, a list of dog breeds — will populate in the Body section along with a 200 OK success status.
Click Generate Test.
In the New Test window:
- Enter your Test Name.
- Optionally, you can add a Description and/or Tags.
- Click Create Test when you're finished.
This will generate a series of functional tests for this specific API request.tip
Viewing your test data
Visual view shows your test as components:
Code view displays it as code:
Click the Run button to run your test.
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.
View Test Results
To view your test results, hover your mouse over your test line item and click Open report document.
Your test report will open in a new browser tab. The report displays granular test information that's helpful for debugging any failures (more info).
Publish Your Test
Our API Testing interface has a unique working copy/published copy workflow that allows you to edit a test without affecting the active (already published) version. Here's how to publish the working copy of your test.
Once you've finish reviewing and/or editing your test, navigate to the Unpublished changes section, where it states that your test is currently unpublished.
Click the Publish button to publish your working copy.
Optional Next Steps
Sauce Labs API Testing has a full suite of tools that enables comprehensive continuous integration testing.
- Set up a recurring test schedule so that you can monitor the health of your APIs.
- Add logic/components using the Composer.
- Create a new test from a spec file or Postman collection.
- When you generate a test this way, the test components will be based on your imported request-and-response data.
- Create a new test from scratch.
- Watch our API Testing and Monitoring