.NET项目Nunit测试在单声道构建期间失败

时间:2017-10-06 01:32:27

标签: c# mono nunit travis-ci nunit-3.0

我对CI很陌生(至少从一个全新的设置点)。我在Rider中创建了一个项目,使用默认版本的NUnit,如果您选择“创建新的NUnit项目”,我现在正尝试使用travis-CI为其设置自动构建。

我的项目和测试项目的目标.NET框架版本(在Rider的Project属性中确认)是4.5。

我正在使用的Nunit版本是Rider 3.5提供的默认版本。

这是我的.travis.yml构建文件:

language: csharp
solution: .sln
install:
  - nuget restore FindWordsWithConcatenations.sln
  - nuget install NUnit.Runners -Version 3.5.0 -OutputDirectory testrunner
script:
  - xbuild  /p:Configuration=Debug ./FindWordsWithConcatenations.sln
  - mono ./testrunner/NUnit.ConsoleRunner.3.5.0/tools/nunit-agent.exe ./TestFindWordsWithConcatenations/bin/Debug/TestFindWordsWithConcatenations.dll

我在自己的机器上通过运行nuget命令确认测试运行器路径应该是正确的,当我运行nunit-agent(通过代理,代理-x86或代理控制台)时,我收到以下错误(本地,并在服务器上):

Unhandled Exception: System.FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
   at System.Guid..ctor(String g)
   at NUnit.Agent.NUnitTestAgent.Main(String[] args)

我还尝试在未指定配置模式的情况下运行,并且配置了Debug和Release配置模式。

不幸的是,谷歌搜索/堆栈溢出的正常策略并没有帮助,我在几个问题中看到了这个错误,但原因似乎与我所经历的情况无关。

The last build of the pipeline is available to view here,到目前为止所有构建都失败了,可以看到之前的版本here

在此先感谢,如果有人对此问题的原因有所了解,或者我如何以不同的方式解决测试问题,我将非常感激。

1 个答案:

答案 0 :(得分:0)

解决了它。

将travis配置的脚本部分更新为:

script:
  - xbuild  /p:Configuration=Debug ./FindWordsWithConcatenations.sln
  - mono ./testrunner/NUnit.ConsoleRunner.3.5.0/tools/nunit3-console.exe ./TestFindWordsWithConcatenations/bin/Debug/TestFindWordsWithConcatenations.dll

现在它正在运行正确的控制台应用程序。还必须稍微修改测试路径才能在服务器上运行。