我使用 Travis CI 设置了远程构建。这是我的配置文件:
language: csharp
solution: DungeonGen.sln
install:
- nuget restore DungeonGen.sln
- nuget install NUnit.Runners -OutputDirectory testrunner
script:
- xbuild DungeonGen.sln /p:TargetFrameworkVersion="v4.5.1" /p:Configuration=Stress
- mono ./testrunner/NUnit.Console.*/tools/nunit3-console.exe ./Tests/Unit/Common/bin/Stress/DungeonGen.Tests.Unit.Common.dll
- mono ./testrunner/NUnit.Console.*/tools/nunit3-console.exe ./Tests/Unit/Generators/bin/Stress/DungeonGen.Tests.Unit.Generators.dll
- mono ./testrunner/NUnit.Console.*/tools/nunit3-console.exe ./Tests/Unit/Selectors/bin/Stress/DungeonGen.Tests.Unit.Selectors.dll
- mono ./testrunner/NUnit.Console.*/tools/nunit3-console.exe ./Tests/Unit/Mappers/bin/Stress/DungeonGen.Tests.Unit.Mappers.dll
- mono ./testrunner/NUnit.Console.*/tools/nunit3-console.exe ./Tests/Unit/Tables/bin/Stress/DungeonGen.Tests.Unit.Tables.dll
- mono ./testrunner/NUnit.Console.*/tools/nunit3-console.exe ./Tests/Integration/Bootstrap/bin/Stress/DungeonGen.Tests.Integration.Bootstrap.dll
- mono ./testrunner/NUnit.Console.*/tools/nunit3-console.exe ./Tests/Integration/Tables/bin/Stress/DungeonGen.Tests.Integration.Tables.dll
- mono ./testrunner/NUnit.Console.*/tools/nunit3-console.exe ./Tests/Integration/Stress/bin/Stress/DungeonGen.Tests.Integration.Stress.dll
但是,当它运行时,我得到以下异常:
$ mono ./testrunner/NUnit.Console.*/tools/nunit3-console.exe ./Tests/Unit/Common/bin/Stress/DungeonGen.Tests.Unit.Common.dll
Cannot open assembly './testrunner/NUnit.Console.*/tools/nunit3-console.exe': No such file or directory.
The command "mono ./testrunner/NUnit.Console.*/tools/nunit3-console.exe ./Tests/Unit/Common/bin/Stress/DungeonGen.Tests.Unit.Common.dll" exited with 2.
对于我尝试加载以进行测试的每个 DLL,都会重复此异常。根据Travis CI 的文档,我应该能够在路径中使用通配符并且它工作正常。但是,要么是这导致了问题,要么是其他一些问题阻止了 Travis 看到它刚刚安装的 exe。有谁知道解决这个问题?我真的不想硬编码 NUnit 的一个版本——我想尽可能使用最新的版本。
更新硬编码版本没有帮助 - 设置为 3.2.0,我仍然得到同样的错误:
install:
- nuget restore DungeonGen.sln
- nuget install NUnit.Runners -Version 3.2.0 -OutputDirectory testrunner
产生这个:
$ mono ./testrunner/NUnit.Console.3.2.0/tools/nunit3-console.exe ./Tests/Unit/Common/bin/Stress/DungeonGen.Tests.Unit.Common.dll
Cannot open assembly './testrunner/NUnit.Console.3.2.0/tools/nunit3-console.exe': No such file or directory.
The command "mono ./testrunner/NUnit.Console.3.2.0/tools/nunit3-console.exe ./Tests/Unit/Common/bin/Stress/DungeonGen.Tests.Unit.Common.dll" exited with 2.