【问题标题】:.NET project Nunit tests are failing during mono build.NET 项目 Nunit 测试在单声道构建期间失败
【发布时间】:2018-03-17 17:53:50
【问题描述】:

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

我的项目和测试项目的目标 .NET 框架版本(在 Rider 的项目属性中确认)是 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(通过代理、agent-x86 或 agent-console)时,我收到以下错误(本地,并在服务器上):

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

在此先感谢,如果有人知道这个问题的原因,或者我可以如何以不同的方式解决测试运行,我将非常感激。

【问题讨论】:

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


    【解决方案1】:

    解决了。

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

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

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

    【讨论】:

      猜你喜欢
      • 2021-07-26
      • 2021-07-17
      • 2021-08-05
      • 2011-02-27
      • 2018-10-03
      • 1970-01-01
      • 2021-01-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多