From: Jayan M N <ja...@gm...> - 2012-07-13 10:23:28
|
On Fri, Jul 13, 2012 at 1:53 PM, Zschocke, Florian <Flo...@cy...> wrote: > Hi! > > I have a question about the cobertura.ser file. Is this file needed while running the tests and collection data? I know a new file is written after the test run when none was present, but is it of any advantage if the file is present while the tests run? > > >From the code I gathered that it doesn't matter if the cobertura.ser file is present. The only place I found where it is read during collecting stats is at the end when the final data is written at shutdown. There prior contents get merged with the new data collected. I didn't find anything in the code that hints at the data collection profiting from information added to the file during instrumentation. The instrumented code seems to be pretty self contained. > > I am asking because I am trying to run Cobertura instrumented code in an OSGi container and later merging the resulting cobertura.ser file with the one created by instrumentation. I understand that you need the data file from instrumentation in order to get actual coverage data, so that I don't end up with 100% coverage. I am just trying to find out if I can safely merge the separately created collection and instrumentation cobertura.ser files and end up with correct data. I am unsure because sometimes I end up with proper line coverage but 0% branch coverage, which is wrong. It is actually better to run tests the way you described. Writing of coverage data is faster when the original cobertura.ser is not present (as there is nothing to merge). You definitely need to merge the generated one with the cobertura.ser created at the time on instrumentation. Thanks, Jayan |