我正在Team Services中设置持续集成 . 该解决方案目前有几个单元测试项目 . 解决方案中的所有项目都是.NET核心项目 .
构建定义中的开箱即用测试运行器不是用于编写执行 dotnet test
的批处理文件的't pick up any of the unit tests projects (yes, the test assembly wildcards are setup correctly), so I' . 命令运行后,会将一个XML文件写入包含结果的磁盘 . 我'm using the publish results step and pointing to that file so that the test results will show up in the build output. I'已将"Test Result Format"字段设置为NUnit,但该步骤会产生以下警告:
Invalid results file. Please make sure the Test Result Format field in the task matches the result format of the file: C:\<path to file>\TestResult.xml
有没有其他人能够发布在Team Services中运行 dotnet test
命令生成的NUnit测试结果?
3 回答
这是因为VSTS不支持NUnit3格式 . 您可以考虑在此问题中使用jirisykora83和CharliePoole提到的变通方法:Support NUnit2 format .
似乎你必须运行自己的批处理脚本来运行测试 . 即使您已在批处理脚本中设置
dotnet test
应生成NUnit文件,但在发布任务中它可能不是NUnit选项 . 您可以在测试结果格式中尝试使用JUnit Format或XUnit Format .通过使用dotnet测试任务结合发布测试结果,我能够发布我的测试结果 . 构建配置如下所示:
在dotnet测试任务中,添加其他参数
--logger:trx
在测试任务之后添加“发布测试结果”任务,并使用以下命令对其进行配置:
和