1

I'm trying to use Google's CodePro Coverage tool to measure the coverage of my unit tests on a Google AppEngine project. However I'm getting various ClassFormatError exceptions on running the tests.

Have others got Google CodePro coverage working with a Google Appengine project?

Here are the lines of enquiry I'm pursuing:
a) Multiple levels of byte code engineering not working together. I.e. CodePro is fighting the GAE JPA implementation (DataNucleus instruments persistent classes).
b) Some RTFM error on my part

Here is the exception:

java.lang.ClassFormatError: Invalid length 65525 in LocalVariableTable in class file 
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Nick Johnson
  • 100,655
  • 16
  • 128
  • 198
byeo
  • 646
  • 7
  • 17
  • Is it only failing on JPA enhanced classes? what happens if you run it on non JPA enhanced classes only? Determining that is one way to decide if a) is your problem or not. – Peter Recore Feb 23 '11 at 20:11
  • Persistence classes cause most of the problems. Some complex classes that may possibly have runtime dependencies are causing problems too. Some tests on very isolated classes are working fine. – byeo Feb 23 '11 at 20:20
  • I made a GAE project with no JSP (therefore no JPA byte code engineering). The above issue did not occur when running tests against this project. I might investigate making a special build that doesn't run the datanucleaus JPA enhancer. Since you shouldn't deploy to production with the byte code instrumentation on anyway, this would be a part of any long term solution. – byeo Mar 01 '11 at 10:55

1 Answers1

0

Here's an answer to my own question, but I don't like it much.

I made a completely new eclipse coverage project, and instrumented this project with CodePro. In this coverage project I included the source code for my GAE project and my unit test project. I made a boilerplate class in the coverage project that uses JUnitCore to call the JUnit TestCases in the unit test project.

Results for the GAE project are not displayed until you do at least one run with that project instrumented. The coverage run view then appears to publish stats against that project.

It feels really ugly and I'm really not very impressed with CodePro. It's under par for a google tool.

I've also looked into using the codepro ant tasks however the coverage instrumentation task has gone. It used to be called when it was part of instantiations CodePro product.

I think I shall look at simply using EMMA (on which CodePro is based). Long term I need coverage reports to be generated from an automated build. Something that doesn't appear possible with CodePro.

byeo
  • 646
  • 7
  • 17