简体   繁体   English

Teamcity Nunit 3.0控制台运行器无法正常工作

[英]Teamcity Nunit 3.0 Console Runner not working

I am trying to use NUnit 3.0 Console runner with Teamcity. 我正在尝试使用TeamUnity的NUnit 3.0控制台运行程序。 Here is my confiuration. 这是我的配角。

在此输入图像描述

When I run the configuration, I get the following error 当我运行配置时,我收到以下错误

>  Run Unit Tests (NUnit) (1s)
[10:44:03][Step 3/3] ##teamcity[buildStatisticValue key='buildStageDuration:buildStepRUNNER_3' value='0.0']
[10:44:03][Step 3/3] Starting: C:\TeamCity\buildAgent\work\e6cc09e5f0da4a07\Libs\NUnit.Console.3.0.1\tools\nunit3-console.exe C:\TeamCity\buildAgent\temp\buildTmp\O1YAIPlezg1Cm2NfZTD88h0Nb2Q14zOF.nunit --work=C:\TeamCity\buildAgent\work\e6cc09e5f0da4a07 --noresult --noheader
[10:44:03][Step 3/3] in directory: C:\TeamCity\buildAgent\work\e6cc09e5f0da4a07
[10:44:03][Step 3/3] Runtime Environment
[10:44:03][Step 3/3]    OS Version: Microsoft Windows NT 10.0.10586.0
[10:44:03][Step 3/3]   CLR Version: 4.0.30319.42000
[10:44:03][Step 3/3] 
[10:44:03][Step 3/3] Test Files
[10:44:03][Step 3/3]     C:\TeamCity\buildAgent\temp\buildTmp\O1YAIPlezg1Cm2NfZTD88h0Nb2Q14zOF.nunit
[10:44:03][Step 3/3] 
[10:44:04][Step 3/3] 
[10:44:04][Step 3/3] Errors and Failures
[10:44:04][Step 3/3] 
[10:44:04][Step 3/3] 1) Invalid : C:\TeamCity\buildAgent\temp\buildTmp\O1YAIPlezg1Cm2NfZTD88h0Nb2Q14zOF.nunit
[10:44:04][Step 3/3] Format of the executable (.exe) or library (.dll) is invalid.
[10:44:04][Step 3/3] 
[10:44:04][Step 3/3] Test Run Summary
[10:44:04][Step 3/3]     Overall result: Failed
[10:44:04][Step 3/3]    Tests run: 0, Passed: 0, Errors: 0, Failures: 0, Inconclusive: 0
[10:44:04][Step 3/3]      Not run: 0, Invalid: 0, Ignored: 0, Explicit: 0, Skipped: 0
[10:44:04][Step 3/3]   Start time: 2016-02-08 02:44:04Z
[10:44:04][Step 3/3]     End time: 2016-02-08 02:44:04Z
[10:44:04][Step 3/3]     Duration: 0.006 seconds
[10:44:04][Step 3/3] 
[10:44:04][Step 3/3] Process exited with code -2
[10:44:04][Step 3/3] ##teamcity[buildStatisticValue key='buildStageDuration:buildStepRUNNER_3' value='1095.0']
[10:44:04][Step 3/3] Step Run Unit Tests (NUnit) failed

From the error, I am guessing that it cannot find the Dll to run tests but I have checked the path and file in checkout directory, everything seems correct. 从错误,我猜它找不到运行测试的Dll,但我检查了checkout目录中的路径和文件,一切似乎都正确。 Kindly tell me what am I doing wrong? 请告诉我,我做错了什么?

Run manually the tests using the commands that team city is using: 使用团队城市正在使用的命令手动运行测试:

In the directory C:\\TeamCity\\buildAgent\\work\\e6cc09e5f0da4a07 run : C:\\TeamCity\\buildAgent\\work\\e6cc09e5f0da4a07\\Libs\\NUnit.Console.3.0.1\\tools\\nunit3-console.exe C:\\TeamCity\\buildAgent\\temp\\buildTmp\\O1YAIPlezg1Cm2NfZTD88h0Nb2Q14zOF.nunit --work=C:\\TeamCity\\buildAgent\\work\\e6cc09e5f0da4a07 --noresult --noheader 在目录C:\\ TeamCity \\ buildAgent \\ work \\ e6cc09e5f0da4a07中运行:C:\\ TeamCity \\ buildAgent \\ work \\ e6cc09e5f0da4a07 \\ Libs \\ NUnit.Console.3.0.1 \\ tools \\ nunit3-console.exe C:\\ TeamCity \\ buildAgent \\ temp \\ buildTmp \\ O1YAIPlezg1Cm2NfZTD88h0Nb2Q14zOF.nunit --work = C:\\ TeamCity \\ buildAgent \\ work \\ e6cc09e5f0da4a07 --noresult --noheader

See https://github.com/nunit/docs/wiki/Console-Command-Line for more parameters 有关更多参数,请参阅https://github.com/nunit/docs/wiki/Console-Command-Line

You could get more information out of it if you increase the tracing information. 如果增加跟踪信息,可以从中获取更多信息。

Also, there if you're running code coverage using the JetBrains dotCover, it will fail even if tests succeed. 此外,如果您使用JetBrains dotCover运行代码覆盖,即使测试成功,它也会失败。 Try disabling code coverage if that's the case. 如果是这种情况,请尝试禁用代码覆盖率。

To make it work I used NuGet to add NUnit.ConsoleRunner v 3.5.0 to my project. 为了使它工作,我使用NuGet将NUnit.ConsoleRunner v 3.5.0添加到我的项目中。 Then I got an error: "File type is not supported", to fix that I added NUnit.Extension.NUnitProjectLoader v 3.5.0. 然后我收到一个错误:“不支持文件类型”,修复我添加了NUnit.Extension.NUnitProjectLoader v 3.5.0。 (I tried to use NUnit.Extension.VSProjectLoader but that did not solve my issue) (我试图使用NUnit.Extension.VSProjectLoader,但这没有解决我的问题)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM