|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Saving coverage data on method exitHello Cobertura developers,
Please correct me If I'm wrong, currently Cobertura coverage data gets saved/flushed via JVM exit hook. This presents a problem if for instance integration/functional tests of a web project built using Maven 2, are run together with the application (deployed e.g. on an embedded Jetty server) in the same JVM instance Maven build is running in, JVM exit will happen once Maven build is over, which is too late for coverage report to be generated as part of the same build process. My current workaround is to mix a single test support class with production code, it gets triggered on closing of web application context, and if cobertura is present (determined via presence of cobertura.properties file), it will try to save/flush coverage data by calling static method saveGlobalProjectData on net.sourceforge.cobertura.coveragedata.ProjectData (using reflection so that application doesn't require cobertura library in production). Mixing test and production code is bad, so I was looking for a better solution. Cobertura FAQ mentions possibility of saving coverage data on exit from instrumented method, once asm 2.2 is released, and references (through broken link, guess it should point to this ) discussion with solution proposed by Eugene Kuleshov. Current cobertura depends on asm 3.0 that still has AdviceAdapter class which is at the heart of the Eugene's solution. I've tried working on it myself (see attached cobertura-save_coverage_data_on_method_exit.patch), but with only so much knowledge of asm and cobertura internals my first take on this wasn't successful - instrumentation, through cobertura maven plugin modified to use cobertura 1.10 built from latest sources with changes applied from the patch, fails with [1]. I'm not sure of the cause but it's very likely due to wrong patch changes. Is there a JIRA issue for this feature? I believe it's important one (guess not just to me) and wish it gets supported in future cobertura releases. Regards, Stevo. [1] instrumentation exception java.lang.IllegalStateException: ClassReader.accept() should be called with EXPAND_FRAMES flag at org.objectweb.asm.commons.LocalVariablesSorter.visitFrame(Unknown Source) at org.objectweb.asm.ClassReader.accept(Unknown Source) at org.objectweb.asm.ClassReader.accept(Unknown Source) at net.sourceforge.cobertura.instrument.Main.addInstrumentationToSingleClass(Main.java:358) at net.sourceforge.cobertura.instrument.Main.addInstrumentation(Main.java:416) at net.sourceforge.cobertura.instrument.Main.parseArguments(Main.java:492) at net.sourceforge.cobertura.instrument.Main.main(Main.java:514) ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Cobertura-devel mailing list Cobertura-devel@... https://lists.sourceforge.net/lists/listinfo/cobertura-devel |
|
|
Re: Saving coverage data on method exitFound similar exception in this Terracotta project issue, built cobertura with Java 1.5 instead of 1.6, and now instrumentation doesn't throw exceptions, but on exit processing isn't being called either.
On Sun, Aug 2, 2009 at 2:33 AM, Stevo Slavić <sslavic@...> wrote: Hello Cobertura developers, ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Cobertura-devel mailing list Cobertura-devel@... https://lists.sourceforge.net/lists/listinfo/cobertura-devel |
|
|
Re: Saving coverage data on method exitHere's my another take at saving coverage data on method exit (see attached patch), and it actually worked for me through use of customized cobertura maven plugin build. Why not have something like this in cobertura? Now that it works, it can be optimized to only save coverage data when exiting top methods.
Regards, Stevo. On Mon, Aug 3, 2009 at 6:13 AM, Stevo Slavić <sslavic@...> wrote: Found similar exception in this Terracotta project issue, built cobertura with Java 1.5 instead of 1.6, and now instrumentation doesn't throw exceptions, but on exit processing isn't being called either. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Cobertura-devel mailing list Cobertura-devel@... https://lists.sourceforge.net/lists/listinfo/cobertura-devel |
| Free embeddable forum powered by Nabble | Forum Help |