From: Mark D. <Mar...@sa...> - 2005-05-27 20:15:21
|
> From: cob...@li...=20 > [mailto:cob...@li...] On=20 > Behalf Of Matt Gochnour > To: cob...@li... > Subject: [Cobertura-devel] instrumentation jars > > I am wondering if I can or should be able to create a jar=20 > file of the instrumented classes to run my application from. =20 > Doing so would then permit me to run my application with this=20 > jar and determine how much of the code is affected or used by=20 > performing a given set of actions in the app, assuming I=20 > could then generate reports based on these steps.=20 Yes, you can certainly do that. > I have found little information on the cobertura.ser file and=20 > would like to know more about it. I didn't find any=20 > references to it in the cobertura source tree but could have=20 > missed something. Where is it specified, and can I change=20 > this, perhaps using a properties file? Is it a correct=20 > assumption that this is where the instrumented classes are=20 > storing information generated from running the unit tests? =20 > If so, then I could equivalently exercise the instrumented=20 > files by running the app normally and subsequently generating=20 > reports, assuming I can get the reporter to also read in a=20 > specific cobertura.ser. =20 It sounds like you have everything right: Yes, cobertura.ser contains = information generated from running the unit tests. Yes, you could = exercise the instrumented files by running the app normally and then = running cobertura-report. In fact, we instrument classes, deploy them = to a web server, then run JUnit tests which use HtmlUnit to access the = web server and test the classes. The default datafile "cobertura.ser" is set in the class = net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler. You can = override this when calling cobertura-instrument and cobertura-report by = specifying the "datafile" argument. See = http://cobertura.sourceforge.net/anttaskreference.html for a tiny bit = more info. (And there is an equivalent command-line parameter, if = you're not using ant) Specifying the datafile when your classes are running is a bit trickier. = You must set the system property "net.sourceforge.cobertura.datafile". = You could do something like the following: "java -Dnet.sourceforge.cobertura.datafile=3Dmydatafile1.ser = com.lgc.drillingsummarization.Main" Hope that helps, Mark |