6
votes

I have some small nunit tests written up for a Xamarin project. They run great on the terminal of my Mac Mini (jenkins build platform). When I run the same command on jenkins I'm getting a strange error that I cannot explain. I've tried provided full file paths and ran the command as root and I am still having this error thrown. If anyone has any experience with this it would be greatly appreciated.

Command for Build Process:

nuget restore CoreTests.sln
msbuild CoreTests.sln /t:Build
mono nunit3-console.exe CoreTests.dll

Error Output:

NUnit Console Runner 3.7.0 Copyright (c) 2017 Charlie Poole, Rob Prouse

Runtime Environment OS Version: MacOSX 16.6.0.0 CLR Version: 4.0.30319.42000

Test Files CoreTests/CoreTests/bin/Debug/CoreTests.dll

Errors, Failures and Warnings

1) Error : ApplicationName='mono', CommandLine='--runtime=v4.0.30319 "/Users/falconbot/Documents/NUnit/nunit-agent.exe" 8e81b5fe-8dba-4da0-8612-5c0cabe9d40f tcp://127.0.0.1:55001/TestAgency --pid=97532', CurrentDirectory='', Native error= Cannot find the specified file at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x002dc] in <70507a44a84041d599bbfa8f3d0ea5b1>:0 at System.Diagnostics.Process.Start () [0x0003a] in <70507a44a84041d599bbfa8f3d0ea5b1>:0 at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:Start () at NUnit.Engine.Services.TestAgency.LaunchAgentProcess (NUnit.Engine.TestPackage package) [0x002f2] in <1e8ad6af4c6f4686ad7e5f9e67020b3b>:0 at NUnit.Engine.Services.TestAgency.CreateRemoteAgent (NUnit.Engine.TestPackage package, System.Int32 waitTime) [0x00000] in <1e8ad6af4c6f4686ad7e5f9e67020b3b>:0 at NUnit.Engine.Services.TestAgency.GetAgent (NUnit.Engine.TestPackage package, System.Int32 waitTime) [0x00000] in <1e8ad6af4c6f4686ad7e5f9e67020b3b>:0 at (wrapper remoting-invoke-with-check) NUnit.Engine.Services.TestAgency:GetAgent (NUnit.Engine.TestPackage,int) at NUnit.Engine.Runners.ProcessRunner.CreateAgentAndRunner () [0x0003d] in <1e8ad6af4c6f4686ad7e5f9e67020b3b>:0 at NUnit.Engine.Runners.ProcessRunner.RunTests (NUnit.Engine.ITestEventListener listener, NUnit.Engine.TestFilter filter) [0x0001f] in <1e8ad6af4c6f4686ad7e5f9e67020b3b>:0

Test Run Summary Overall result: Failed Test Count: 0, Passed: 0, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0 Start time: 2017-09-28 18:18:49Z End time: 2017-09-28 18:18:49Z Duration: 0.089 seconds

Results (nunit3) saved as TestResult.xml Build step 'Execute shell' marked build as failure

2
Are you copying nunit3-console.exe somewhere manually? It looks like the console can't locate nunit-agent.exe, which should be sat in the same directory.Chris
I shortened the command for the sake of the post. It's store in a directory called NUnit that also contains nunit-agent.exe and the full file path to nunit3-console.exe is used when I call it in jenkins.user3459799
maybe posting the full debug output from Jenkins could help, and a look at your configuration in more detailldgorman

2 Answers

1
votes

Provided you are getting to the third line without error I would suggest it should be:

nunit3-console.exe <workspace_relative_path_to_project_containing_tests>.dll

Disclaimer: I am contributor to the NUnit project and author of the Saucery3 nuget package. But I am not a mono expert.

0
votes

I encountered exactly the same problem when I tried run NUnit-console (using Mono on MacOS) over an SSH connection. In my case executing source /etc/profile; command before running it resolved the problem.

ssh user@host source /etc/profile; {MonoPath}/mono {NUnitPath}/nunit3-console.exe {TestsPath}/Test.dll