问题
I have configured a Nunit test runner build step which successfully runs my testsuite, pointing at a test sub-project of my .Net solution eg. Solution/Solution.Test/bin/debug/Solution.Test.dll.
My solution structure is as follows:
- Solution
- Solution.Lib
- Solution.Model
- Solution.Test
Lib and Model dlls are referenced in the test project.
I then turned on dotCover without any assembly filters and it performed code coverage analysis on the above test dll correctly.
I then added a filter, -:Solution.Test, and added +:Solution.Lib, and +:Solution.Model to the assembly filters and ran the build configuration, and the build.log reported the following:
Generate dotCover HTML report
[17:15:41][Generate dotCover HTML report] No source files were found under the build checkout directory W:\TeamCity\Install\buildAgent\work\7136872008cbf3bf. No source files will be included in dotCover report as source code of classes.
No executable code was detected.
The issue could be caused by one of the following:
- Include / exclude patterns are incorrect
- Assemblies are compiled without debugging information
- .pdb files are not available
- Visual Studio code coverage is enabled for MSTest
- .testrunconfig is used for MSTest and Visual Studio code coverage is not disabled (CodeCoverage section with enable="true" is present)
So I'm wondering with the above configuration what am I doing wrong, if the paths are correct?
回答1:
So, I just experienced this myself. While this may not be your issue, I had a bug in my setup that took me way too long to figure out.
Since my application's namespace (and project file name) is Organization.Product
, I used that in my test filter. However, it is the name of the assembly that you're filtering on.
And my assembly's output name is Product name with spaces
. Yikes.
Anyway, I was able to get it to work with a simpler filter:
-:*Test*
Your filter could simply be:
-:*.Test
I would also say that you don't need to do both inclusions and exclusions. If you do an exclusion, everything else will be included. If you do an inclusion, everything else will be excluded.
来源:https://stackoverflow.com/questions/21898209/cant-get-correct-assembly-filters-to-work-with-teamcity-8-and-dotcover-code-cov