4
votes

I am using Cake as a build script and TeamCity for CI. I am having Cake run unit tests with NUnit and then TeamCity is pulling in those results with a 'xml report processor'.

As you can see its importing the file, but the 'Test' tab is missing so I can't see the test output.

Am I missing a step?

4

4 Answers

2
votes

My cake task for testing is just this and the Tests report tab appears

NUnit3(testsDir.ToString() + "/*Tests.dll", new NUnit3Settings
{
    NoResults = true,
    NoHeader = true,
    Framework = "net-4.0",
    Workers = 5,
    Timeout = 10000
});

Do you really need the report xml?

2
votes

It was an issue with the nunit-console. I downgraded to 3.2.1 and it works now.

1
votes

It looks to me like your tests failed to execute properly (as opposed to executing properly with a failing test). Try running the build locally, then check the contents of the TestResult.xml file.

If that looks good, change the project settings on TC to save the xml file as an artifact and compare what you see there with your successful local run.

Finally, ensure that the type of XML report in the TC config is set to NUnit.

Hope this helps, Mark

0
votes

I got a similar problem when Teamcity 9.X not able to load nunit 3 xml because older version of teamcity report parser build feature does not understand that format.

I get it working by converting the nunit result to xunit link to the xslt! and the import the file as junit result.

Task("Run-Unit-Tests")  
.Does(() =>
{
    DotNetCoreTest("./Project");        
}).Finally(() =>
{  
    XmlTransform("./nunit3-xunit.xslt", "./TestResult.xml", "./NUnit.WebApp.FunctionnalTests.TestResult.xml");
    if(TeamCity​.IsRunningOnTeamCity)
    {       
        TeamCity.ImportData("junit","./NUnit.WebApp.FunctionnalTests.TestResult.xml");
    }  
});