Problem enabling Code Coverage

I tried enabling code coverage for an ANT build and am getting this error:

: java (4s)
: java.lang.NoClassDefFoundError: com/vladium/emma/rt/RT
: at com.automatedlogic.green.mbtool.ProcessMbDocument.$VRi(ProcessMbDocument.java)
: at com.automatedlogic.green.mbtool.ProcessMbDocument.]]>(ProcessMbDocument.java)
: Exception in thread "main"
: Java returned: 1

The relevant part of our build (the createcbs target) uses the ]]> task to run some custom code to generate part of the data needed for build. I've tried fork="false" and clonevm="true" (not at the same time, of course) on this task but this does not help. Is there any way to get code coverage for this build?

Also, because of the size of our project, we have an "integration build" build and about 9 "test" builds defined in TeamCity (the tests get the compiled code from artifacts produced by the integration build). So, to get code coverage, I think I need to enable it for all of these builds even though the first is the only one that does the compilation. Is this correct? This seems more confusing than it should..

Thanks for the help,
John

2 comments

Hello John,

Try to add emma.jar to the classpath of your task. You can find emma.jar by the following path: ${agent.work.dir}/../plugins/coveragePlugin/lib/emma.jar TeamCity does it automatically if you run tests with regular or task. However in your case you have to add emma.jar in classpath manually. -- Pavel Sher "John Murph" wrote in message news:13568321.1182879798904.JavaMail.itn@is.intellij.net... >I tried enabling code coverage for an ANT build and am getting this error: >]]>

: java (4s)
: java.lang.NoClassDefFoundError: com/vladium/emma/rt/RT
: at
com.automatedlogic.green.mbtool.ProcessMbDocument.$VRi(ProcessMbDocument.java)
: at
com.automatedlogic.green.mbtool.ProcessMbDocument.<clinit>(ProcessMbDocument.java)
: Exception in thread "main"
: Java returned: 1

>

The relevant part of our build (the createcbs target) uses the <java> task
to run some custom code to generate part of the data needed for build.
I've tried fork="false" and clonevm="true" (not at the same time, of
course) on this task but this does not help. Is there any way to get code
coverage for this build?

>

Also, because of the size of our project, we have an "integration build"
build and about 9 "test" builds defined in TeamCity (the tests get the
compiled code from artifacts produced by the integration build). So, to
get code coverage, I think I need to enable it for all of these builds
even though the first is the only one that does the compilation. Is this
correct? This seems more confusing than it should..

>

Thanks for the help,
John



0

Thanks Pavel, that did work. However, for my purposes this was not a good solution because I found several places that I had to change like this. So, I added the emma libraries into my project and now the tests instrument the classes before running, and the build does not have to. This way, I did not enable the "coverage" through the ANT runner task, but still get the coverage report for each test suite. Looks like it works great so far.

0

Please sign in to leave a comment.