7

I remember doing this in an older version of Team City in which the NUnit Runner failed, so I tried running NUnit using the Command Line Runner instead.

I think there was an option in the Command Line Runner settings which let you specify the kind of output file: NUnit result.xml was one of them. Doing this, you could see the test result breakdown in the Web GUI, just like when the NUnit Runner worked.

But I don't see this in the latest Team City (6.5.5). Can it still be done?

PS: Before anyone asks, I can't use Team City's NUnit Runner because NUnit has a bug which will be fixed in the soon to come 2.6.0 version. Said bug does not occurr when running nunit-console

dario_ramos
  • 7,118
  • 9
  • 61
  • 108

2 Answers2

10

This could be done using importdata TeamCity message, this is really helpful when you are running NUnit tests manually executing nunit-console.exe from an MSBuild script, for instance using NUnit MSBuild Community Task, but keep in mind that TeamCity provides built in NUnit tests runner so you do not need this low level TeamCity scripting. Anyway you can import report in this way:

<Message 
         Text="##teamcity[importData type='nunit' path='...\TestResults.xml']" 
         Importance="High"/>

See Importing XML Reports

If you prefer to run code coverage, code inspection, test tools or duplicate finders directly from build script, not as a build runner, you can use the importData service messages to import generated xml reports into TeamCity.

Pondidum
  • 11,457
  • 8
  • 50
  • 69
sll
  • 61,540
  • 22
  • 104
  • 156
  • Like I said in the last paragraph of my question (not an edit!), the NUnit runner hangs because of a bug in NUnit. Using the Command Line is just a temporary workaround until NUnit 2.6.0 is released. On the other hand, I didn't know about Team City messages. Gonna try this – dario_ramos Nov 09 '11 at 12:31
7

The functionality was still there, found it by accident when looking at another build configuration. Importing an XML is now a "Build Feature", see:

dario_ramos
  • 7,118
  • 9
  • 61
  • 108
  • Hi - So where is the nunit report suppose to show after you configure this? I did the exact same thing but still can't see a nice (red/green) nunit report. – dalcantara Mar 26 '12 at 01:27
  • 2
    @Buzzer: In the Projects page, look for your project, it's in the same dynamic drop down menu where you access the build log. There, you'll find a link to the test report, and also a quick view of the test results. – dario_ramos Mar 26 '12 at 12:48