我为Xamarin项目编写了一些小的nunit测试。它们在我的Mac Mini(jenkins构建平台)的终端上运行得很好。当我在詹金斯上运行相同的命令时,我得到一个我无法解释的奇怪错误。我尝试提供完整的文件路径并以root身份运行命令,但我仍然抛出此错误。如果有任何人有这方面的经验,将不胜感激。
构建过程的命令:
nuget restore CoreTests.sln
msbuild CoreTests.sln /t:Build
mono nunit3-console.exe CoreTests.dll
错误输出:
NUnit Console Runner 3.7.0版权所有(c)2017 Charlie Poole,Rob Prouse
运行时环境操作系统版本:MacOSX 16.6.0.0 CLR版本: 4.0.30319.42000
测试文件 CoreTests / CoreTests / bin中/调试/ CoreTests.dll
错误,失败和警告
1)错误: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 ='',原生错误=在System.Diagnostics.Process.StartWithCreateProcess中找不到指定的文件 (System.Diagnostics.ProcessStartInfo startInfo)[0x002dc] in < 70507a44a84041d599bbfa8f3d0ea5b1>:0 at System.Diagnostics.Process.Start()[0x0003a] in < 70507a44a84041d599bbfa8f3d0ea5b1>:0 at(包装器) remoting-invoke-with-check)System.Diagnostics.Process:Start()at NUnit.Engine.Services.TestAgency.LaunchAgentProcess (NUnit.Engine.TestPackage包)[0x002f2] in < 1e8ad6af4c6f4686ad7e5f9e67020b3b>:0 at NUnit.Engine.Services.TestAgency.CreateRemoteAgent (NUnit.Engine.TestPackage包,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(包装器) remoting-invoke-with-check)NUnit.Engine.Services.TestAgency:GetAgent (NUnit.Engine.TestPackage,int)at NUnit.Engine.Runners.ProcessRunner.CreateAgentAndRunner()[0x0003d] 在< 1e8ad6af4c6f4686ad7e5f9e67020b3b>:0 at NUnit.Engine.Runners.ProcessRunner.RunTests (NUnit.Engine.ITestEventListener侦听器,NUnit.Engine.TestFilter 过滤器)[0x0001f]在< 1e8ad6af4c6f4686ad7e5f9e67020b3b>中:0
测试运行摘要总体结果:测试计数失败:0,通过:0, 失败:0,警告:0,不确定:0,跳过:0开始时间: 2017-09-28 18:18:49Z 结束时间:2017-09-28 18:18:49Z 持续时间:0.089秒
结果(nunit3)保存为TestResult.xml构建步骤'执行shell' 将构建标记为失败
答案 0 :(得分:1)
如果您没有错误地到达第三行,我建议它应该是:
nunit3-console.exe <workspace_relative_path_to_project_containing_tests>.dll
免责声明:我是NUnit项目的贡献者和Saucery3 nuget包的作者。但我不是单声道专家。
答案 1 :(得分:0)
当我尝试通过SSH连接运行NUnit-console(在MacOS上使用Mono)时,遇到了完全相同的问题。就我而言,在运行之前执行source /etc/profile;
命令可以解决问题。
ssh user@host source /etc/profile; {MonoPath}/mono {NUnitPath}/nunit3-console.exe {TestsPath}/Test.dll