Running postman collections in Bamboo and generate HTML/Testrail report

 


If you have a project in Bamboo and you want to run your api automation tests in postman by generating beautiful html report, follow the steps given:

  1. Create a new plan for your project and go into the plan configuration mode in bamboo. In default Job field, we gone create two tasks. One job is for building docker image and another for running tests in the docker container. In order to add task, you need to click “Add task” button and search for Docker.
End result of the plan configuration

2. After you clicked into the first Docker task, you want to provide a Dockerfile in order to build the image for newman. Newman is a command-line collection runner for Postman. The image for newman is available for download from docker hub, so you want to use postman/newman image as your base image. In your Dockerfile, you only need to point out the working directory and command for downloading npm package. In order to generate html report, newman-reporter-htmlextra should be included. And for posting test run results to testrail, newman-reporter-testrail is also available for download.

End result for first docker task configuration

3. For the second Docker task, you need to provide the testrail related key:value pair system environment variables. You could put these variables into Container environment variables field in the configuration. There is a very detailed explanation article that could potentially help you to understand the relationship between newman and Testrail. There are several environments related to testrail: TESTRAIL_DOMAIN, TESTRAIL_USERNAME, TESTRAIL_APIKEY, TESTRAIL_TITLE, TESTRAIL_PROJECTID, TESTRAIL_LOGGING. For full list of variables, please refer to the npm package site. For container command, you just need to provide the command after the keyword newman: For detailed tutorial for newman run command, please refer to the newman package site.

run <postman api URL to Collection or collection.json file> -e <postman api URL to Environment or environment.json file> -r testrail,htmlextra
End result of second docker task configuration

4. Artifacts: please follow the configuration format below

End result of Artifacts configuration in bamboo

5. It’s time for run the plan and get our result: You would see the html report is generated as artifact, and if you check your testrail page, you would see the new test run is added into your project.

End result for bamboo job summary
End result for Testrail integration

The code for dockerfile can be accessed here: Github



Comments

Popular posts from this blog

Hacker info 1: Ways to search domain information online