使用DotNetCoreCLI时CI构建/PR中测试失败报错信息不明确
问题:DotNetCoreCLI@2测试任务失败时提示信息不明确
我们配置了CI流水线运行测试,但测试失败时,无法返回“2个单元测试失败”这类有意义的错误提示,只会显示:
Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1
Dotnet command failed with non-zero exit code on the following projects : [ '' ]
(注:自动检测解决方案文件时,第二条错误中的项目列表为空;若明确指定解决方案或项目路径,该列表会显示对应内容)
开发人员必须翻阅任务控制台日志才能发现只是单元测试失败,而他们的第一反应会认为是DevOps基础设施或CI流水线配置出现问题。
以下是我们构建和运行测试的流水线步骤:
steps: - task: DotNetCoreCLI@2 displayName: 'Restore NuGet Packages' inputs: command: 'restore' - task: DotNetCoreCLI@2 displayName: 'Build Projects' inputs: command: 'build' arguments: '--configuration $(buildConfiguration) --no-restore' - task: DotNetCoreCLI@2 displayName: 'Run Tests' inputs: command: 'test' arguments: '--configuration $(buildConfiguration) --no-build --no-restore' - task: DotNetCoreCLI@2 displayName: 'Publish Deployable Projects' inputs: command: 'publish' etc...
请问这是当前配置存在缺陷,还是DotNetCoreCLI@2的“test”命令本身在这方面不够完善?
我曾使用直接调用vstest/mstest命令的流水线,能得到更清晰的输出,但出于多种原因(比如无需重新构建即可串联多个步骤),希望全程使用DotNetCoreCLI@2。
内容的提问来源于stack exchange,提问作者Alain
相关产品推荐
相关产品推荐

