As we move towards more Agile Shift-left software development processes like continuous integration and delivery, developers need to be able to quickly and efficiently run tests during the entire delivery cycle.
One downfall to UI functional tests is they are slow. This makes them less than ideal for letting developers know quickly if their code has broken the latest build or not. API functional tests, on the other hand, tend to be faster. API functional tests also tend to run more reliably than GUI functional tests because changes in the user interface usually occur more frequently then changes on the API level. Therefore GUI tests tend to be more brittle than API level tests.
What is API Functional Testing?
While most functional testing involves testing a user interface like a web page or application, API testing involves bypassing a user interface and communicating directly with an application by making calls to its APIs.
API Functional Testing consists of bypassing the UI and sending a request directly to an application’s backend or service and receiving a response, while validating the response to ensure things are working as we expect them to.
How does API Functional Testing work in Blazemeter?
We've just launched a new UI that allows you to easily create API Functional Tests. In this blog post I will explain to you how to create your first API Functional Test with BlazeMeter.
All we need to get started is an API endpoint to test. You can either use your own public API (we'll explain how to run an API Functional Test behind the on premise/behind the firewall in a separate blog post) or use the API of our demo test system. In the example below I will use a simple GET request of the REST API of our demo test system.
API Functional Testing for non-Blazemeter users
2. Enter https://api.demoblaze.com/entries and HTC One in the Assert field then click Start Test.
API Functional Testing with your current Blazemeter account
1. Click the Create Test button.
2. Then click API Functional Test.
3. Click on Request Name and enter Get all entries.
4. Enter https://api.demoblaze.com/entries in the URL field.
5. Click on Assertions, select Regex from the Choose type dropdown, then select Body from Subject dropdown, and simply enter HTC One in the Regular Expression field. Then click the Add button.
6. Let's give it a try - click Run Test.
The test should run, and in the report you will be able to see all the details about the request as well as the response, such as request and response size, response code, response time and latency, as well as body, headers, and assertions.
Why use BlazeMeter for API Functional Testing?
- BlazeMeter has an intuitive UI to easily create API Functional Tests without coding.
You can use the same tool to create performance tests and massive scale load tests for your API in a consistent way.
- BlazeMeter is based on open source technology and built for test automation, through dedicated Continuous Integration plugins for Jenkins, TeamCity and Bamboo and any other CI system through our CLI tool
- BlazeMeter provides comprehensive detailed reporting on request level as well as historic trend reports. Collaborate and share test results with teams.
You might also find these useful:
Interested in writing for our Blog? Send us a pitch!