Travis CI 不能 运行 NUnit 3 Console Runner
Travis CI can't run the NUnit 3 Console Runner
我使用 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 都会重复此异常。根据 the documentation for Travis CI,我应该可以在路径中使用通配符并且工作正常。但是,这可能会导致问题,或者其他一些问题会阻止 Travis 看到它刚刚安装的 exe。有谁知道这个的解决方案?我真的不想硬编码一个版本的 NUnit - 我想尽可能使用最新版本。
UPDATE 硬编码版本没有帮助 - 设置为 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.
原来包安装目录是错误的:而不是 ./testrunner/NUnit.Console.3.2.0/tools/nunit3-console.exe
,它应该是 ./testrunner/NUnit.ConsoleRunner.3.2.0/tools/nunit3-console.exe
。不确定何时更改,但现在可以使用了。
我使用 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 都会重复此异常。根据 the documentation for Travis CI,我应该可以在路径中使用通配符并且工作正常。但是,这可能会导致问题,或者其他一些问题会阻止 Travis 看到它刚刚安装的 exe。有谁知道这个的解决方案?我真的不想硬编码一个版本的 NUnit - 我想尽可能使用最新版本。
UPDATE 硬编码版本没有帮助 - 设置为 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.
原来包安装目录是错误的:而不是 ./testrunner/NUnit.Console.3.2.0/tools/nunit3-console.exe
,它应该是 ./testrunner/NUnit.ConsoleRunner.3.2.0/tools/nunit3-console.exe
。不确定何时更改,但现在可以使用了。