在 Postman 与 Azure 管道集成期间无法从 newman 发布测试结果 [英] Not able to publish the test results from newman during Postman integration with Azure pipeline

查看:86
本文介绍了在 Postman 与 Azure 管道集成期间无法从 newman 发布测试结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Newman for CI 将我的 Postman 集合与 Azure 管道集成并生成测试结果,我能够在 Azure Pipeline 中运行测试但无法发布结果.

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.

以下是我遵循的步骤-

1.从 Postman 导入 postman collection.Json 和 environment.Json 到我的仓库中.

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

2.新建管道

3.新增代理

4.新增安装Newman任务

4.Added a task to install Newman

5.添加了第二个任务来运行我的测试

5.Added the second task to run my tests

脚本-

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

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

以下是我为 API 测试提供的值-

following are the values I provided for the API tests-

预期 - 根据脚本,它应该在工作目录中提供的文件夹中创建一个名为 Results 的目录,并且应该创建 junitReport.xmlstrong> 结果文件夹内的结果文件.

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.

推荐答案

您的管道运行时没有任何错误,这表明命令是正确的.结果文件夹已创建.

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

实际原因是结果在代理池的位置下,而不是在 azure devops 存储库上.它永远不会存储在云存储库下,并且在代理电脑的位置下,除非您再次将结果推回存储库.

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.

另外,请将发布路径更改为$(Build.SourcesDirectory).

然后,点击pipeline下面的选项得到结果:

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

这篇关于在 Postman 与 Azure 管道集成期间无法从 newman 发布测试结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆