gpt4 book ai didi

continuous-integration - TeamCity + 蛋糕 : Displaying VSTest output in project summary

转载 作者:行者123 更新时间:2023-12-04 08:40:45 28 4
gpt4 key购买 nike

我知道已经有一个类似的问题here ,但我认为我的问题完全不同,值得创建一个新帖子。

我使用 CAKE 0.21.1.0。

作为 TeamCity 上的一个构建步骤,我正在执行 build.ps1,它又会调用 build.cake。在 build.cake 脚本中,我添加了一个名为 RunTests 的任务,它使用 VS Test Runner 来执行我的单元测试。

目前,每当有失败的测试时,我所看到的只是 TeamCity 主页上的 Exit code 1:

enter image description here

当我导航查看构建日志本身时,我看到了有关失败测试的更多详细信息:

enter image description here

在上面的屏幕截图中,我突出显示了我希望作为项目摘要的一部分显示在 TeamCity 主页上的文本输出,而不是 Exit code 1

如何捕获 VS Test Runner 输出,以便我可以将其包含在我的构建脚本的 interaction with TeamCity 中?

更新:

感谢@mholo65 his reply !我尝试了他概述的第一种方法,但不幸的是它对我不起作用。

我修改了我的 build.cake 脚本以包含这些行:

VSTest("./**/bin/Release/CakeTest.dll", new VSTestSettings() { Logger = "trx"} );
TeamCity.ImportData("vstest", "./TestResults/*.trx");

在我的 TeamCity 构建代理上运行测试时,这是我的工作/结帐目录:

enter image description here

这是我的结果文件的完整路径:

enter image description here

然而,这仍然是我在 TeamCity 主页上看到的,而不是 VSTest 输出 Total tests: 5. Passed: 3. Failed: 2. Skipped: 0.:

enter image description here

最佳答案

你有两个选择。

  1. vstest.console.exe 将测试结果输出为 trx 格式,并将其导入 TeamCity。 IE。设置 VSTestSettings.Logger"trx" 然后使用 TeamCity.ImportData("vstest", "TestResults\the_name_of_the_result_file.trx") 导入. trx 文件的路径必须 是相对于结帐目录的,参见 this了解更多信息。这里需要注意的是,不可能(与 MSTest.exe 不同)告诉 vstest.console.exe 在哪里放置 trx 文件(有关详细信息,请参阅 this
  2. here 下载自定义 VSTestLogger 并将其安装到您的构建代理上并设置 VSTestSettings.Logger“TeamCity”。此选项将在运行单元测试时为您提供实时报告。

关于continuous-integration - TeamCity + 蛋糕 : Displaying VSTest output in project summary,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45834891/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com