From: Steve C. <sch...@gm...> - 2012-11-13 21:08:40
|
That's because you have forkedmode set to default in your junit arguments. The method you are currently doing is a very expensive method for junit testing. Here's how junit (default) with cobertura works. Say we have 10 unit tests (test1-test10). When the jvm first starts it immediately creates a map for cobertura and begins to take note of all the line numbers and other items for keeping track of instrumented code(magic). When the jvm shuts down cobertura has a "release" task where it writes code to the .ser file. This is where you see the Loaded information on 816 classes. It will then save the infrormation to the file and be complete. Now here's where the inefficient part comes in. The default junit ant target has something called fork which essentially means "Create a new JVM for every single unit test". That means for test1 though test10 you will see about 10 jvms started up and shut down. so you will see all the loaded and saved information constantly. There are good and bad reasons for this: Good: No leaking data - Static (non-final) variables are not an issue. No issues with legacy code. Legacy code can have no failures. Bad: Incredibly slow (I've seen unit tests take 2+ hours vs 30 minutes with this option). Proof of bad junit (junits should never contain leaking data, or need to clean up properly in tearDown methods). The only way you can fix this issue is to set forkmode="once" as part of your ant target. Again this COULD cause junits to fail, however it will increase the speed of the junits by a lot. See the documentation on forkmode: http://ant.apache.org/manual/Tasks/junit.html On Tue, Nov 13, 2012 at 2:47 PM, KARR, DAVID <dk...@at...> wrote: > As Cobertura is excessively verbose right now, I notice that before every > unit test class is run, I see the following: > ---------------- > Cobertura: Loaded information on 816 classes. > Cobertura: Saved information on 816 classes. > ---------------- > > Obviously, the number of classes loaded and saved will vary, but it really > is doing this before very single unit test class, even when all of them > were spawned from the same "junit" task. I first wonder if it's expensive > to do this, and second I would wonder whether it's reasonable or possible > to do this load and save at a higher scope, like only once for each "junit" > task invocation. > > > ------------------------------------------------------------------------------ > Monitor your physical, virtual and cloud infrastructure from a single > web console. Get in-depth insight into apps, servers, databases, vmware, > SAP, cloud infrastructure, etc. Download 30-day Free Trial. > Pricing starts from $795 for 25 servers or applications! > http://p.sf.net/sfu/zoho_dev2dev_nov > _______________________________________________ > Cobertura-devel mailing list > Cob...@li... > https://lists.sourceforge.net/lists/listinfo/cobertura-devel > |