2

I have configured a build step for NUnit test for a .Net project (framework 4.0) in Teamcity.When run the build it shows the error like below.

"NUnit runner failure". The detail log shows like below.

 Build step details
 Runner Type : NUnit
 NUnit Runner : NUnit 2.6.2
 .Net runtime : MSIL
 Version      : V2.0 

Result :
[20:01:55]Step 6/7: NUnit
[20:01:55][Step 6/7] 
Starting: 
C:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe             
#TeamCityImplicit
[20:01:55][Step 6/7] in directory: C:\BuildAgent\work\376652cbd18bb804
[20:01:56][Step 6/7] Process exited with code -2146232576
[20:01:56][Step 6/7] Step NUnit failed
karthik
  • 105
  • 2
  • 15
  • According to threads like this one, http://devnet.jetbrains.com/thread/452728, it is very likely to be a compatible issue with Antivirus product. – Lex Li Feb 18 '14 at 07:09

1 Answers1

0

When I had problems like this one (I think they are caused by a bug in NUnit; those might be fixed in the latest version), I worked around them by switching to a command line build step (instead of an Nunit runner step like you are using) which invoked Nunit from the command line.

Then, to see the test results as nicely as with NUnit Runner, have the command line call send the results to an XML file and import that file from Team City. For details on how to do that, check my answer to this question.

Community
  • 1
  • 1
dario_ramos
  • 7,118
  • 9
  • 61
  • 108
  • Thanks Dario. I saw the link (XML). But cannot see the syntax for how the command line should be ? – karthik Nov 28 '13 at 18:11
  • The NUnit guys explain it nicely [here](http://www.nunit.org/index.php?p=consoleCommandLine&r=2.6.2) – dario_ramos Nov 28 '13 at 18:35
  • Long story short, try `nunit-console /result:result.xml your_test_dll.dll` – dario_ramos Nov 28 '13 at 18:50
  • Thanks. I have tried with nunit-console as like below."C:\Program Files (x86)\NUnit 2.6.2\bin\nunit-console" /result:result.xml %system.teamcity.build.checkoutDir%/TWHTMLUnitTest/bin/Debug/TWHTMLUnitTest.dll. But shown error like this. [23:31:55]Step 2/2: Command Line [23:31:55][Step 2/2] Starting: C:\BuildAgent\temp\agentTmp\custom_script4732114763161290612.cmd [23:31:55][Step 2/2] in directory: C:\BuildAgent\work\82414200e3779165 [23:31:55][Step 2/2] Process exited with code -2146232576 [23:31:55][Step 2/2] Step Command Line failed – karthik Nov 29 '13 at 18:03
  • What happens if you run the command line yourself? (i.e. open a terminal and run nunit-console just like Team City does). This is to rule out any interaction with Team City. – dario_ramos Nov 29 '13 at 18:17
  • Sorry. The issue was also in commandline. Because the .NetFramework was not installed. After installed the framework when running from commandline it shows the error. 'Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.UnitTestFramework' Version=10.0.0.0. Should I install visual studio to get the DLL or framework is enough ? – karthik Nov 30 '13 at 12:54
  • Thanks. I have installed the Visual studio agent 2010 which has the test agent and the command got worked in command line. But it show the Tests count as 0. [Tests run :0]. But in XML file I got the result of the test. My command line is C:\Program Files (x86)\NUnit 2.6.2\bin\nunit-console DllPath/TWHTMLUnitTest.dll /run:TWHTMLUnitTest.UserTest.GetUserTest – karthik Dec 02 '13 at 12:36
  • It looks like you are trying to run tests written in MSTest (Microsoft's Unit Testing Framework) in NUnit. That won't work. Try Team City's MSTest runner, and if that fails try calling it from the command line. – dario_ramos Dec 02 '13 at 12:39
  • Thank you very much. I have got a incompatible notice when I tried with Teamcity. But got the xml result when I tried with commandline. So I am going to access the test result from the XML file in another build step in Teamcity. – karthik Dec 02 '13 at 14:54