Create Your First API Monitoring Test
API Monitoring helps you evaluate the performance of your API from the API consumer point of view, in addition to monitoring the uptime and correctness of your API.
An API test is a group of one or more HTTP requests executed sequentially. For each step in the test, you can define Assertions to validate response data and Variables to extract data to be used in subsequent requests. A test Passes if all the assertions pass. A test Fails if any assertion fails, or another error is encountered, such as a network connection problem.
You can run tests from the cloud or from behind your firewall against any public or private API. To use tests for ongoing monitoring, configure a schedule. After a test run completes, notifications can be sent via email, Webhook, PagerDuty, Slack, and more.
Create Your First Test
Follow these steps:
If you haven't yet, sign up for your free BlazeMeter account. After completing the tutorial, start by creating a new test (or API Tests > Create Test). You can name the test anything you like.
1. Add a Request Step
After you create a test, you will see an HTTP request step with a sample URL was automatically created and added to your test:
Our sample URL is guaranteed to return a 200 OK status code. Later on, when building your own tests, you can define requests with your own methods, URLs, headers, parameters, or body content.
2. Define Assertions
Define expected response data.
Follow these steps:
- Expand the request to view details.
- Select Assertions.
- Add the following assertions (we created one for the status code automatically):
The assertions are evaluated after the request is executed for every test run. If any assertion fails, the test will fail. For your tests, you can create assertions that check response time, JSON or XML content, HTTP response headers and more.
3. Run Your Test
Click Save & Run to start a new test run. The request is executed and when complete, each assertion will be checked. You should see that the test run Passed. Select the test run from the results list to view the full HTTP request, response and test output.
Next Steps
- Use variables to insert dynamic data and pass state between requests.
- Learn about the available assertion sources and comparisons.
- Manage configuration across realms with environments.
- Run API monitoring tests from a private location. You can use Radar agent to bridge BlazeMeter API Monitoring to private APIs not available over the public internet. Note that Radar agent is a wholly separate installation from Private Location agents, and is specific only to BlazeMeter's API monitoring function.
- Schedule your tests to run automatically or run them as part of your build and deployment process.
- Receive email, Webhook, Slack, or PagerDuty notifications when test runs complete (or when they fail).
- Enable multiple locations to monitor your APIs from around the globe.