Search code examples
travis-cinunit-consolenunit-3.0

Travis CI can't run the NUnit 3 Console Runner


I have remote builds set up using Travis CI. Here is my configuration file:

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

However, when this runs, I get the following exception:

$ 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.

This exception is repeated for every DLL I try to load for tests. According to the documentation for Travis CI, I should be able to use the wild cards there in the path and it work fine. However, either that is causing a problem, or some other issue is preventing Travis from seeing the exe it just installed. Does anyone know of a solution to this? I really do not want to hard-code a version of NUnit - I want to use the most up-to-date version possible.

UPDATE Hard-coding the version did not help - set to 3.2.0, I still get the same error:

install:
  - nuget restore DungeonGen.sln
  - nuget install NUnit.Runners -Version 3.2.0 -OutputDirectory testrunner

Produces this:

$ 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.

Solution

  • Turns out that the package install directory was wrong: instead of ./testrunner/NUnit.Console.3.2.0/tools/nunit3-console.exe, it should have been ./testrunner/NUnit.ConsoleRunner.3.2.0/tools/nunit3-console.exe. Not sure when this changed, but it works now.