August 19, 2019

How to Achieve Continuous API Testing With BlazeMeter

API Testing

Continuous testing means testing our APIs both pre-production and post-production (shift right testing). Testing doesn’t stop once we hit production. An API going down can have a dramatic effect on your site and its functionality, so real continuous API testing has to include API Monitoring.

Table of Contents: 

What is Continuous API Testing?

Continuous API testing means testing your API’s both pre-production and post-production continuously. Real continuous API testing must also include API monitoring.

Historically, testing would take place only at the GUI level, and only at the end of the development process. When a developer would finish their work they would hand it off to the QA team. The engineers had limited time so they would test the code at the highest level - the GUI. This would cover both the front-end and back-end development.

In the age of Agile, testing must take place at a lower level, i.e at the API level. Developers can even do it themselves. API testing, because “API contracts” can even be created before development is complete. This means developers can validate their code based on pre-written tests (aka Test Driven Development).

Continuous API Testing and Monitoring with BlazeMeter

With BlazeMeter’s new Continuous Testing functionality, you can test and monitor your APIs throughout the entire SDLC. I’ll talk you through how to do it.

Continuous API Testing and Monitoring with BlazeMeter

3 Easy Ways to Run API Tests in BlazeMeter

There are several easy ways to create an API Test with BlazeMeter.

1. You can simply create it within the UI.

Continuous API Testing with BlazeMeter UI

2. Toggle to add your own script in Taurus.

API Testing with Taurus

3. Or you can import from file types like JMeter and Swagger.

API Test with Swagger

Now these tests can be data-driven, if we look at the scenario level in the next screenshot data can be imported from a CSV file and variables can be defined at a scenario level to be used by all of the tests within the scenario.

API Test with JMeter

Now we click Run Test.

Running API Tests in BlazeMeter

You can see all your API test results here. You can also see more detailed reporting.

API Reporting

We can also look for the content of the response to validate that the data is correct within the API Test.

API Monitoring With BlazeMeter

Having an API down can be devastating to your business. We need to be able to understand not only “Is the API down” but also, if the vendor sticking to the SLA they supplied.

We don’t always have access to the 3rd party infrastructure, so we need a way to be alerted if that third-party API is no longer available.

We can check this in the API Monitoring screen of the BlazeMeter platform.

API Monitoring with BlazeMeter

You can click on the test itself within the application to look at the output.

API Monitoring with BlazeMeter

Here we sent a request, got back a “200”, and we can see the details of the response, both for passed or failed API tests, as in the example below.

BlazeMeter API Monitoring

You can also enable the scheduler to easily run API Monitoring tests on a specific API at regular intervals.

Easy API Monitoring for Developers

BlazeMeter’s API Monitoring feature provides access to enterprise-level reporting so that you can continuously monitor and track multiple reports, that can then easily be shared with other users in your workspace.

Enterprise API Monitoring

These reports show:

  • Average response rate
  • Success rate
  • You can change the time frame to adjust the view
  • You can also drill into the failures to better understand what the problem was.

Enterprise API Monitoring

  • You can connect the monitoring features to your daily workflow solutions to be notified if an API goes down.

Current integrations include:

  • Slack
  • Pagerduty
  • AWS CodePipeline
  • Datadog
  • Hipchat
  • Ghost Inspector
  • Jenkins

Bottom Line

An API-first strategy requires a strong testing pipeline. Continuous API testing needs an intentional process that makes sure all the systems work together. 

Breaking down the testing process into three phases; writing good tests, running tests both pre and post-production and API monitoring allows you to continuously test your APIs.  This process ensures that your apps are always on and performing at their best.