Search code examples
unit-testingnunitteamcitycode-coveragedotcover

TeamCity reports incorrect code coverage with dotCover for c# unit tests


I am somewhat new to TeamCity. I have set it up for a Visual Studio solution.

I am using NUnit step to run unit tests and dotCover for code coverage. Problem is, there are particular parts of my code that I know are covered by unit tests but in the code coverage report, it shows them with zero coverage.

I know the DLLs are created just fine because I run a dir /s command and can see all the test DLLs.

  • The NUnit step uses MSIL 4.0 platform and the test path looks like this:

    **/bin/Debug/*Tests.dll

  • There are no filters under code coverage.

Many tests are run. But there are some specific tests that are not present in the search report when I search.

Why is this happening and how do I fix it?


Solution

  • Stupid me. The DLL that was being ignored was spelled *Test.dll instead of *Tests.dll. I use *Tests.dll in my test path.

    The issue got fixed once I changed it to *Test*.dll