Download presentation
Presentation is loading. Please wait.
1
Agile testing for web API with Postman
Presented by Anthony Todisco © All rights reserved
2
Advanced Automated Testing
Agenda API and Agile API testing Rest-assured Postman Our journey with Postman Key takeaway Q&A User Conference on Advanced Automated Testing © All rights reserved
3
Advanced Automated Testing
API and Agile Growth in the number of API Importance of time to market Today, we see an explosion of the number of web APIs in the industry due to the popularity of the client-server paradigm in consumer and business products. More and more companies are making the shift-left towards DevOps continuous integration and continuous deployment development, because time to market is the key in today’s business That means development and our feedback need to be quicker than ever in order to determine if our applications are ready to ship or not. User Conference on Advanced Automated Testing © All rights reserved
4
Advanced Automated Testing
API and Agile Agile methodology to produce quick results But UI testing is currently: too slow Not adapted to Agile The Agile methodology is a great help to quickly produce value, respond to customer demands and have feedback. However focusing only on UI automation can kill your test automation efforts. There is a host of reasons why. The main one being that UI tests are notoriously slow. That singular reason is why API testing is so important and why you should have it as part of your overall automation strategy. User Conference on Advanced Automated Testing © All rights reserved
5
Advanced Automated Testing
API and tests Test automation is the key Multiple possibilities for test automation Which one to choose? User Conference on Advanced Automated Testing © All rights reserved
6
Advanced Automated Testing
Rest-assured test First choice for most people Java Domain Specific Language (DSL) for test Support response parsing (XML and JSON) BDD Syntax: Easy reading Maintainable Source code and tests in the same project Rest-assured is one of the top answer for this question and for most people first choice for automation. Rest-assured is a fluent Java library you can use to test HTTP-based REST services. It’s designed with testing in mind, and it integrates with any existing Java-based automation framework. It provides a BDD-like DSL that makes creating API testing in Java simple. It also has a bunch of baked-in functionalities, which means you don’t have to code things from scratch. If your team is made up mainly of Java coders, this will be the best choice User Conference on Advanced Automated Testing © All rights reserved
7
Advanced Automated Testing
Rest-assured test No report need another unit test framework What if your code is not Java ? If your QAs are not developers ? At first glance, Rest assured seems to be the perfect solution But, it does not have a integrate way to export result in HTML or XML, you will need another unit test framework for this Other point, if your project is not in Java, will you choose to use another development environment for test ? And last but not the least, if your QA team is not found of coding User Conference on Advanced Automated Testing © All rights reserved
8
Advanced Automated Testing
Postman A UI tool for API testing Good for: Exploratory tests Functional and automated tests Easy to use Support response parsing (XML and JSON) Define the concept of collection for a group of requests You might want to consider Postman. Postman is a nice option for exploratory-type API testing but it’s also powerful enough that you can create more integrated solutions if you wish. It is a UI tool to test API by sending web request and getting back reply User Conference on Advanced Automated Testing © All rights reserved
9
Advanced Automated Testing
User Conference on Advanced Automated Testing © All rights reserved
10
Advanced Automated Testing
Postman CLI (Newman) that integrates greatly with Jenkins CLI, XML and HTML reports Support SOAP call Basic Javascript testing with boolean Postman also has a command line integration named Newman that interacts very well with Jenkins This command line allows you to have a CLI, XML and HTML report. Moreover, you can also create your own export and customize the output template Postman also support SOAP call for your tests And finally tests are written with basic javascript Show example of test User Conference on Advanced Automated Testing © All rights reserved
11
Our journey with Postman: Split
1830 lines 500 lines lines 2100 lines Less than 4000 lines Ok, so now, you’ve seen why we choose Postman. But even if everything seems good, we faced some “issues” by using it At first, we have a nice collection with some tests. Then, we started to add more and more tests in it and finally we get a really big file. Since we were multiple people working on it, it begun to be difficult to follow what was exactly changed on our source control tool and we faced some issue while merging So we decided to split our big collection into small ones. And like this we gain on checking time, on merge time and multiple QA can works on the same time User Conference on Advanced Automated Testing © All rights reserved
12
Our journey with Postman: Combine
As a counterpart of the split, we cannot generate anymore our full report file. Indeed, to generate this, the Newman command take only one collection file as input. So, using the some infos provided by Postman and the fact that collection files are JSON files, we created an internal tool, that we named orchestrator, to combine them into one and retrieve our first big collection. After that we can run back our Newman command And Tada!!! Back again with our beautiful report User Conference on Advanced Automated Testing © All rights reserved
13
Our journey with Postman: BDD
Reporting and sharing tasks problems solved But remember we are an Agile team and in an Agile team, the testing part involve everyone So why not using BDD in order to achieve this The basic testing way in Postman is not fit for this approach Postman is in fact a node application, so we can load by using a little javascript trick an external code Like this we can load a describe-it syntax that makes our test structure more readable With this, we can share with all the team and even externally this kind of test skeleton in order to validate our behavior It also loads methods that help you writing in a human readable language for the tests User Conference on Advanced Automated Testing © All rights reserved
14
Our journey with Postman: Replication
Saved re-usable functions into Postman environment Use the collection structure at your advantage 5 lines on every collection Everything seems nice now But we’ve found another point that we wanted to fix: the code replication Indeed, some tests and even some part of the tests were repeated on multiple places and if there was even a small change, we needed to update every collection we created. Postman gives you a helping hand on this with two things: Save functions in Postman environment Use structured call to avoid duplication In Postman the basic workflow is the following, you send a request and receive a response on which one you can run your tests You can even define some actions on a pre-request script In order to avoid duplicating some code, you can use the structure. You have a Collection level pre-request script that will be call before every requests, then another one at folder level and then the current request pre-request script The same apply to test scripts 510 lines on every request User Conference on Advanced Automated Testing © All rights reserved
15
Our journey with Postman: Feedbacks
80 % Reduction of file size (after splitting) 30 % Time reduction on develop/review per US Easiness Using BDD and re-used function Better communication Between developers, QAs and PO with BDD User Conference on Advanced Automated Testing © All rights reserved
16
Advanced Automated Testing
Key takeaway Simple yet powerful tool Use small collections to share work Integration of Newman with Jenkins Avoid duplicate code by using environment Use Collection structure to your advantage User Conference on Advanced Automated Testing © All rights reserved
17
Thank you Any questions? © All rights reserved
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.