Automated API integration testing
Automated Api Integration Testing can save you guys for a lot of extra UI testing. Of course the UI can still brake from style changes but it can’t brake because of the data integration.
This can be easily done running a sequence of API requests, where each request depends on the output of the previous requests.
Related Articles
As an example:
- Create an API request to create an user
- New API to get user details for the new created user
- New API request to update your user details
- New API request to change user permissions
- New API request to check your permission call if user details permissions were updated
- New api request to delete your user
This might look a bit overwhelming but it not imagine , you have an api app called api-com-users and the second one api-com-permissions.
With this integration tests you tested the integration between those 2 and the only thing left is to test the UI separated.
You can easily get started with using cucumber with api testing and write your integration tests. If you are in a continuous integration environment you really need to have integration tests that are running when something gets merged into your master branch otherwise you’ll have to run your UI tests all the time and that can be a bit time consuming when we are talking about thousands of tests.
Api step definitions:
Where new user data is :
API request to delete just created user:
Assert your response code:
This is the most simple example I can give to you , but this test should still go one , to fetch user , expect 404 as is delete , check delete user permissions and expect the right response code back.
For a most complex example of api integration testing check Graham Cox’s article here.
Happy testing!
The post Automated Api Integration testing appeared first on Testingrepository - Talking about selenium , and our passion.
This post first appeared on Testing Repository - Creating Testing, please read the originial post: here