Integrate automated test in Azure DevOps using the Postman API

Mar 3 · 5 min read

Following my previous post about generating reports using Postman. Here I am again, writing about Postman and its amazing tips to help deliver working software more efficiently. Welcome to this step-by-step guide to demonstrate integration of Postman automated tests in a Microsoft Azure Pipeline using the Postman API to #MakeItSimple

Continuous Integration flow

The biggest advantage of using the Postman API is the automatic synchronization of the Collections edited in the Postman GUI with the Postman Cloud (which is completely free). This avoids using Source Code Management tools (Git, SVN, etc.) to host your collections. Nevertheless, this is not the only option. You can also use the public shareable link of your Postman collection, but this may present a security issue in your organization.

Beside that, exporting a collection in JSON, pushing it to a repo and then retrieving it in your CI pipeline is a fastidious way of automating tests. Especially for a lazy QA engineer like me. Furthermore, at Younited Credit we believe that #FasterIsBetter

Retrieve your collection using the Postman API

In order to be more efficient and benefit from the automatic synchronisation of the Postman collections, we are going to use the Postman API. First of all, go to the Postman API and click the “Run in Postman” button:

Follow the instructions to import the Postman API collection in your Postman desktop client, then click on your profile to generate a Postman API key.

Setting menu in Postman desktop GUI

Then in the Postman Cloud GUI, click on the “Account Settings” button:

And generate an API key:

Steps to generate Postman API key

Go back to Postman and add the generated key value in the header of the All collections request (1), then find the collection you want to integrate in your pipeline and copy its uid property (2).

🔴 Note that with the same Api-Key you can get any of your environments (Staging, Pre-production…). For that, use the All environments request.

Steps to retrieve UID of the collection

This helps you get your collection/environment using a cURL command that looks like this:

curl --location --request GET "{{yourUID}}" >myCollection.json --header "X-Api-Key: {{postman_api_key}}"

This command downloads your collection to your local machine and puts it in a file named myCollection.json.

🔴 cURL is a command line interface to transfer data. It is natively supported in all Mac OS X and Linux systems, and lately Microsoft added it to Windows 10. You will need to install it manually if you are using Windows 7 or earlier versions.

Run your collection in the Azure Pipeline

In what follows, I assume that you already have access to Azure Devops and have the appropriate access rights to create and run a Pipeline in your organization. If not, it might be the time to create a DevOps ticket for that :)

Running a Postman collection is pretty simple, you will need newman. My previous post may help you find the references to perform this locally. But in Azure Devops, the steps are as follows:

Example of npm task configuration
Example of npm task configuration
Configuration example to install newman in npm task

Create an npm task as in the previous step, except with a different npm package name. Instead of “newman”, install “newman-reporter-junitfull”.

This package helps your newman generate correct JUnit reports when you have multiple iterations in your tests, which is generally the case. From what I understood, the default JUnit reporter is not yet mature enough to handle this issue.

The JUnit reports are useful to publish results in Azure DevOps. We’ll see that later, be patient. 🤗

Add a command line task. In the script section, add the cURL command you built in the first section of this post.

Command line task example to download and run the Postman collection

Add a Publish Test Results task and configure it as follows:

Configuration example of the Publish test results task

Now that you’ve configured all the steps, save your configuration and create a release in your pipeline. Once finished, click the “Tests” tab to visualize the test results in Azure DevOps style.

Test summary in Azure DevOps

Note that Azure DevOps has a limitation to link an automated test to a written test in the Test Plans just like TestLink, HP ALM and other test management tools. I’ve opened a feature suggestion here 🆙. Feel free to upvote it! If Microsoft ever solves this issue, I will blog about it.

Regardless of the CI tool you are using (Azure pipeline, Jenkins, Travis CI, CircleCI, Hudson or any other one), the steps above remain the same. The only thing that changes is the configuration of the tool before creating and running the job.

Thanks to Thomas Goldstein for helping me finetune this blog post.


Le blog Tech de Younited, où l’on parle de développement, d’architecture, de microservices, de cloud, de data… Et de comment on s’organise pour faire tout ça. Ah, et on recrute aussi, on vous a dit ?


Written by


QA Engineer @ Younited Credit


Le blog Tech de Younited, où l’on parle de développement, d’architecture, de microservices, de cloud, de data… Et de comment on s’organise pour faire tout ça. Ah, et on recrute aussi, on vous a dit ?

More From Medium

More from YounitedTech

More on Postman from YounitedTech

More on Postman from YounitedTech

Generate automated test reports using Postman

Jan 31 · 4 min read


Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade