From: Bill H. <han...@mc...> - 2010-06-25 15:43:36
|
Jake, I’ve tried it both ways. Classpath for test exec: … /var/cruise/hudson/home/jobs/requestor-trunk/workspace/trunk/work/test: /var/cruise/hudson/home/jobs/requestor-trunk/workspace/trunk/test: /var/cruise/hudson/home/jobs/requestor-trunk/workspace/trunk/work/test/instrumented: If the if the instrumented version is first or second, cobertura runs and all test coverage shows 0%. Thanks, Bill Hansley ____________________________ Duke University Health System DHTS Perioperative Services Manager, Development Team 10018 Hock Plaza w) 919.668.1388 f) 919.668.5568 From: jak...@gm... [mailto:jak...@gm...] On Behalf Of Jake Cobb Sent: Friday, June 25, 2010 10:04 AM To: Bill Hansley Cc: cob...@li... Subject: Re: [Cobertura-devel] Instrument task misses classes, tests die as a result When you included both directories on the classpath, did you have the non-instrumented folder come first? If so, try putting the instrumented dir first so any classes present in both will load the instrumented version. -Jake 2010/6/25 Bill Hansley <han...@mc...<mailto:han...@mc...>> Hi, I’m a newbie to Cobertura, and am having trouble getting it to work completely from start to finish. Starting from the end, here’s the error I’m getting: java.lang.reflect.InvocationTargetException Caused by: java.lang.NoClassDefFoundError: edu/duke/dhts/periop/requestOR/persistence/broker/PersistenceBroker$PerformWithHibernateSession at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) at suite.edu.duke.dhts.periop.requestOR.AllHibernateTests.suite(AllHibernateTests.java:32) at suite.edu.duke.dhts.periop.requestOR.AllTests.suite(AllTests.java:19) Caused by: java.lang.ClassNotFoundException: edu.duke.dhts.periop.requestOR.persistence.broker.PersistenceBroker$PerformWithHibernateSession at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) The class it can’t find (PersistenceBroker$PerformWithHibernateSession) is in my classes directory, but when instrument runs via ant, using this task: <target name="cobertura-tag-classes"> <delete file="cobertura.ser" /> <cobertura-instrument todir="${classes.instrumented}"> <ignore regex="org.apache.log4j.*" /> <fileset dir="${classes}"> <include name="**/*.class" /> </fileset> </cobertura-instrument> </target> The log file says it runs successfully: cobertura-tag-classes: [delete] Deleting: /var/cruise/hudson/home/jobs/requestor-trunk/workspace/trunk/cobertura.ser [cobertura-instrument] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file [cobertura-instrument] Instrumenting 187 files to /var/cruise/hudson/home/jobs/requestor-trunk/workspace/trunk/work/test/instrumented [cobertura-instrument] Cobertura: Saved information on 187 classes. [cobertura-instrument] Instrument time: 1982ms Yet, when I go to execute my tests, I get this: java.lang.reflect.InvocationTargetException Caused by: java.lang.NoClassDefFoundError: edu/duke/dhts/periop/requestOR/persistence/broker/PersistenceBroker$PerformWithHibernateSession at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) at suite.edu.duke.dhts.periop.requestOR.AllHibernateTests.suite(AllHibernateTests.java:32) at suite.edu.duke.dhts.periop.requestOR.AllTests.suite(AllTests.java:19) Caused by: java.lang.ClassNotFoundException: edu.duke.dhts.periop.requestOR.persistence.broker.PersistenceBroker$PerformWithHibernateSession at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) PersistenceBroker$PerformWithHibernateSession is in my original classes directory, but not in the instrumented classes directory. I can get Cobertura to run to completion by including my non-instrumented classes in the test run path, but everything comes up 0%. If I remove my non-instrumented classes, it dies trying to run the test with the exception above. Setup: Java: 1.6.0_14-b08 Cobertura: 1.9.4.1 Ant: 1.7.1 Hudson: 1.363 Any advice? Thanks, Bill Hansley ____________________________ Duke University Health System DHTS Perioperative Services Manager, Development Team 10018 Hock Plaza w) 919.668.1388 f) 919.668.5568 ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ Cobertura-devel mailing list Cob...@li...<mailto:Cob...@li...> https://lists.sourceforge.net/lists/listinfo/cobertura-devel |