我在windows运行程序上使用dotnet test有一个简单的问题。当运行多个测试时,只考虑最后一个退出代码。
- name: Run unit tests
run: |
dotnet test ./tests/ProjectA/ProjectA.csproj -c release --blame-hang-timeout 15s --blame-hang-dump-type full --blame-crash-dump-type full
dotnet test ./tests/ProjectB/ProjectB.csproj -c release --blame-hang-timeout 15s --blame-hang-dump-type full --blame-crash-dump-type full
dotnet test ./tests/ProjectC/ProjectC.csproj -c release --blame-hang-timeout 15s --blame-hang-dump-type full --blame-crash-dump-type full让我们假设ProjectA或ProjectB确实有测试,但失败了。因此,退出代码为非零。在ubuntu-latest上,一切正常,运行被报告为失败,但在windows-latest上,运行被报告为成功。
所起的作用是通过&&链接这些命令,以便只有在当前命令成功的情况下才运行下一个命令。这种方法的问题是,第一个失败的测试套件会停止整个运行。在windows和非windows运行程序之间进行切换是没有问题的。
发布于 2022-09-11 11:58:47
考虑到最后一个退出代码的原因是,对dotnet测试的3个调用将按顺序运行。"run“的输出将只包含一个退出代码,因此,第二个命令覆盖第一个命令结果,第三个覆盖第二个命令。
在我看来,你有三个选择:
suggested.
。。
- name: Run unit tests projectA
run: |
dotnet test ./tests/ProjectA/ProjectA.csproj -c release --blame-hang-timeout 15s --blame-hang-dump-type full --blame-crash-dump-type full
- name: Run unit tests projectB
run: |
dotnet test ./tests/ProjectB/ProjectB.csproj -c release --blame-hang-timeout 15s --blame-hang-dump-type full --blame-crash-dump-type full
- name: Run unit tests projectC
run: |
dotnet test ./tests/ProjectC/ProjectC.csproj -c release --blame-hang-timeout 15s --blame-hang-dump-type full --blame-crash-dump-type fullhttps://stackoverflow.com/questions/72858310
复制相似问题