TL:DR Use the links below to see a video on each Flow:-
I recently volunteered at the awesome Ministry of Testing’s Testbash UK 2022. A huge draw for me was meeting the wonderfully talented Julia Pottinger who, with the backstage support of her QA partner Orane Findley wowed the attendees with her characteristically clear and simple explanation of “Next Level API Automation”.
Julia’s talk included the following slide, which detailed 6 important high level scenarios to consider when performing API tests. I thought it might be good to show examples of how, you can execute tests in all 6 areas using Postman Flows.
Scenario #1 Schema Testing
As JSON parsing seems to be done on a field by field basis in Flows, it doesn’t currently seem possible to extract the entire schema from the response body in order to compare it with a stored value (correct me if I’m wrong folks!). However, if you want a visualisation that your schema test stored within the tests tab of your request has worked, then here is a good way to do that.
Scenario #2 Security Testing
You can use the
create data block to add different data sets to run against a request. I walk through a very aesthetically pleasing example here. 😻
Scenario #3: Workflow Testing
As highlighted by Julia Pottinger at the Ministry of Testing’s amazing Testbash UK 2022, testing an end to end workflow through API calls is often essential. Think about it logically, how do you know if a delete call has worked if you don’t then check the data isn’t then available?
Using Flows to test workflows is a major use case for this Postman feature, because you can see exactly what’s happening. Here is an example workflow test using Postman Flows.
Scenario #4: Negative Testing
Here I cover 2 different but connected scenarios:-
1. You want to verify the status code and message (e.g. 400 Bad Request)
2. You want to verify a string within the error response (e.g. “the length must be 3-18 characters”
An added bonus is generating test data within Flows using both lists and records, which although might not be ideal for large test data sets, would be very handy for smaller ones such as testing what happens if 3 different invalid inputs are entered for the same request.
Scenario #5: Performance Testing
So we know that scaled and in-depth performance testing is one of the few things that Postman isn’t really built for. Although Flows is no exception to that, if its cheap and cheerful performance testing you’re after (say, executing the same scenario 10 times and checking the response time is under a certain threshold) then that is absolutely doable.
Scenario #6: Positive Testing
Last but certainly not least – time for the happy path! 🙌
In this example, I show how it is possible to execute 6 endpoints at the same time, and apply the same conditional logic to all of them to check:-
* status code is 200
* response body value is correct (“status: UP”)
This gives a really clear indicator when running a health check against several different API’s at the same time. Which is one of the huge benefits of using Flows.
And that’s it! I hope that structuring this post around Julia’s essential test scenario’s made sense to you, and that you were inspired to try Postman Flows next time you are looking to test your API.
Til next time! 👋