Integration Test with Postman in Azure DevOps Pipeline

Sinem Merve Ozdemir
KoçSistem
Published in
4 min readMar 13, 2022

Hello everyone,

Following my previous articles about Integration Test Series with Postman (POSTMAN İLE API TESTİ, POSTMAN İLE API TESTİ-2, POSTMAN İLE API TESTİ-3). Here I am again, writing about Postman and its amazing tips to help deliver working software more efficiently.

Super Postman to the rescue! 😊

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 ❤️

Continious 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.

At the same time, 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 😋

#FasterIsBetter❤️

Run your collection in the Azure Pipeline:

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, firstly 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:

1- Create an npm task to install newman

Configuration example to install newman in npm task

2. Create an npm task to install newman-reporter-htmlextra

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

This package helps your newman generate correct HTML reports when you have multiple iterations in your tests, which is generally the case.

Configuration example to install html reporter in npm task

3. Download the Postman collection and run it

Create an Newman the cli Companion for Postman task. Your integration tests on Postman collection run in this step. Please don’t forget to assign your json file in the collection file source.

Configuration example to download and run the Postman collection

Please don’t forget to enter details of how you want to report your tests into the Reports field.

Report step in Newman the cli Companion for Postman task

4. Publish test results in Azure DevOps

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

Configuration example of the Publish test results task

5. Upload Postman HTML Report

Create an Upload Postman Html Report task in this step.

This step helps your newman upload correct Html reports when you have multiple iterations in your tests, which is generally the case.

Upload example to upload Postman html reports

6. Save and create a release in your pipeline

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

Regardless of the CI tool you are using (Azure pipeline, Jenkins, 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.

In this post, we learned that how we will integrate automated tests in Azure DevOps using the Postman API. That’s all I’m going to talk about for now. See you in my next post! Until then,
#HappyTesting ❤️

Life of Merve 😊

References:

Postman API | Postman Public Workspace | Postman API Network

Sharing your work | Postman Learning Center

Importing and exporting data | Postman Learning Center

Running collections on the command line with Newman | Postman Learning Center

--

--