0
votes

I'm trying to integrate my Postman collection with Azure pipeline using Newman for CI and generate the test results, I'm able to run the tests in Azure Pipeline but not able to publish the results.

Following are the steps I followed-

1.Import postman collection.Json and environment.Json from the Postman into my repository.

2.Created new pipeline

3.Added Agent

4.Added a task to install Newman

5.Added the second task to run my tests

Script-

newman run Staging_Tests.postman_collection.json -e staging.postman_environment.json --reporters cli,junit,htmlextra --reporter-junit-export Results\junitReport.xml --reporter-htmlextra-export Results\junitReport.html

following are the values I provided for the API tests- enter image description here

Expected -As per the script, it should create a directory called Results in the folder provided in the working directory and should create junitReport.xml Results File inside the Results Folder.

Actual- It is executing my tests but the folder is not getting created in the working directory path and I'm not able to proceed ahead to publish the test results.

Am I missing something here? any help would be much appreciated.

1

1 Answers

1
votes

Your pipeline runs without any errors which indicates that the command is right. The result folder is already created.

And the actual reason is that the result is under the agent pool's location, not on the azure devops repos. It will never stores under the cloud repos and is under the agent pc's location, unless you push the result back to repos again.

So my function is that you should add Publish build artifacts task to get the result from agent pool into services.

Also, please change the path to publish to $(Build.SourcesDirectory).

enter image description here

Then, click the below option under pipeline to get the result:

enter image description here