Using TrueCoverage for Java with JUnit

0 Likes

Problem:

Does TrueCoverage for Java work with JUnit?

Resolution:

We have something hardcoded that prevents this from profiling successfully.

There's a complicated issue in the way that JUnit invokes the classes it wants to test. The fix for this will be available with next release of our DevPartner Java products.

However, engineering has built a backport until then.

Download the patch TT66_funnyClassLoadersPatch.zip

o Just extract the zipfile so that 'jpcminstr.dll' overwrites the one in C:\Program Files\Compuware\PCShared\jpcminstr.dll.

o Also, the file 'nmpcJackets.class' from the zipfile should end up in C:\Program Files\Compuware\PCShared\java\lang (the zipfile should put it there automatically).

o The 'ttcore.dll' (that the zipfile will dump in PCShared also) has to be moved from there to C:\WINNT\SYSTEM32 (there's an old TTCORE.dll there that it is meant to overwrite. You might want to make a backup of your old files (jpcminstr.dll, nmpcJackets.class & ttcore.dll) before wiping them in case something goes wrong.

After applying the patch. there are still some known problems with how True Coverage interacts with JUnit. One noticeable one is when you get the coverage report at the end of the run the JUnit class is listed twice, once with just

the main method marked as executed and a second time with the other methods marked as executed.

This article applies to DevPartner Java 2.X only

Old KB# 11891
Comment List
Anonymous
Related Discussions
Recommended