Tuesday, October 17, 2017

Postman Integration with Newman and Jenkins

Postman is a powerful GUI platform to make your API development faster & easier, from building API requests through testing, documentation and sharing.
If you are working on a long-term project and you are performing API testing with Postman, you may want to include postman tests into a CI system.


Continuous Integration (CI) is a development practice that requires developers to integrate code into a shared repository several times a day. Each check-in is then verified by an automated build, allowing teams to detect problems early.





1. What you need first, is to create a collection with Postman that will contain assertions/tests. You'll need to export this collection.



Save your collection and your environment locally.





2. The next step is to link Postman with your build system and for this, you can use Newman which works perfectly with Postman. To use it you'll need java jdk and node.js installed. Install newman with this command:


You can run your postman collection that was previously downloaded with the command below. If you used an environment, add to the command, -e environemnt_name.json argument at the end.



The test result in commander line will look like this:



3. The final step is to setup Jenkins to work with Newman.




You need to create a new freestyle job project and to add a new build step of type Execute Windows Batch Command.







Add this batch command:



Build the project and go to Console Output to see the result. You should see something similar like the result previously shown.




If you want to find more about Postman integration with Jenkins you can also visit these:



Happy testing and... make it green, becomes a dream :).

No comments:

Post a Comment

Popular Posts