Code coverage generates report for test classes instead of classes being tested

I am working on getting TeamCity configured to run code coverage. I have it configure to use the IntelliJ IDEA coverage engine. During the build process on TeamCity, the code coverage report does get generated. But the report shows the code coverage for the test classes, rather than the classes being tested.I configured TeamCity's Code Coverage to use the Ant runner type (see attached image file), I reference the appropriate ant build script for our project, and I reference the ant build target that runs our unit tests. The coverage report shows reports ONLY for the test classes, which is not helpful. I need coverage reports for the classes under test. I suspect I have something mis-configured.I've looked around at all of the configuration options for code coverage, and there doesn't seem to be anything relevant.How do I get TeamCity to generate a coverage report for the classes being tested?

1 comment
Comment actions Permalink
In order to get code coverage, the java code has to be compiled with debug enabled. From the command line this would be the -g option to javac. In Ant, this would be the 'debug="true"' attribute on the <javac> task.The reason my Test classes were showing coverage was because they were compiled with debug on. Once I compiled my classes-to-be-tested with debug turned on, the coverage reports appeared as expected.

Please sign in to leave a comment.