You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
(66) |
Apr
(29) |
May
(85) |
Jun
(66) |
Jul
(24) |
Aug
(139) |
Sep
(72) |
Oct
(26) |
Nov
(142) |
Dec
(34) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(55) |
Feb
(72) |
Mar
(43) |
Apr
(60) |
May
(95) |
Jun
(22) |
Jul
(48) |
Aug
(17) |
Sep
(54) |
Oct
(30) |
Nov
(82) |
Dec
(17) |
2007 |
Jan
(23) |
Feb
(38) |
Mar
(46) |
Apr
(12) |
May
(77) |
Jun
(77) |
Jul
(94) |
Aug
(51) |
Sep
(38) |
Oct
(57) |
Nov
(39) |
Dec
(67) |
2008 |
Jan
(38) |
Feb
(56) |
Mar
(42) |
Apr
(46) |
May
(37) |
Jun
(43) |
Jul
(52) |
Aug
(22) |
Sep
(22) |
Oct
(34) |
Nov
(37) |
Dec
(29) |
2009 |
Jan
(27) |
Feb
(35) |
Mar
(67) |
Apr
(37) |
May
(31) |
Jun
(79) |
Jul
(71) |
Aug
(59) |
Sep
(31) |
Oct
(47) |
Nov
(36) |
Dec
(7) |
2010 |
Jan
(15) |
Feb
(87) |
Mar
(38) |
Apr
(33) |
May
(24) |
Jun
(47) |
Jul
(26) |
Aug
(28) |
Sep
(33) |
Oct
(13) |
Nov
(8) |
Dec
(36) |
2011 |
Jan
(32) |
Feb
(10) |
Mar
(29) |
Apr
(29) |
May
(17) |
Jun
(14) |
Jul
(33) |
Aug
(11) |
Sep
(7) |
Oct
(7) |
Nov
(6) |
Dec
(10) |
2012 |
Jan
(19) |
Feb
(12) |
Mar
(16) |
Apr
(6) |
May
(18) |
Jun
(18) |
Jul
(31) |
Aug
(25) |
Sep
|
Oct
(31) |
Nov
(21) |
Dec
(9) |
2013 |
Jan
(8) |
Feb
(16) |
Mar
(8) |
Apr
(7) |
May
(3) |
Jun
(29) |
Jul
(29) |
Aug
|
Sep
(7) |
Oct
(9) |
Nov
(1) |
Dec
(1) |
2014 |
Jan
(3) |
Feb
(4) |
Mar
|
Apr
(13) |
May
(8) |
Jun
(5) |
Jul
(2) |
Aug
(4) |
Sep
(4) |
Oct
(2) |
Nov
|
Dec
(2) |
2015 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
|
May
(2) |
Jun
(1) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
(2) |
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
(3) |
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
(2) |
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Collector Of B. <bon...@ho...> - 2005-05-25 07:48:48
|
Hi, I just downloaded and tried cobertura. On the web there is example which shows line coverage and branch coverage on main page and later line by line coverage of each file. But when downloaded and started ant (just command "ant") then it generated report where is only shown data about how many tests are started, how many failed and if failed then what was output.. no coverage percentages or contets of java files. Did I miss smth or is this webexample other thing than cobertura report? Urmas ----------------------------------------- ITV - Sinu lemmiksaated internetis! http://www.itv.ee |
From: Mark D. <Mar...@sa...> - 2005-05-24 14:30:31
|
My manager pointed out that yesterday sourceforge activated their new = statistics system, and Cobertura managed to be in the top 500. = Sourceforge has over 100,000 projects, and even if a lot of them are = abandoned, I'd say this is still outstanding. Having an article about = us on IBM's developerWorks probably helps a bit (thanks Elliotte!) https://sourceforge.net/project/stats/?group_id=3D130558&ugn=3Dcobertura Anyhoo, keep up the good work everybody -Mark |
From: Mark D. <Mar...@sa...> - 2005-05-23 18:19:52
|
The source argument should point to the original java files. It's used = to show you an annotated version of your source in the HTML report. -Mark ________________________________ From: cob...@li... = [mailto:cob...@li...] On Behalf Of = Gossard, Ann L. Sent: Monday, May 23, 2005 2:17 PM To: cob...@li... Subject: [Cobertura-devel] Question =09 =09 Hi, I have a question.=20 I am trying to incorporate cobertura into an existing Java gui = application. I seems to be generating the instrumented files correctly = but I cannot seems to generate the coverage reports. What should the = source argument be? Should it point to the original java files or = instrumented files? Thanks,=20 Ann Gossard=20 |
From: Gossard, A. L. <Ann...@jh...> - 2005-05-23 18:16:56
|
Hi, I have a question. I am trying to incorporate cobertura into an existing Java gui application. I seems to be generating the instrumented files correctly but I cannot seems to generate the coverage reports. What should the source argument be? Should it point to the original java files or instrumented files? Thanks, Ann Gossard |
From: Grzegorz L. <ha...@gm...> - 2005-05-21 18:28:39
|
There is a bug in class net.sourceforge.cobertura.coveragedata.ClassData in method getSourceFileName(),=20 Instead of=20 =09=09=09int firstDollarSign =3D getName().indexOf('$'); there should be =09=09=09int firstDollarSign =3D getBaseName().indexOf('$'); Grzegorz On 5/21/05, Jeremy Thomerson <je...@th...> wrote: > Elliott, > I haven't seen it, but can look into it in the next few days. Could yo= u > file it in Tracker so I don't overlook it? >=20 > Thanks, > Jeremy >=20 > ----- Original Message ----- > From: "Elliotte Harold" <el...@me...> > To: <cob...@li...> > Sent: Saturday, May 21, 2005 6:12 AM > Subject: Re: [Cobertura-devel] Error using Cobertura 1.3 >=20 >=20 > > Elliotte Harold wrote: > > > I'm getting a weird error in Cobertura 1.3 I didn't see previously: > > > > > > [cobertura-report] WARN getCCN, Cannot find files to compute CCN, > > > > file=3D/Users/elharo/Projects/Jaxen/src/java/main/org/jaxen/expr/Identity= Set$I > dentityWrapp.java, > > > recursive=3Dfalse > > > [cobertura-report] Exception in thread "main" > > > java.lang.StringIndexOutOfBoundsException: String index out of range:= 30 > > > > > > > More details: > > > > [cobertura-report] WARN getCCN, Cannot find files to compute CCN, > > > file=3D/Users/elharo/Projects/Jaxen/src/java/main/org/jaxen/expr/Identity= Set$I > dentityWrapp.java, > > recursive=3Dfalse > > [cobertura-report] Exception in thread "main" > > java.lang.StringIndexOutOfBoundsException: String index out of range: 3= 0 > > [cobertura-report] at java.lang.String.substring(String.java:1441) > > [cobertura-report] at > > > net.sourceforge.cobertura.coveragedata.ClassData.getSourceFileName(ClassD= ata > .java:255) > > [cobertura-report] at > > > net.sourceforge.cobertura.reporting.html.HTMLReport.generateTableRowForCl= ass > (HTMLReport.java:667) > > [cobertura-report] at > > > net.sourceforge.cobertura.reporting.html.HTMLReport.generateOverview(HTML= Rep > ort.java:361) > > [cobertura-report] at > > > net.sourceforge.cobertura.reporting.html.HTMLReport.generateOverviews(HTM= LRe > port.java:234) > > [cobertura-report] at > > > net.sourceforge.cobertura.reporting.html.HTMLReport.<init>(HTMLReport.jav= a:7 > 2) > > [cobertura-report] at > > net.sourceforge.cobertura.reporting.Main.main(Main.java:161) > > > > > > -- > > Elliotte Rusty Harold el...@me... > > XML in a Nutshell 3rd Edition Just Published! > > http://www.cafeconleche.org/books/xian3/ > > http://www.amazon.com/exec/obidos/ISBN=3D0596007647/cafeaulaitA/ref=3Dn= osim > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by Oracle Space Sweepstakes > > Want to be the first software developer in space? > > Enter now for the Oracle Space Sweepstakes! > > http://ads.osdn.com/?ad_id=3D7412&alloc_id=3D16344&op=3Dclick > > _______________________________________________ > > Cobertura-devel mailing list > > Cob...@li... > > https://lists.sourceforge.net/lists/listinfo/cobertura-devel >=20 >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by Oracle Space Sweepstakes > Want to be the first software developer in space? > Enter now for the Oracle Space Sweepstakes! > http://ads.osdn.com/?ad_id=3D7412&alloc_id=3D16344&op=3Dclick > _______________________________________________ > Cobertura-devel mailing list > Cob...@li... > https://lists.sourceforge.net/lists/listinfo/cobertura-devel > |
From: Jeremy T. <je...@th...> - 2005-05-21 17:13:32
|
Elliott, I haven't seen it, but can look into it in the next few days. Could you file it in Tracker so I don't overlook it? Thanks, Jeremy ----- Original Message ----- From: "Elliotte Harold" <el...@me...> To: <cob...@li...> Sent: Saturday, May 21, 2005 6:12 AM Subject: Re: [Cobertura-devel] Error using Cobertura 1.3 > Elliotte Harold wrote: > > I'm getting a weird error in Cobertura 1.3 I didn't see previously: > > > > [cobertura-report] WARN getCCN, Cannot find files to compute CCN, > > file=/Users/elharo/Projects/Jaxen/src/java/main/org/jaxen/expr/IdentitySet$I dentityWrapp.java, > > recursive=false > > [cobertura-report] Exception in thread "main" > > java.lang.StringIndexOutOfBoundsException: String index out of range: 30 > > > > More details: > > [cobertura-report] WARN getCCN, Cannot find files to compute CCN, > file=/Users/elharo/Projects/Jaxen/src/java/main/org/jaxen/expr/IdentitySet$I dentityWrapp.java, > recursive=false > [cobertura-report] Exception in thread "main" > java.lang.StringIndexOutOfBoundsException: String index out of range: 30 > [cobertura-report] at java.lang.String.substring(String.java:1441) > [cobertura-report] at > net.sourceforge.cobertura.coveragedata.ClassData.getSourceFileName(ClassData .java:255) > [cobertura-report] at > net.sourceforge.cobertura.reporting.html.HTMLReport.generateTableRowForClass (HTMLReport.java:667) > [cobertura-report] at > net.sourceforge.cobertura.reporting.html.HTMLReport.generateOverview(HTMLRep ort.java:361) > [cobertura-report] at > net.sourceforge.cobertura.reporting.html.HTMLReport.generateOverviews(HTMLRe port.java:234) > [cobertura-report] at > net.sourceforge.cobertura.reporting.html.HTMLReport.<init>(HTMLReport.java:7 2) > [cobertura-report] at > net.sourceforge.cobertura.reporting.Main.main(Main.java:161) > > > -- > Elliotte Rusty Harold el...@me... > XML in a Nutshell 3rd Edition Just Published! > http://www.cafeconleche.org/books/xian3/ > http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim > > > ------------------------------------------------------- > This SF.Net email is sponsored by Oracle Space Sweepstakes > Want to be the first software developer in space? > Enter now for the Oracle Space Sweepstakes! > http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click > _______________________________________________ > Cobertura-devel mailing list > Cob...@li... > https://lists.sourceforge.net/lists/listinfo/cobertura-devel |
From: Elliotte H. <el...@me...> - 2005-05-21 13:12:47
|
Elliotte Harold wrote: > I'm getting a weird error in Cobertura 1.3 I didn't see previously: > > [cobertura-report] WARN getCCN, Cannot find files to compute CCN, > file=/Users/elharo/Projects/Jaxen/src/java/main/org/jaxen/expr/IdentitySet$IdentityWrapp.java, > recursive=false > [cobertura-report] Exception in thread "main" > java.lang.StringIndexOutOfBoundsException: String index out of range: 30 > More details: [cobertura-report] WARN getCCN, Cannot find files to compute CCN, file=/Users/elharo/Projects/Jaxen/src/java/main/org/jaxen/expr/IdentitySet$IdentityWrapp.java, recursive=false [cobertura-report] Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 30 [cobertura-report] at java.lang.String.substring(String.java:1441) [cobertura-report] at net.sourceforge.cobertura.coveragedata.ClassData.getSourceFileName(ClassData.java:255) [cobertura-report] at net.sourceforge.cobertura.reporting.html.HTMLReport.generateTableRowForClass(HTMLReport.java:667) [cobertura-report] at net.sourceforge.cobertura.reporting.html.HTMLReport.generateOverview(HTMLReport.java:361) [cobertura-report] at net.sourceforge.cobertura.reporting.html.HTMLReport.generateOverviews(HTMLReport.java:234) [cobertura-report] at net.sourceforge.cobertura.reporting.html.HTMLReport.<init>(HTMLReport.java:72) [cobertura-report] at net.sourceforge.cobertura.reporting.Main.main(Main.java:161) -- Elliotte Rusty Harold el...@me... XML in a Nutshell 3rd Edition Just Published! http://www.cafeconleche.org/books/xian3/ http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim |
From: Elliotte H. <el...@me...> - 2005-05-21 13:02:03
|
I'm getting a weird error in Cobertura 1.3 I didn't see previously: [cobertura-report] WARN getCCN, Cannot find files to compute CCN, file=/Users/elharo/Projects/Jaxen/src/java/main/org/jaxen/expr/IdentitySet$IdentityWrapp.java, recursive=false [cobertura-report] Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 30 Looks like it may have something to do with inner classes. Any ideas? Anyone else seen anything like this? -- Elliotte Rusty Harold el...@me... XML in a Nutshell 3rd Edition Just Published! http://www.cafeconleche.org/books/xian3/ http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim |
From: Seigel, J. <Jam...@av...> - 2005-05-21 05:39:16
|
Try that. See how that one works. I uploaded them to tracker. Cheers James. -----Original Message----- From: Jeremy Ryan Thomerson [mailto:je...@th...] Sent: Sat 5/21/2005 12:00 AM To: Seigel, James; cob...@li... Subject: Re: [Cobertura-devel] Multiple Source directories =20 James, I had a hard time applying that patch. When I did, it didn't merge correctly and caused some compiler issues. Could you try creating a new patch and uploading it on SourceForge in Tracker? Just email us bacck = when you have, and I'll try to do it again to give it a look. Thanks for the help! Jeremy Thomerson ----- Original Message -----=20 From: "Seigel, James" <Jam...@av...> To: <cob...@li...> Sent: Friday, May 20, 2005 5:49 PM Subject: [Cobertura-devel] Multiple Source directories I have taken a stab at modifying the code to allow it to support = multiple source directories separated by commas. I haven't added as many unit = tests I would have liked as it was a little challenging at times to wedge them = in. Unfortunately my eclipse template is very different from yours and unfortunately I fixed some of the todos while I was poking around..... If there are too many changes I can work on isolating them and resubmit = and dot it a bit more cleanly. One note, for calculating the complexity of "all packages" I averaged = the results for each source tree. this might be wrong but easily changed. anyway have a look Cheers James. Index: src/net/sourceforge/cobertura/reporting/Main.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/cobertura/cobertura/src/net/sourceforge/cobertura/reporting/Main= .ja va,v retrieving revision 1.11 diff -u -r1.11 Main.java --- src/net/sourceforge/cobertura/reporting/Main.java 3 May 2005 13:20:02 -0000 1.11 +++ src/net/sourceforge/cobertura/reporting/Main.java 20 May 2005 22:41:26 -0000 @@ -26,6 +26,8 @@ import gnu.getopt.LongOpt; import java.io.File; +import java.io.IOException; +import java.util.StringTokenizer; import net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler; import net.sourceforge.cobertura.coveragedata.ProjectData; @@ -34,140 +36,115 @@ import org.apache.log4j.Logger; -public class Main -{ - +public class Main { private static final Logger logger =3D Logger.getLogger(Main.class); - // TODO: make these not static? - static String format =3D "html"; - static File dataFile =3D null; - static File destinationDir =3D null; - static File sourceDir =3D null; - - public static void main(String[] args) throws Exception - { + public static void main(String[] args) throws Exception { + String format =3D "html"; + File dataFile =3D null; + File destinationDir =3D null; + File sourceDir[] =3D null; long startTime =3D System.currentTimeMillis(); LongOpt[] longOpts =3D new LongOpt[4]; // TODO: Allow for multiple destination and multiple source = directories - longOpts[0] =3D new LongOpt("format", LongOpt.REQUIRED_ARGUMENT, null, - 'f'); - longOpts[1] =3D new LongOpt("datafile", LongOpt.REQUIRED_ARGUMENT, - null, 'd'); - longOpts[2] =3D new LongOpt("destination", LongOpt.REQUIRED_ARGUMENT, - null, 'o'); - longOpts[3] =3D new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, - 's'); + longOpts[0] =3D new LongOpt("format", LongOpt.REQUIRED_ARGUMENT, null, = 'f'); + longOpts[1] =3D new LongOpt("datafile", LongOpt.REQUIRED_ARGUMENT, = null, 'd'); + longOpts[2] =3D new LongOpt("destination", LongOpt.REQUIRED_ARGUMENT, = null, 'o'); + longOpts[3] =3D new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, = 's'); - Getopt g =3D new Getopt(Main.class.getName(), args, ":f:d:o:s:", - longOpts); + Getopt g =3D new Getopt(Main.class.getName(), args, ":f:d:o:s:", = longOpts); int c; - while ((c =3D g.getopt()) !=3D -1) - { - switch (c) - { - case 'f': - format =3D g.getOptarg(); - if (!format.equalsIgnoreCase("html") - && !format.equalsIgnoreCase("xml")) - { - System.err - .println("Error: format \"" - + format - + "\" is invalid. Must be either html or xml"); - System.exit(1); - } - break; - - case 'd': - dataFile =3D new File(g.getOptarg()); - if (!dataFile.exists()) - { - System.err.println("Error: data file " - + dataFile.getAbsolutePath() - + " does not exist"); - System.exit(1); - } - if (!dataFile.isFile()) - { - System.err.println("Error: data file " - + dataFile.getAbsolutePath() - + " must be a regular file"); - System.exit(1); - } - break; - - case 'o': - destinationDir =3D new File(g.getOptarg()); - if (destinationDir.exists() - && !destinationDir.isDirectory()) - { - System.err.println("Error: destination directory " - + destinationDir - + " already exists but is not a directory"); - System.exit(1); - } - destinationDir.mkdirs(); - break; - - case 's': - sourceDir =3D new File(g.getOptarg()); - if (!sourceDir.exists()) - { - System.err.println("Error: source directory " - + sourceDir + " does not exist"); - System.exit(1); - } - if (!sourceDir.isDirectory()) - { - System.err.println("Error: source directory " - + sourceDir + " must be a directory"); - System.exit(1); - } - break; + while ((c =3D g.getopt()) !=3D -1) { + switch (c) { + case 'f': + format =3D g.getOptarg(); + if (!format.equalsIgnoreCase("html") && = !format.equalsIgnoreCase("xml")) { + System.err.println("Error: format \"" + format + "\" is invalid. Must = be either html or xml"); + System.exit(1); + } + break; + + case 'd': + dataFile =3D new File(g.getOptarg()); + if (!dataFile.exists()) { + System.err.println("Error: data file " + dataFile.getAbsolutePath() + = " does not exist"); + System.exit(1); + } + if (!dataFile.isFile()) { + System.err.println("Error: data file " + dataFile.getAbsolutePath() + = " must be a regular file"); + System.exit(1); + } + break; + + case 'o': + destinationDir =3D new File(g.getOptarg()); + if (destinationDir.exists() && !destinationDir.isDirectory()) { + System.err.println("Error: destination directory " + destinationDir + = " already exists but is not a directory"); + System.exit(1); + } + destinationDir.mkdirs(); + break; + + case 's': + sourceDir =3D parseSourceDirectory(g.getOptarg()); + break; + } + } + + performCoverage(format, dataFile, destinationDir, sourceDir); + + long stopTime =3D System.currentTimeMillis(); + System.out.println("Reporting time: " + (stopTime - startTime) + = "ms"); + } + + protected static File[] parseSourceDirectory(String = sourceDirectoryString) { + File[] sourceDir; + StringTokenizer stringTokenizer =3D new StringTokenizer(sourceDirectoryString, ","); + sourceDir =3D new File[stringTokenizer.countTokens()]; + int i =3D 0; + while (stringTokenizer.hasMoreTokens()) { + sourceDir[i] =3D new File(stringTokenizer.nextToken()); + if (!sourceDir[i].exists()) { + System.err.println("Error: source directory " + sourceDir[i] + " does = not exist"); + System.exit(1); } + if (!sourceDir[i].isDirectory()) { + System.err.println("Error: source directory " + sourceDir[i] + " must = be a directory"); + System.exit(1); + } + i++; } + return sourceDir; + } + protected static void performCoverage(String format, File dataFile, = File destinationDir, File[] sourceDir) throws Exception, IOException { if (dataFile =3D=3D null) dataFile =3D CoverageDataFileHandler.getDefaultDataFile(); - if (destinationDir =3D=3D null) - { + if (destinationDir =3D=3D null) { System.err.println("Error: destination directory must be set"); System.exit(1); } - if (sourceDir =3D=3D null) - { + if (sourceDir =3D=3D null) { System.err.println("Error: source directory must be set"); System.exit(1); } - if (logger.isDebugEnabled()) - { + if (logger.isDebugEnabled()) { logger.debug("format is " + format); logger.debug("dataFile is " + dataFile.getAbsolutePath()); - logger.debug("destinationDir is " - + destinationDir.getAbsolutePath()); - logger.debug("sourceDir is " + sourceDir.getAbsolutePath()); + logger.debug("destinationDir is " + destinationDir.getAbsolutePath()); } - ProjectData projectData =3D CoverageDataFileHandler - .loadCoverageData(dataFile); + ProjectData projectData =3D CoverageDataFileHandler.loadCoverageData(dataFile); - if (format.equalsIgnoreCase("html")) - { + if (format.equalsIgnoreCase("html")) { new HTMLReport(projectData, destinationDir, sourceDir); - } - else if (format.equalsIgnoreCase("xml")) - { + } else if (format.equalsIgnoreCase("xml")) { new XMLReport(projectData, destinationDir, sourceDir); } - - long stopTime =3D System.currentTimeMillis(); - System.out - .println("Reporting time: " + (stopTime - startTime) + "ms"); } } Index: src/net/sourceforge/cobertura/reporting/html/HTMLReport.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/cobertura/cobertura/src/net/sourceforge/cobertura/reporting/html= /HT MLReport.java,v retrieving revision 1.15 diff -u -r1.15 HTMLReport.java --- src/net/sourceforge/cobertura/reporting/html/HTMLReport.java 18 May = 2005 05:26:20 -0000 1.15 +++ src/net/sourceforge/cobertura/reporting/html/HTMLReport.java 20 May = 2005 22:41:27 -0000 @@ -52,14 +52,14 @@ private File destinationDir; - private File sourceDir; + File sourceDir[]; private ProjectData projectData; /** * Create a coverage report */ - public HTMLReport(ProjectData projectData, File outputDir, File = sourceDir) + public HTMLReport(ProjectData projectData, File outputDir, File[] sourceDir) throws Exception { this.destinationDir =3D outputDir; @@ -73,6 +73,9 @@ generateSourceFiles(); } + protected HTMLReport() { + } + private String generatePackageName(PackageData packageData) { if (packageData.getName().equals("")) @@ -301,15 +304,10 @@ } // Output a line for each package or subpackage - // TODO: Do we need this extra "package.size() > 0" check? - if (packages.size() > 0) - { - Iterator iter =3D packages.iterator(); - while (iter.hasNext()) - { - PackageData subPackageData =3D (PackageData)iter.next(); - out.println(generateTableRowForPackage(subPackageData)); - } + Iterator iter =3D packages.iterator(); + while (iter.hasNext()) { + PackageData subPackageData =3D (PackageData) iter.next(); + out.println(generateTableRowForPackage(subPackageData)); } out.println("</tbody>"); @@ -328,9 +326,7 @@ if (packageData =3D=3D null) { classes =3D new TreeSet(); - if (projectData.getNumberOfClasses() > 0) - { - Iterator iter =3D projectData.getClasses().iterator(); + iter =3D projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData =3D (ClassData)iter.next(); @@ -339,7 +335,6 @@ classes.add(classData); } } - } } else { @@ -353,11 +348,10 @@ out.println("<table class=3D\"report\" id=3D\"classResults\">"); out.println(generateTableHeaderForClasses()); out.println("<tbody>"); - - Iterator iter =3D classes.iterator(); - while (iter.hasNext()) - { - ClassData classData =3D (ClassData)iter.next(); + + iter =3D classes.iterator(); + while (iter.hasNext()) { + ClassData classData =3D (ClassData) iter.next(); out.println(generateTableRowForClass(classData)); } @@ -451,8 +445,7 @@ BufferedReader br =3D null; try { - File sourceFile =3D new File(sourceDir, classData - .getSourceFileName()); + File sourceFile =3D sourceFileForName(classData.getSourceFileName()); br =3D new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml =3D new JavaToHtml(); @@ -527,6 +520,16 @@ } } + protected File sourceFileForName(String sourceFileName) { + File file =3D null; + for (int i =3D 0; i < sourceDir.length; i++) { + file =3D new File(sourceDir[i], sourceFileName); + if (file.exists()) + return file; + } + return file; + } + private static String generateHelpURL(String text, String description) { StringBuffer ret =3D new StringBuffer(); @@ -627,7 +630,7 @@ StringBuffer ret =3D new StringBuffer(); double lineCoverage =3D projectData.getLineCoverageRate(); double branchCoverage =3D projectData.getBranchCoverageRate(); - double ccn =3D Util.getCCN(sourceDir, true); + double ccn =3D averageCCN(); ret.append(" <tr>"); ret.append("<td class=3D\"text\"><b>All Packages</b></td>"); ret.append("<td class=3D\"value\">" + projectData.getNumberOfClasses() @@ -638,15 +641,22 @@ return ret.toString(); } - private String generateTableRowForPackage(PackageData packageData) + private double averageCCN() { + double accumulator =3D 0; + for (int i =3D 0; i < sourceDir.length; i++) { + accumulator +=3D Util.getCCN(sourceDir[i], true); + } + return accumulator/sourceDir.length; + } + + protected String generateTableRowForPackage(PackageData packageData) { StringBuffer ret =3D new StringBuffer(); String url1 =3D "frame-summary-" + packageData.getName() + ".html"; String url2 =3D "frame-classes-" + packageData.getName() + ".html"; double lineCoverage =3D packageData.getLineCoverageRate(); double branchCoverage =3D packageData.getBranchCoverageRate(); - double ccn =3D Util.getCCN(new File(sourceDir, packageData - .getSourceFileName()), false); + double ccn =3D Util.getCCN(sourceFileForName(packageData.getSourceFileName()), false); ret.append(" <tr>"); ret.append("<td class=3D\"text\"><a href=3D\"" + url1 + "\" onClick=3D'parent.classList.location.href=3D\"" + url2 @@ -664,8 +674,7 @@ StringBuffer ret =3D new StringBuffer(); double lineCoverage =3D classData.getLineCoverageRate(); double branchCoverage =3D classData.getBranchCoverageRate(); - double ccn =3D Util.getCCN(new File(sourceDir, classData - .getSourceFileName()), false); + double ccn =3D = Util.getCCN(sourceFileForName(classData.getSourceFileName()), false); ret.append(" <tr>"); ret.append("<td class=3D\"text\"><a href=3D\"" + classData.getName() + ".html\">" + classData.getName() + "</a></td>"); Index: src/net/sourceforge/cobertura/reporting/xml/XMLReport.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/cobertura/cobertura/src/net/sourceforge/cobertura/reporting/xml/= XML Report.java,v retrieving revision 1.19 diff -u -r1.19 XMLReport.java --- src/net/sourceforge/cobertura/reporting/xml/XMLReport.java 29 Apr = 2005 20:06:53 -0000 1.19 +++ src/net/sourceforge/cobertura/reporting/xml/XMLReport.java 20 May = 2005 22:41:27 -0000 @@ -50,10 +50,10 @@ private int indent =3D 0; - private File sourceDirectory; + private File sourceDirectory[]; public XMLReport(ProjectData projectData, File destinationDir, - File sourceDirectory) throws IOException + File[] sourceDirectory) throws IOException { this.sourceDirectory =3D sourceDirectory; @@ -133,8 +133,7 @@ { logger.debug("Dumping package " + packageData.getName()); - double ccn =3D Util.getCCN(new File(sourceDirectory, packageData - .getSourceFileName()), false); + double ccn =3D Util.getCCN(sourceFileForName( packageData.getSourceFileName()), false); println("<package name=3D\"" + packageData.getName() + "\" line-rate=3D\"" + packageData.getLineCoverageRate() + "\" branch-rate=3D\"" + packageData.getBranchCoverageRate() @@ -164,8 +163,7 @@ { logger.debug("Dumping class " + classData.getName()); - double ccn =3D Util.getCCN(new File(sourceDirectory, classData - .getSourceFileName()), false); + double ccn =3D = Util.getCCN(sourceFileForName(classData.getSourceFileName()), false); println("<class name=3D\"" + classData.getName() + "\" filename=3D\"" + classData.getSourceFileName() + "\" line-rate=3D\"" + classData.getLineCoverageRate() + "\" branch-rate=3D\"" @@ -180,6 +178,16 @@ println("</class>"); } + protected File sourceFileForName(String sourceFileName) { + File file =3D null; + for (int i =3D 0; i < sourceDirectory.length; i++) { + file =3D new File(sourceDirectory[i], sourceFileName); + if (file.exists()) + return file; + } + return file; + } + private void dumpMethods(ClassData classData) { println("<methods>"); Index: test/net/sourceforge/cobertura/reporting/MainTest.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: test/net/sourceforge/cobertura/reporting/MainTest.java diff -N test/net/sourceforge/cobertura/reporting/MainTest.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ test/net/sourceforge/cobertura/reporting/MainTest.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,34 @@ +package net.sourceforge.cobertura.reporting; + +import java.io.File; +import java.io.IOException; + +import junit.framework.TestCase; + +public class MainTest extends TestCase { + + private File srcDirectory1; + private File srcDirectory2; + + protected void setUp() throws Exception { + super.setUp(); + File file =3D File.createTempFile("test", ".tmp"); + file.deleteOnExit(); + srcDirectory1 =3D new File(file.getParent(),"src1"); + srcDirectory1.mkdir(); + srcDirectory2 =3D new File(file.getParent(),"src2"); + srcDirectory2.mkdir(); + } + + protected void tearDown() throws Exception { + srcDirectory1.delete(); + srcDirectory2.delete(); + super.tearDown(); + } + + public void testParseSourceDirectory() throws Exception { + File[] files =3D Main.parseSourceDirectory(srcDirectory1.getCanonicalPath()+","+srcDirecto= ry2 .getCanonicalPath()); + assertEquals(2, files.length); + } + +} Index: test/net/sourceforge/cobertura/reporting/html/HTMLReportTest.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: = test/net/sourceforge/cobertura/reporting/html/HTMLReportTest.java diff -N = test/net/sourceforge/cobertura/reporting/html/HTMLReportTest.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ test/net/sourceforge/cobertura/reporting/html/HTMLReportTest.java 1 = Jan 1970 00:00:00 -0000 @@ -0,0 +1,63 @@ +package net.sourceforge.cobertura.reporting.html; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import junit.framework.TestCase; + +public class HTMLReportTest extends TestCase { + + private File[] srcDirectory; + + protected void setUp() throws Exception { + super.setUp(); + File tempFile =3D File.createTempFile("temp", ".tmp"); + tempFile.deleteOnExit(); + srcDirectory =3D new File[2]; + srcDirectory[1] =3D new File(tempFile.getParent(),"src1"); + srcDirectory[1].mkdir(); + filesUnderSourceDir(srcDirectory[1],1); + srcDirectory[0] =3D new File(tempFile.getParent(),"src0"); + srcDirectory[0].mkdir(); + filesUnderSourceDir(srcDirectory[0],2); + } + + private void filesUnderSourceDir(File srcDirectory, int number) throws IOException, FileNotFoundException { + File sub =3D new File(srcDirectory,"com"); + sub.mkdir(); + File temp =3D new File(sub,"example"); + temp.mkdir(); + File sample1 =3D new File(temp,"Sample"+number); + sample1.createNewFile(); + File sample2 =3D new File(temp,"Sample" + (number+1) ); + sample2.createNewFile(); + } + + protected void tearDown() throws Exception { + deleteTree(srcDirectory[0]); + deleteTree(srcDirectory[1]); + super.tearDown(); + } + + protected void deleteTree(File fileRoot) { + if(fileRoot.isFile()){ + fileRoot.delete(); + return; + } else { + File[] files =3D fileRoot.listFiles(); + for (int i =3D 0; i < files.length; i++) { + deleteTree(files[i]); + } + fileRoot.delete(); + } + + } + + public void testSourceFileForName() throws Exception { + HTMLReport report =3D new HTMLReport(); + report.sourceDir =3D srcDirectory; + File sourceFileForName =3D = report.sourceFileForName("com/example/Sample2"); + assertTrue(sourceFileForName.exists()); + assertTrue(sourceFileForName.getCanonicalPath().endsWith("Sample2")); + } +} ------------------------------------------------------- This SF.Net email is sponsored by Oracle Space Sweepstakes Want to be the first software developer in space? Enter now for the Oracle Space Sweepstakes! http://ads.osdn.com/?ad_idt12&alloc_id=16344&op=3Dick _______________________________________________ Cobertura-devel mailing list Cob...@li... https://lists.sourceforge.net/lists/listinfo/cobertura-devel |
From: Jeremy R. T. <je...@th...> - 2005-05-21 05:00:21
|
James, I had a hard time applying that patch. When I did, it didn't merge correctly and caused some compiler issues. Could you try creating a new patch and uploading it on SourceForge in Tracker? Just email us bacck when you have, and I'll try to do it again to give it a look. Thanks for the help! Jeremy Thomerson ----- Original Message ----- From: "Seigel, James" <Jam...@av...> To: <cob...@li...> Sent: Friday, May 20, 2005 5:49 PM Subject: [Cobertura-devel] Multiple Source directories I have taken a stab at modifying the code to allow it to support multiple source directories separated by commas. I haven't added as many unit tests I would have liked as it was a little challenging at times to wedge them in. Unfortunately my eclipse template is very different from yours and unfortunately I fixed some of the todos while I was poking around..... If there are too many changes I can work on isolating them and resubmit and dot it a bit more cleanly. One note, for calculating the complexity of "all packages" I averaged the results for each source tree. this might be wrong but easily changed. anyway have a look Cheers James. Index: src/net/sourceforge/cobertura/reporting/Main.java =================================================================== RCS file: /cvsroot/cobertura/cobertura/src/net/sourceforge/cobertura/reporting/Main.ja va,v retrieving revision 1.11 diff -u -r1.11 Main.java --- src/net/sourceforge/cobertura/reporting/Main.java 3 May 2005 13:20:02 -0000 1.11 +++ src/net/sourceforge/cobertura/reporting/Main.java 20 May 2005 22:41:26 -0000 @@ -26,6 +26,8 @@ import gnu.getopt.LongOpt; import java.io.File; +import java.io.IOException; +import java.util.StringTokenizer; import net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler; import net.sourceforge.cobertura.coveragedata.ProjectData; @@ -34,140 +36,115 @@ import org.apache.log4j.Logger; -public class Main -{ - +public class Main { private static final Logger logger = Logger.getLogger(Main.class); - // TODO: make these not static? - static String format = "html"; - static File dataFile = null; - static File destinationDir = null; - static File sourceDir = null; - - public static void main(String[] args) throws Exception - { + public static void main(String[] args) throws Exception { + String format = "html"; + File dataFile = null; + File destinationDir = null; + File sourceDir[] = null; long startTime = System.currentTimeMillis(); LongOpt[] longOpts = new LongOpt[4]; // TODO: Allow for multiple destination and multiple source directories - longOpts[0] = new LongOpt("format", LongOpt.REQUIRED_ARGUMENT, null, - 'f'); - longOpts[1] = new LongOpt("datafile", LongOpt.REQUIRED_ARGUMENT, - null, 'd'); - longOpts[2] = new LongOpt("destination", LongOpt.REQUIRED_ARGUMENT, - null, 'o'); - longOpts[3] = new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, - 's'); + longOpts[0] = new LongOpt("format", LongOpt.REQUIRED_ARGUMENT, null, 'f'); + longOpts[1] = new LongOpt("datafile", LongOpt.REQUIRED_ARGUMENT, null, 'd'); + longOpts[2] = new LongOpt("destination", LongOpt.REQUIRED_ARGUMENT, null, 'o'); + longOpts[3] = new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, 's'); - Getopt g = new Getopt(Main.class.getName(), args, ":f:d:o:s:", - longOpts); + Getopt g = new Getopt(Main.class.getName(), args, ":f:d:o:s:", longOpts); int c; - while ((c = g.getopt()) != -1) - { - switch (c) - { - case 'f': - format = g.getOptarg(); - if (!format.equalsIgnoreCase("html") - && !format.equalsIgnoreCase("xml")) - { - System.err - .println("Error: format \"" - + format - + "\" is invalid. Must be either html or xml"); - System.exit(1); - } - break; - - case 'd': - dataFile = new File(g.getOptarg()); - if (!dataFile.exists()) - { - System.err.println("Error: data file " - + dataFile.getAbsolutePath() - + " does not exist"); - System.exit(1); - } - if (!dataFile.isFile()) - { - System.err.println("Error: data file " - + dataFile.getAbsolutePath() - + " must be a regular file"); - System.exit(1); - } - break; - - case 'o': - destinationDir = new File(g.getOptarg()); - if (destinationDir.exists() - && !destinationDir.isDirectory()) - { - System.err.println("Error: destination directory " - + destinationDir - + " already exists but is not a directory"); - System.exit(1); - } - destinationDir.mkdirs(); - break; - - case 's': - sourceDir = new File(g.getOptarg()); - if (!sourceDir.exists()) - { - System.err.println("Error: source directory " - + sourceDir + " does not exist"); - System.exit(1); - } - if (!sourceDir.isDirectory()) - { - System.err.println("Error: source directory " - + sourceDir + " must be a directory"); - System.exit(1); - } - break; + while ((c = g.getopt()) != -1) { + switch (c) { + case 'f': + format = g.getOptarg(); + if (!format.equalsIgnoreCase("html") && !format.equalsIgnoreCase("xml")) { + System.err.println("Error: format \"" + format + "\" is invalid. Must be either html or xml"); + System.exit(1); + } + break; + + case 'd': + dataFile = new File(g.getOptarg()); + if (!dataFile.exists()) { + System.err.println("Error: data file " + dataFile.getAbsolutePath() + " does not exist"); + System.exit(1); + } + if (!dataFile.isFile()) { + System.err.println("Error: data file " + dataFile.getAbsolutePath() + " must be a regular file"); + System.exit(1); + } + break; + + case 'o': + destinationDir = new File(g.getOptarg()); + if (destinationDir.exists() && !destinationDir.isDirectory()) { + System.err.println("Error: destination directory " + destinationDir + " already exists but is not a directory"); + System.exit(1); + } + destinationDir.mkdirs(); + break; + + case 's': + sourceDir = parseSourceDirectory(g.getOptarg()); + break; + } + } + + performCoverage(format, dataFile, destinationDir, sourceDir); + + long stopTime = System.currentTimeMillis(); + System.out.println("Reporting time: " + (stopTime - startTime) + "ms"); + } + + protected static File[] parseSourceDirectory(String sourceDirectoryString) { + File[] sourceDir; + StringTokenizer stringTokenizer = new StringTokenizer(sourceDirectoryString, ","); + sourceDir = new File[stringTokenizer.countTokens()]; + int i = 0; + while (stringTokenizer.hasMoreTokens()) { + sourceDir[i] = new File(stringTokenizer.nextToken()); + if (!sourceDir[i].exists()) { + System.err.println("Error: source directory " + sourceDir[i] + " does not exist"); + System.exit(1); } + if (!sourceDir[i].isDirectory()) { + System.err.println("Error: source directory " + sourceDir[i] + " must be a directory"); + System.exit(1); + } + i++; } + return sourceDir; + } + protected static void performCoverage(String format, File dataFile, File destinationDir, File[] sourceDir) throws Exception, IOException { if (dataFile == null) dataFile = CoverageDataFileHandler.getDefaultDataFile(); - if (destinationDir == null) - { + if (destinationDir == null) { System.err.println("Error: destination directory must be set"); System.exit(1); } - if (sourceDir == null) - { + if (sourceDir == null) { System.err.println("Error: source directory must be set"); System.exit(1); } - if (logger.isDebugEnabled()) - { + if (logger.isDebugEnabled()) { logger.debug("format is " + format); logger.debug("dataFile is " + dataFile.getAbsolutePath()); - logger.debug("destinationDir is " - + destinationDir.getAbsolutePath()); - logger.debug("sourceDir is " + sourceDir.getAbsolutePath()); + logger.debug("destinationDir is " + destinationDir.getAbsolutePath()); } - ProjectData projectData = CoverageDataFileHandler - .loadCoverageData(dataFile); + ProjectData projectData = CoverageDataFileHandler.loadCoverageData(dataFile); - if (format.equalsIgnoreCase("html")) - { + if (format.equalsIgnoreCase("html")) { new HTMLReport(projectData, destinationDir, sourceDir); - } - else if (format.equalsIgnoreCase("xml")) - { + } else if (format.equalsIgnoreCase("xml")) { new XMLReport(projectData, destinationDir, sourceDir); } - - long stopTime = System.currentTimeMillis(); - System.out - .println("Reporting time: " + (stopTime - startTime) + "ms"); } } Index: src/net/sourceforge/cobertura/reporting/html/HTMLReport.java =================================================================== RCS file: /cvsroot/cobertura/cobertura/src/net/sourceforge/cobertura/reporting/html/HT MLReport.java,v retrieving revision 1.15 diff -u -r1.15 HTMLReport.java --- src/net/sourceforge/cobertura/reporting/html/HTMLReport.java 18 May 2005 05:26:20 -0000 1.15 +++ src/net/sourceforge/cobertura/reporting/html/HTMLReport.java 20 May 2005 22:41:27 -0000 @@ -52,14 +52,14 @@ private File destinationDir; - private File sourceDir; + File sourceDir[]; private ProjectData projectData; /** * Create a coverage report */ - public HTMLReport(ProjectData projectData, File outputDir, File sourceDir) + public HTMLReport(ProjectData projectData, File outputDir, File[] sourceDir) throws Exception { this.destinationDir = outputDir; @@ -73,6 +73,9 @@ generateSourceFiles(); } + protected HTMLReport() { + } + private String generatePackageName(PackageData packageData) { if (packageData.getName().equals("")) @@ -301,15 +304,10 @@ } // Output a line for each package or subpackage - // TODO: Do we need this extra "package.size() > 0" check? - if (packages.size() > 0) - { - Iterator iter = packages.iterator(); - while (iter.hasNext()) - { - PackageData subPackageData = (PackageData)iter.next(); - out.println(generateTableRowForPackage(subPackageData)); - } + Iterator iter = packages.iterator(); + while (iter.hasNext()) { + PackageData subPackageData = (PackageData) iter.next(); + out.println(generateTableRowForPackage(subPackageData)); } out.println("</tbody>"); @@ -328,9 +326,7 @@ if (packageData == null) { classes = new TreeSet(); - if (projectData.getNumberOfClasses() > 0) - { - Iterator iter = projectData.getClasses().iterator(); + iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); @@ -339,7 +335,6 @@ classes.add(classData); } } - } } else { @@ -353,11 +348,10 @@ out.println("<table class=\"report\" id=\"classResults\">"); out.println(generateTableHeaderForClasses()); out.println("<tbody>"); - - Iterator iter = classes.iterator(); - while (iter.hasNext()) - { - ClassData classData = (ClassData)iter.next(); + + iter = classes.iterator(); + while (iter.hasNext()) { + ClassData classData = (ClassData) iter.next(); out.println(generateTableRowForClass(classData)); } @@ -451,8 +445,7 @@ BufferedReader br = null; try { - File sourceFile = new File(sourceDir, classData - .getSourceFileName()); + File sourceFile = sourceFileForName(classData.getSourceFileName()); br = new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml = new JavaToHtml(); @@ -527,6 +520,16 @@ } } + protected File sourceFileForName(String sourceFileName) { + File file = null; + for (int i = 0; i < sourceDir.length; i++) { + file = new File(sourceDir[i], sourceFileName); + if (file.exists()) + return file; + } + return file; + } + private static String generateHelpURL(String text, String description) { StringBuffer ret = new StringBuffer(); @@ -627,7 +630,7 @@ StringBuffer ret = new StringBuffer(); double lineCoverage = projectData.getLineCoverageRate(); double branchCoverage = projectData.getBranchCoverageRate(); - double ccn = Util.getCCN(sourceDir, true); + double ccn = averageCCN(); ret.append(" <tr>"); ret.append("<td class=\"text\"><b>All Packages</b></td>"); ret.append("<td class=\"value\">" + projectData.getNumberOfClasses() @@ -638,15 +641,22 @@ return ret.toString(); } - private String generateTableRowForPackage(PackageData packageData) + private double averageCCN() { + double accumulator = 0; + for (int i = 0; i < sourceDir.length; i++) { + accumulator += Util.getCCN(sourceDir[i], true); + } + return accumulator/sourceDir.length; + } + + protected String generateTableRowForPackage(PackageData packageData) { StringBuffer ret = new StringBuffer(); String url1 = "frame-summary-" + packageData.getName() + ".html"; String url2 = "frame-classes-" + packageData.getName() + ".html"; double lineCoverage = packageData.getLineCoverageRate(); double branchCoverage = packageData.getBranchCoverageRate(); - double ccn = Util.getCCN(new File(sourceDir, packageData - .getSourceFileName()), false); + double ccn = Util.getCCN(sourceFileForName(packageData.getSourceFileName()), false); ret.append(" <tr>"); ret.append("<td class=\"text\"><a href=\"" + url1 + "\" onClick='parent.classList.location.href=\"" + url2 @@ -664,8 +674,7 @@ StringBuffer ret = new StringBuffer(); double lineCoverage = classData.getLineCoverageRate(); double branchCoverage = classData.getBranchCoverageRate(); - double ccn = Util.getCCN(new File(sourceDir, classData - .getSourceFileName()), false); + double ccn = Util.getCCN(sourceFileForName(classData.getSourceFileName()), false); ret.append(" <tr>"); ret.append("<td class=\"text\"><a href=\"" + classData.getName() + ".html\">" + classData.getName() + "</a></td>"); Index: src/net/sourceforge/cobertura/reporting/xml/XMLReport.java =================================================================== RCS file: /cvsroot/cobertura/cobertura/src/net/sourceforge/cobertura/reporting/xml/XML Report.java,v retrieving revision 1.19 diff -u -r1.19 XMLReport.java --- src/net/sourceforge/cobertura/reporting/xml/XMLReport.java 29 Apr 2005 20:06:53 -0000 1.19 +++ src/net/sourceforge/cobertura/reporting/xml/XMLReport.java 20 May 2005 22:41:27 -0000 @@ -50,10 +50,10 @@ private int indent = 0; - private File sourceDirectory; + private File sourceDirectory[]; public XMLReport(ProjectData projectData, File destinationDir, - File sourceDirectory) throws IOException + File[] sourceDirectory) throws IOException { this.sourceDirectory = sourceDirectory; @@ -133,8 +133,7 @@ { logger.debug("Dumping package " + packageData.getName()); - double ccn = Util.getCCN(new File(sourceDirectory, packageData - .getSourceFileName()), false); + double ccn = Util.getCCN(sourceFileForName( packageData.getSourceFileName()), false); println("<package name=\"" + packageData.getName() + "\" line-rate=\"" + packageData.getLineCoverageRate() + "\" branch-rate=\"" + packageData.getBranchCoverageRate() @@ -164,8 +163,7 @@ { logger.debug("Dumping class " + classData.getName()); - double ccn = Util.getCCN(new File(sourceDirectory, classData - .getSourceFileName()), false); + double ccn = Util.getCCN(sourceFileForName(classData.getSourceFileName()), false); println("<class name=\"" + classData.getName() + "\" filename=\"" + classData.getSourceFileName() + "\" line-rate=\"" + classData.getLineCoverageRate() + "\" branch-rate=\"" @@ -180,6 +178,16 @@ println("</class>"); } + protected File sourceFileForName(String sourceFileName) { + File file = null; + for (int i = 0; i < sourceDirectory.length; i++) { + file = new File(sourceDirectory[i], sourceFileName); + if (file.exists()) + return file; + } + return file; + } + private void dumpMethods(ClassData classData) { println("<methods>"); Index: test/net/sourceforge/cobertura/reporting/MainTest.java =================================================================== RCS file: test/net/sourceforge/cobertura/reporting/MainTest.java diff -N test/net/sourceforge/cobertura/reporting/MainTest.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ test/net/sourceforge/cobertura/reporting/MainTest.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,34 @@ +package net.sourceforge.cobertura.reporting; + +import java.io.File; +import java.io.IOException; + +import junit.framework.TestCase; + +public class MainTest extends TestCase { + + private File srcDirectory1; + private File srcDirectory2; + + protected void setUp() throws Exception { + super.setUp(); + File file = File.createTempFile("test", ".tmp"); + file.deleteOnExit(); + srcDirectory1 = new File(file.getParent(),"src1"); + srcDirectory1.mkdir(); + srcDirectory2 = new File(file.getParent(),"src2"); + srcDirectory2.mkdir(); + } + + protected void tearDown() throws Exception { + srcDirectory1.delete(); + srcDirectory2.delete(); + super.tearDown(); + } + + public void testParseSourceDirectory() throws Exception { + File[] files = Main.parseSourceDirectory(srcDirectory1.getCanonicalPath()+","+srcDirectory2 .getCanonicalPath()); + assertEquals(2, files.length); + } + +} Index: test/net/sourceforge/cobertura/reporting/html/HTMLReportTest.java =================================================================== RCS file: test/net/sourceforge/cobertura/reporting/html/HTMLReportTest.java diff -N test/net/sourceforge/cobertura/reporting/html/HTMLReportTest.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ test/net/sourceforge/cobertura/reporting/html/HTMLReportTest.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,63 @@ +package net.sourceforge.cobertura.reporting.html; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import junit.framework.TestCase; + +public class HTMLReportTest extends TestCase { + + private File[] srcDirectory; + + protected void setUp() throws Exception { + super.setUp(); + File tempFile = File.createTempFile("temp", ".tmp"); + tempFile.deleteOnExit(); + srcDirectory = new File[2]; + srcDirectory[1] = new File(tempFile.getParent(),"src1"); + srcDirectory[1].mkdir(); + filesUnderSourceDir(srcDirectory[1],1); + srcDirectory[0] = new File(tempFile.getParent(),"src0"); + srcDirectory[0].mkdir(); + filesUnderSourceDir(srcDirectory[0],2); + } + + private void filesUnderSourceDir(File srcDirectory, int number) throws IOException, FileNotFoundException { + File sub = new File(srcDirectory,"com"); + sub.mkdir(); + File temp = new File(sub,"example"); + temp.mkdir(); + File sample1 = new File(temp,"Sample"+number); + sample1.createNewFile(); + File sample2 = new File(temp,"Sample" + (number+1) ); + sample2.createNewFile(); + } + + protected void tearDown() throws Exception { + deleteTree(srcDirectory[0]); + deleteTree(srcDirectory[1]); + super.tearDown(); + } + + protected void deleteTree(File fileRoot) { + if(fileRoot.isFile()){ + fileRoot.delete(); + return; + } else { + File[] files = fileRoot.listFiles(); + for (int i = 0; i < files.length; i++) { + deleteTree(files[i]); + } + fileRoot.delete(); + } + + } + + public void testSourceFileForName() throws Exception { + HTMLReport report = new HTMLReport(); + report.sourceDir = srcDirectory; + File sourceFileForName = report.sourceFileForName("com/example/Sample2"); + assertTrue(sourceFileForName.exists()); + assertTrue(sourceFileForName.getCanonicalPath().endsWith("Sample2")); + } +} ------------------------------------------------------- This SF.Net email is sponsored by Oracle Space Sweepstakes Want to be the first software developer in space? Enter now for the Oracle Space Sweepstakes! http://ads.osdn.com/?ad_idt12&alloc_id344&op=ick _______________________________________________ Cobertura-devel mailing list Cob...@li... https://lists.sourceforge.net/lists/listinfo/cobertura-devel |
From: Seigel, J. <Jam...@av...> - 2005-05-21 04:40:30
|
Here is a cleaner diff. Cheers James. Index: src/net/sourceforge/cobertura/reporting/Main.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: = /cvsroot/cobertura/cobertura/src/net/sourceforge/cobertura/reporting/Main= .java,v retrieving revision 1.11 diff -u -r1.11 Main.java --- src/net/sourceforge/cobertura/reporting/Main.java 3 May 2005 = 13:20:02 -0000 1.11 +++ src/net/sourceforge/cobertura/reporting/Main.java 21 May 2005 = 04:36:15 -0000 @@ -26,6 +26,8 @@ import gnu.getopt.LongOpt; =20 import java.io.File; +import java.io.IOException; +import java.util.StringTokenizer; =20 import net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler; import net.sourceforge.cobertura.coveragedata.ProjectData; @@ -39,18 +41,15 @@ =20 private static final Logger logger =3D Logger.getLogger(Main.class); =20 - // TODO: make these not static? - static String format =3D "html"; - static File dataFile =3D null; - static File destinationDir =3D null; - static File sourceDir =3D null; - - public static void main(String[] args) throws Exception - { + public static void main(String[] args) throws Exception { + String format =3D "html"; + File dataFile =3D null; + File destinationDir =3D null; + File sourceDir[] =3D null; long startTime =3D System.currentTimeMillis(); =20 LongOpt[] longOpts =3D new LongOpt[4]; - // TODO: Allow for multiple destination and multiple source = directories + // TODO: Allow for multiple destination longOpts[0] =3D new LongOpt("format", LongOpt.REQUIRED_ARGUMENT, = null, 'f'); longOpts[1] =3D new LongOpt("datafile", LongOpt.REQUIRED_ARGUMENT, @@ -111,24 +110,39 @@ destinationDir.mkdirs(); break; =20 - case 's': - sourceDir =3D new File(g.getOptarg()); - if (!sourceDir.exists()) - { - System.err.println("Error: source directory " - + sourceDir + " does not exist"); - System.exit(1); - } - if (!sourceDir.isDirectory()) - { - System.err.println("Error: source directory " - + sourceDir + " must be a directory"); - System.exit(1); - } - break; + case 's': + sourceDir =3D parseSourceDirectory(g.getOptarg()); + break; } } =20 + performCoverage(format, dataFile, destinationDir, sourceDir); + + long stopTime =3D System.currentTimeMillis(); + System.out.println("Reporting time: " + (stopTime - startTime) + = "ms"); + } + + protected static File[] parseSourceDirectory(String = sourceDirectoryString) { + File[] sourceDir; + StringTokenizer stringTokenizer =3D new = StringTokenizer(sourceDirectoryString, ","); + sourceDir =3D new File[stringTokenizer.countTokens()]; + int i =3D 0; + while (stringTokenizer.hasMoreTokens()) { + sourceDir[i] =3D new File(stringTokenizer.nextToken()); + if (!sourceDir[i].exists()) { + System.err.println("Error: source directory " + sourceDir[i] + " = does not exist"); + System.exit(1); + } + if (!sourceDir[i].isDirectory()) { + System.err.println("Error: source directory " + sourceDir[i] + " = must be a directory"); + System.exit(1); + } + i++; + } + return sourceDir; + } + + protected static void performCoverage(String format, File dataFile, = File destinationDir, File[] sourceDir) throws Exception, IOException { if (dataFile =3D=3D null) dataFile =3D CoverageDataFileHandler.getDefaultDataFile(); =20 @@ -150,7 +164,7 @@ logger.debug("dataFile is " + dataFile.getAbsolutePath()); logger.debug("destinationDir is " + destinationDir.getAbsolutePath()); - logger.debug("sourceDir is " + sourceDir.getAbsolutePath()); + // logger.debug("sourceDir is " + sourceDir.getAbsolutePath()); } =20 ProjectData projectData =3D CoverageDataFileHandler @@ -164,10 +178,6 @@ { new XMLReport(projectData, destinationDir, sourceDir); } - - long stopTime =3D System.currentTimeMillis(); - System.out - .println("Reporting time: " + (stopTime - startTime) + "ms"); } =20 } Index: src/net/sourceforge/cobertura/reporting/html/HTMLReport.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: = /cvsroot/cobertura/cobertura/src/net/sourceforge/cobertura/reporting/html= /HTMLReport.java,v retrieving revision 1.15 diff -u -r1.15 HTMLReport.java --- src/net/sourceforge/cobertura/reporting/html/HTMLReport.java 18 May = 2005 05:26:20 -0000 1.15 +++ src/net/sourceforge/cobertura/reporting/html/HTMLReport.java 21 May = 2005 04:36:15 -0000 @@ -52,14 +52,14 @@ =20 private File destinationDir; =20 - private File sourceDir; + File sourceDir[]; =20 private ProjectData projectData; =20 /** * Create a coverage report */ - public HTMLReport(ProjectData projectData, File outputDir, File = sourceDir) + public HTMLReport(ProjectData projectData, File outputDir, File[] = sourceDir) throws Exception { this.destinationDir =3D outputDir; @@ -73,6 +73,9 @@ generateSourceFiles(); } =20 + protected HTMLReport() { + } + private String generatePackageName(PackageData packageData) { if (packageData.getName().equals("")) @@ -301,15 +304,10 @@ } =20 // Output a line for each package or subpackage - // TODO: Do we need this extra "package.size() > 0" check? - if (packages.size() > 0) - { - Iterator iter =3D packages.iterator(); - while (iter.hasNext()) - { - PackageData subPackageData =3D (PackageData)iter.next(); - out.println(generateTableRowForPackage(subPackageData)); - } + Iterator iter =3D packages.iterator(); + while (iter.hasNext()) { + PackageData subPackageData =3D (PackageData) iter.next(); + out.println(generateTableRowForPackage(subPackageData)); } =20 out.println("</tbody>"); @@ -328,16 +326,13 @@ if (packageData =3D=3D null) { classes =3D new TreeSet(); - if (projectData.getNumberOfClasses() > 0) + iter =3D projectData.getClasses().iterator(); + while (iter.hasNext())=20 { - Iterator iter =3D projectData.getClasses().iterator(); - while (iter.hasNext()) + ClassData classData =3D (ClassData) iter.next(); + if (classData.getPackageName() =3D=3D null)=20 { - ClassData classData =3D (ClassData)iter.next(); - if (classData.getPackageName() =3D=3D null) - { - classes.add(classData); - } + classes.add(classData); } } } @@ -353,11 +348,10 @@ out.println("<table class=3D\"report\" id=3D\"classResults\">"); out.println(generateTableHeaderForClasses()); out.println("<tbody>"); - - Iterator iter =3D classes.iterator(); - while (iter.hasNext()) - { - ClassData classData =3D (ClassData)iter.next(); + =09 + iter =3D classes.iterator(); + while (iter.hasNext()) { + ClassData classData =3D (ClassData) iter.next(); out.println(generateTableRowForClass(classData)); } =20 @@ -451,8 +445,7 @@ BufferedReader br =3D null; try { - File sourceFile =3D new File(sourceDir, classData - .getSourceFileName()); + File sourceFile =3D = sourceFileForName(classData.getSourceFileName()); br =3D new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml =3D new JavaToHtml(); @@ -527,6 +520,16 @@ } } =20 + protected File sourceFileForName(String sourceFileName) { + File file =3D null; + for (int i =3D 0; i < sourceDir.length; i++) { + file =3D new File(sourceDir[i], sourceFileName); + if (file.exists()) + return file; + } + return file; + } + private static String generateHelpURL(String text, String description) { StringBuffer ret =3D new StringBuffer(); @@ -627,7 +630,7 @@ StringBuffer ret =3D new StringBuffer(); double lineCoverage =3D projectData.getLineCoverageRate(); double branchCoverage =3D projectData.getBranchCoverageRate(); - double ccn =3D Util.getCCN(sourceDir, true); + double ccn =3D averageCCN(); ret.append(" <tr>"); ret.append("<td class=3D\"text\"><b>All Packages</b></td>"); ret.append("<td class=3D\"value\">" + = projectData.getNumberOfClasses() @@ -638,15 +641,22 @@ return ret.toString(); } =20 - private String generateTableRowForPackage(PackageData packageData) + private double averageCCN() { + double accumulator =3D 0; + for (int i =3D 0; i < sourceDir.length; i++) { + accumulator +=3D Util.getCCN(sourceDir[i], true); + } + return accumulator/sourceDir.length; + } + + protected String generateTableRowForPackage(PackageData packageData) { StringBuffer ret =3D new StringBuffer(); String url1 =3D "frame-summary-" + packageData.getName() + ".html"; String url2 =3D "frame-classes-" + packageData.getName() + ".html"; double lineCoverage =3D packageData.getLineCoverageRate(); double branchCoverage =3D packageData.getBranchCoverageRate(); - double ccn =3D Util.getCCN(new File(sourceDir, packageData - .getSourceFileName()), false); + double ccn =3D = Util.getCCN(sourceFileForName(packageData.getSourceFileName()), false); ret.append(" <tr>"); ret.append("<td class=3D\"text\"><a href=3D\"" + url1 + "\" onClick=3D'parent.classList.location.href=3D\"" + url2 @@ -664,8 +674,7 @@ StringBuffer ret =3D new StringBuffer(); double lineCoverage =3D classData.getLineCoverageRate(); double branchCoverage =3D classData.getBranchCoverageRate(); - double ccn =3D Util.getCCN(new File(sourceDir, classData - .getSourceFileName()), false); + double ccn =3D = Util.getCCN(sourceFileForName(classData.getSourceFileName()), false); ret.append(" <tr>"); ret.append("<td class=3D\"text\"><a href=3D\"" + classData.getName() + ".html\">" + classData.getName() + "</a></td>"); Index: src/net/sourceforge/cobertura/reporting/xml/XMLReport.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: = /cvsroot/cobertura/cobertura/src/net/sourceforge/cobertura/reporting/xml/= XMLReport.java,v retrieving revision 1.19 diff -u -r1.19 XMLReport.java --- src/net/sourceforge/cobertura/reporting/xml/XMLReport.java 29 Apr = 2005 20:06:53 -0000 1.19 +++ src/net/sourceforge/cobertura/reporting/xml/XMLReport.java 21 May = 2005 04:36:15 -0000 @@ -50,10 +50,10 @@ =20 private int indent =3D 0; =20 - private File sourceDirectory; + private File sourceDirectory[]; =20 public XMLReport(ProjectData projectData, File destinationDir, - File sourceDirectory) throws IOException + File[] sourceDirectory) throws IOException { this.sourceDirectory =3D sourceDirectory; =20 @@ -133,8 +133,7 @@ { logger.debug("Dumping package " + packageData.getName()); =20 - double ccn =3D Util.getCCN(new File(sourceDirectory, packageData - .getSourceFileName()), false); + double ccn =3D Util.getCCN(sourceFileForName( = packageData.getSourceFileName()), false); println("<package name=3D\"" + packageData.getName() + "\" line-rate=3D\"" + packageData.getLineCoverageRate() + "\" branch-rate=3D\"" + packageData.getBranchCoverageRate() @@ -164,8 +163,7 @@ { logger.debug("Dumping class " + classData.getName()); =20 - double ccn =3D Util.getCCN(new File(sourceDirectory, classData - .getSourceFileName()), false); + double ccn =3D = Util.getCCN(sourceFileForName(classData.getSourceFileName()), false); println("<class name=3D\"" + classData.getName() + "\" filename=3D\"" + classData.getSourceFileName() + "\" line-rate=3D\"" + classData.getLineCoverageRate() + "\" branch-rate=3D\"" @@ -180,6 +178,16 @@ println("</class>"); } =20 + protected File sourceFileForName(String sourceFileName) { + File file =3D null; + for (int i =3D 0; i < sourceDirectory.length; i++) { + file =3D new File(sourceDirectory[i], sourceFileName); + if (file.exists()) + return file; + } + return file; + } + private void dumpMethods(ClassData classData) { println("<methods>"); Index: test/net/sourceforge/cobertura/reporting/MainTest.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: test/net/sourceforge/cobertura/reporting/MainTest.java diff -N test/net/sourceforge/cobertura/reporting/MainTest.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ test/net/sourceforge/cobertura/reporting/MainTest.java 1 Jan 1970 = 00:00:00 -0000 @@ -0,0 +1,34 @@ +package net.sourceforge.cobertura.reporting; + +import java.io.File; +import java.io.IOException; + +import junit.framework.TestCase; + +public class MainTest extends TestCase { +=09 + private File srcDirectory1; + private File srcDirectory2; + + protected void setUp() throws Exception { + super.setUp(); + File file =3D File.createTempFile("test", ".tmp"); + file.deleteOnExit(); + srcDirectory1 =3D new File(file.getParent(),"src1"); + srcDirectory1.mkdir(); + srcDirectory2 =3D new File(file.getParent(),"src2"); + srcDirectory2.mkdir(); + } + + protected void tearDown() throws Exception { + srcDirectory1.delete(); + srcDirectory2.delete(); + super.tearDown(); + } + + public void testParseSourceDirectory() throws Exception { + File[] files =3D = Main.parseSourceDirectory(srcDirectory1.getCanonicalPath()+","+srcDirecto= ry2.getCanonicalPath()); + assertEquals(2, files.length); + } + +} Index: test/net/sourceforge/cobertura/reporting/html/HTMLReportTest.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: = test/net/sourceforge/cobertura/reporting/html/HTMLReportTest.java diff -N = test/net/sourceforge/cobertura/reporting/html/HTMLReportTest.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ test/net/sourceforge/cobertura/reporting/html/HTMLReportTest.java 1 = Jan 1970 00:00:00 -0000 @@ -0,0 +1,63 @@ +package net.sourceforge.cobertura.reporting.html; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import junit.framework.TestCase; + +public class HTMLReportTest extends TestCase { +=09 + private File[] srcDirectory; + + protected void setUp() throws Exception { + super.setUp(); + File tempFile =3D File.createTempFile("temp", ".tmp"); + tempFile.deleteOnExit(); + srcDirectory =3D new File[2]; + srcDirectory[1] =3D new File(tempFile.getParent(),"src1"); + srcDirectory[1].mkdir(); + filesUnderSourceDir(srcDirectory[1],1); + srcDirectory[0] =3D new File(tempFile.getParent(),"src0"); + srcDirectory[0].mkdir(); + filesUnderSourceDir(srcDirectory[0],2); + } + + private void filesUnderSourceDir(File srcDirectory, int number) throws = IOException, FileNotFoundException { + File sub =3D new File(srcDirectory,"com"); + sub.mkdir(); + File temp =3D new File(sub,"example"); + temp.mkdir(); + File sample1 =3D new File(temp,"Sample"+number); + sample1.createNewFile(); + File sample2 =3D new File(temp,"Sample" + (number+1) ); + sample2.createNewFile(); + } +=09 + protected void tearDown() throws Exception { + deleteTree(srcDirectory[0]); + deleteTree(srcDirectory[1]); + super.tearDown(); + } +=09 + protected void deleteTree(File fileRoot) { + if(fileRoot.isFile()){ + fileRoot.delete(); + return; + } else {=20 + File[] files =3D fileRoot.listFiles(); + for (int i =3D 0; i < files.length; i++) { + deleteTree(files[i]); + } + fileRoot.delete(); + } =09 + =09 + } +=09 + public void testSourceFileForName() throws Exception { + HTMLReport report =3D new HTMLReport(); + report.sourceDir =3D srcDirectory; + File sourceFileForName =3D = report.sourceFileForName("com/example/Sample2"); + assertTrue(sourceFileForName.exists()); + assertTrue(sourceFileForName.getCanonicalPath().endsWith("Sample2")); + } +} |
From: Seigel, J. <Jam...@av...> - 2005-05-20 22:49:22
|
I have taken a stab at modifying the code to allow it to support = multiple source directories separated by commas. I haven't added as = many unit tests I would have liked as it was a little challenging at = times to wedge them in. =20 Unfortunately my eclipse template is very different from yours and = unfortunately I fixed some of the todos while I was poking around..... If there are too many changes I can work on isolating them and resubmit = and dot it a bit more cleanly. One note, for calculating the complexity of "all packages" I averaged = the results for each source tree. this might be wrong but easily = changed. anyway have a look Cheers James. Index: src/net/sourceforge/cobertura/reporting/Main.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: = /cvsroot/cobertura/cobertura/src/net/sourceforge/cobertura/reporting/Main= .java,v retrieving revision 1.11 diff -u -r1.11 Main.java --- src/net/sourceforge/cobertura/reporting/Main.java 3 May 2005 = 13:20:02 -0000 1.11 +++ src/net/sourceforge/cobertura/reporting/Main.java 20 May 2005 = 22:41:26 -0000 @@ -26,6 +26,8 @@ import gnu.getopt.LongOpt; =20 import java.io.File; +import java.io.IOException; +import java.util.StringTokenizer; =20 import net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler; import net.sourceforge.cobertura.coveragedata.ProjectData; @@ -34,140 +36,115 @@ =20 import org.apache.log4j.Logger; =20 -public class Main -{ - +public class Main { private static final Logger logger =3D Logger.getLogger(Main.class); =20 - // TODO: make these not static? - static String format =3D "html"; - static File dataFile =3D null; - static File destinationDir =3D null; - static File sourceDir =3D null; - - public static void main(String[] args) throws Exception - { + public static void main(String[] args) throws Exception { + String format =3D "html"; + File dataFile =3D null; + File destinationDir =3D null; + File sourceDir[] =3D null; long startTime =3D System.currentTimeMillis(); =20 LongOpt[] longOpts =3D new LongOpt[4]; // TODO: Allow for multiple destination and multiple source = directories - longOpts[0] =3D new LongOpt("format", LongOpt.REQUIRED_ARGUMENT, = null, - 'f'); - longOpts[1] =3D new LongOpt("datafile", LongOpt.REQUIRED_ARGUMENT, - null, 'd'); - longOpts[2] =3D new LongOpt("destination", LongOpt.REQUIRED_ARGUMENT, - null, 'o'); - longOpts[3] =3D new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, = null, - 's'); + longOpts[0] =3D new LongOpt("format", LongOpt.REQUIRED_ARGUMENT, = null, 'f'); + longOpts[1] =3D new LongOpt("datafile", LongOpt.REQUIRED_ARGUMENT, = null, 'd'); + longOpts[2] =3D new LongOpt("destination", LongOpt.REQUIRED_ARGUMENT, = null, 'o'); + longOpts[3] =3D new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, = null, 's'); =20 - Getopt g =3D new Getopt(Main.class.getName(), args, ":f:d:o:s:", - longOpts); + Getopt g =3D new Getopt(Main.class.getName(), args, ":f:d:o:s:", = longOpts); int c; - while ((c =3D g.getopt()) !=3D -1) - { - switch (c) - { - case 'f': - format =3D g.getOptarg(); - if (!format.equalsIgnoreCase("html") - && !format.equalsIgnoreCase("xml")) - { - System.err - .println("Error: format \"" - + format - + "\" is invalid. Must be either html or xml"); - System.exit(1); - } - break; - - case 'd': - dataFile =3D new File(g.getOptarg()); - if (!dataFile.exists()) - { - System.err.println("Error: data file " - + dataFile.getAbsolutePath() - + " does not exist"); - System.exit(1); - } - if (!dataFile.isFile()) - { - System.err.println("Error: data file " - + dataFile.getAbsolutePath() - + " must be a regular file"); - System.exit(1); - } - break; - - case 'o': - destinationDir =3D new File(g.getOptarg()); - if (destinationDir.exists() - && !destinationDir.isDirectory()) - { - System.err.println("Error: destination directory " - + destinationDir - + " already exists but is not a directory"); - System.exit(1); - } - destinationDir.mkdirs(); - break; - - case 's': - sourceDir =3D new File(g.getOptarg()); - if (!sourceDir.exists()) - { - System.err.println("Error: source directory " - + sourceDir + " does not exist"); - System.exit(1); - } - if (!sourceDir.isDirectory()) - { - System.err.println("Error: source directory " - + sourceDir + " must be a directory"); - System.exit(1); - } - break; + while ((c =3D g.getopt()) !=3D -1) { + switch (c) { + case 'f': + format =3D g.getOptarg(); + if (!format.equalsIgnoreCase("html") && = !format.equalsIgnoreCase("xml")) { + System.err.println("Error: format \"" + format + "\" is invalid. = Must be either html or xml"); + System.exit(1); + } + break; + + case 'd': + dataFile =3D new File(g.getOptarg()); + if (!dataFile.exists()) { + System.err.println("Error: data file " + = dataFile.getAbsolutePath() + " does not exist"); + System.exit(1); + } + if (!dataFile.isFile()) { + System.err.println("Error: data file " + = dataFile.getAbsolutePath() + " must be a regular file"); + System.exit(1); + } + break; + + case 'o': + destinationDir =3D new File(g.getOptarg()); + if (destinationDir.exists() && !destinationDir.isDirectory()) { + System.err.println("Error: destination directory " + = destinationDir + " already exists but is not a directory"); + System.exit(1); + } + destinationDir.mkdirs(); + break; + + case 's': + sourceDir =3D parseSourceDirectory(g.getOptarg()); + break; + } + } + + performCoverage(format, dataFile, destinationDir, sourceDir); + + long stopTime =3D System.currentTimeMillis(); + System.out.println("Reporting time: " + (stopTime - startTime) + = "ms"); + } + + protected static File[] parseSourceDirectory(String = sourceDirectoryString) { + File[] sourceDir; + StringTokenizer stringTokenizer =3D new = StringTokenizer(sourceDirectoryString, ","); + sourceDir =3D new File[stringTokenizer.countTokens()]; + int i =3D 0; + while (stringTokenizer.hasMoreTokens()) { + sourceDir[i] =3D new File(stringTokenizer.nextToken()); + if (!sourceDir[i].exists()) { + System.err.println("Error: source directory " + sourceDir[i] + " = does not exist"); + System.exit(1); } + if (!sourceDir[i].isDirectory()) { + System.err.println("Error: source directory " + sourceDir[i] + " = must be a directory"); + System.exit(1); + } + i++; } + return sourceDir; + } =20 + protected static void performCoverage(String format, File dataFile, = File destinationDir, File[] sourceDir) throws Exception, IOException { if (dataFile =3D=3D null) dataFile =3D CoverageDataFileHandler.getDefaultDataFile(); =20 - if (destinationDir =3D=3D null) - { + if (destinationDir =3D=3D null) { System.err.println("Error: destination directory must be set"); System.exit(1); } =20 - if (sourceDir =3D=3D null) - { + if (sourceDir =3D=3D null) { System.err.println("Error: source directory must be set"); System.exit(1); } =20 - if (logger.isDebugEnabled()) - { + if (logger.isDebugEnabled()) { logger.debug("format is " + format); logger.debug("dataFile is " + dataFile.getAbsolutePath()); - logger.debug("destinationDir is " - + destinationDir.getAbsolutePath()); - logger.debug("sourceDir is " + sourceDir.getAbsolutePath()); + logger.debug("destinationDir is " + = destinationDir.getAbsolutePath()); } =20 - ProjectData projectData =3D CoverageDataFileHandler - .loadCoverageData(dataFile); + ProjectData projectData =3D = CoverageDataFileHandler.loadCoverageData(dataFile); =20 - if (format.equalsIgnoreCase("html")) - { + if (format.equalsIgnoreCase("html")) { new HTMLReport(projectData, destinationDir, sourceDir); - } - else if (format.equalsIgnoreCase("xml")) - { + } else if (format.equalsIgnoreCase("xml")) { new XMLReport(projectData, destinationDir, sourceDir); } - - long stopTime =3D System.currentTimeMillis(); - System.out - .println("Reporting time: " + (stopTime - startTime) + "ms"); } =20 } Index: src/net/sourceforge/cobertura/reporting/html/HTMLReport.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: = /cvsroot/cobertura/cobertura/src/net/sourceforge/cobertura/reporting/html= /HTMLReport.java,v retrieving revision 1.15 diff -u -r1.15 HTMLReport.java --- src/net/sourceforge/cobertura/reporting/html/HTMLReport.java 18 May = 2005 05:26:20 -0000 1.15 +++ src/net/sourceforge/cobertura/reporting/html/HTMLReport.java 20 May = 2005 22:41:27 -0000 @@ -52,14 +52,14 @@ =20 private File destinationDir; =20 - private File sourceDir; + File sourceDir[]; =20 private ProjectData projectData; =20 /** * Create a coverage report */ - public HTMLReport(ProjectData projectData, File outputDir, File = sourceDir) + public HTMLReport(ProjectData projectData, File outputDir, File[] = sourceDir) throws Exception { this.destinationDir =3D outputDir; @@ -73,6 +73,9 @@ generateSourceFiles(); } =20 + protected HTMLReport() { + } + private String generatePackageName(PackageData packageData) { if (packageData.getName().equals("")) @@ -301,15 +304,10 @@ } =20 // Output a line for each package or subpackage - // TODO: Do we need this extra "package.size() > 0" check? - if (packages.size() > 0) - { - Iterator iter =3D packages.iterator(); - while (iter.hasNext()) - { - PackageData subPackageData =3D (PackageData)iter.next(); - out.println(generateTableRowForPackage(subPackageData)); - } + Iterator iter =3D packages.iterator(); + while (iter.hasNext()) { + PackageData subPackageData =3D (PackageData) iter.next(); + out.println(generateTableRowForPackage(subPackageData)); } =20 out.println("</tbody>"); @@ -328,9 +326,7 @@ if (packageData =3D=3D null) { classes =3D new TreeSet(); - if (projectData.getNumberOfClasses() > 0) - { - Iterator iter =3D projectData.getClasses().iterator(); + iter =3D projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData =3D (ClassData)iter.next(); @@ -339,7 +335,6 @@ classes.add(classData); } } - } } else { @@ -353,11 +348,10 @@ out.println("<table class=3D\"report\" id=3D\"classResults\">"); out.println(generateTableHeaderForClasses()); out.println("<tbody>"); - - Iterator iter =3D classes.iterator(); - while (iter.hasNext()) - { - ClassData classData =3D (ClassData)iter.next(); + =09 + iter =3D classes.iterator(); + while (iter.hasNext()) { + ClassData classData =3D (ClassData) iter.next(); out.println(generateTableRowForClass(classData)); } =20 @@ -451,8 +445,7 @@ BufferedReader br =3D null; try { - File sourceFile =3D new File(sourceDir, classData - .getSourceFileName()); + File sourceFile =3D = sourceFileForName(classData.getSourceFileName()); br =3D new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml =3D new JavaToHtml(); @@ -527,6 +520,16 @@ } } =20 + protected File sourceFileForName(String sourceFileName) { + File file =3D null; + for (int i =3D 0; i < sourceDir.length; i++) { + file =3D new File(sourceDir[i], sourceFileName); + if (file.exists()) + return file; + } + return file; + } + private static String generateHelpURL(String text, String description) { StringBuffer ret =3D new StringBuffer(); @@ -627,7 +630,7 @@ StringBuffer ret =3D new StringBuffer(); double lineCoverage =3D projectData.getLineCoverageRate(); double branchCoverage =3D projectData.getBranchCoverageRate(); - double ccn =3D Util.getCCN(sourceDir, true); + double ccn =3D averageCCN(); ret.append(" <tr>"); ret.append("<td class=3D\"text\"><b>All Packages</b></td>"); ret.append("<td class=3D\"value\">" + = projectData.getNumberOfClasses() @@ -638,15 +641,22 @@ return ret.toString(); } =20 - private String generateTableRowForPackage(PackageData packageData) + private double averageCCN() { + double accumulator =3D 0; + for (int i =3D 0; i < sourceDir.length; i++) { + accumulator +=3D Util.getCCN(sourceDir[i], true); + } + return accumulator/sourceDir.length; + } + + protected String generateTableRowForPackage(PackageData packageData) { StringBuffer ret =3D new StringBuffer(); String url1 =3D "frame-summary-" + packageData.getName() + ".html"; String url2 =3D "frame-classes-" + packageData.getName() + ".html"; double lineCoverage =3D packageData.getLineCoverageRate(); double branchCoverage =3D packageData.getBranchCoverageRate(); - double ccn =3D Util.getCCN(new File(sourceDir, packageData - .getSourceFileName()), false); + double ccn =3D = Util.getCCN(sourceFileForName(packageData.getSourceFileName()), false); ret.append(" <tr>"); ret.append("<td class=3D\"text\"><a href=3D\"" + url1 + "\" onClick=3D'parent.classList.location.href=3D\"" + url2 @@ -664,8 +674,7 @@ StringBuffer ret =3D new StringBuffer(); double lineCoverage =3D classData.getLineCoverageRate(); double branchCoverage =3D classData.getBranchCoverageRate(); - double ccn =3D Util.getCCN(new File(sourceDir, classData - .getSourceFileName()), false); + double ccn =3D = Util.getCCN(sourceFileForName(classData.getSourceFileName()), false); ret.append(" <tr>"); ret.append("<td class=3D\"text\"><a href=3D\"" + classData.getName() + ".html\">" + classData.getName() + "</a></td>"); Index: src/net/sourceforge/cobertura/reporting/xml/XMLReport.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: = /cvsroot/cobertura/cobertura/src/net/sourceforge/cobertura/reporting/xml/= XMLReport.java,v retrieving revision 1.19 diff -u -r1.19 XMLReport.java --- src/net/sourceforge/cobertura/reporting/xml/XMLReport.java 29 Apr = 2005 20:06:53 -0000 1.19 +++ src/net/sourceforge/cobertura/reporting/xml/XMLReport.java 20 May = 2005 22:41:27 -0000 @@ -50,10 +50,10 @@ =20 private int indent =3D 0; =20 - private File sourceDirectory; + private File sourceDirectory[]; =20 public XMLReport(ProjectData projectData, File destinationDir, - File sourceDirectory) throws IOException + File[] sourceDirectory) throws IOException { this.sourceDirectory =3D sourceDirectory; =20 @@ -133,8 +133,7 @@ { logger.debug("Dumping package " + packageData.getName()); =20 - double ccn =3D Util.getCCN(new File(sourceDirectory, packageData - .getSourceFileName()), false); + double ccn =3D Util.getCCN(sourceFileForName( = packageData.getSourceFileName()), false); println("<package name=3D\"" + packageData.getName() + "\" line-rate=3D\"" + packageData.getLineCoverageRate() + "\" branch-rate=3D\"" + packageData.getBranchCoverageRate() @@ -164,8 +163,7 @@ { logger.debug("Dumping class " + classData.getName()); =20 - double ccn =3D Util.getCCN(new File(sourceDirectory, classData - .getSourceFileName()), false); + double ccn =3D = Util.getCCN(sourceFileForName(classData.getSourceFileName()), false); println("<class name=3D\"" + classData.getName() + "\" filename=3D\"" + classData.getSourceFileName() + "\" line-rate=3D\"" + classData.getLineCoverageRate() + "\" branch-rate=3D\"" @@ -180,6 +178,16 @@ println("</class>"); } =20 + protected File sourceFileForName(String sourceFileName) { + File file =3D null; + for (int i =3D 0; i < sourceDirectory.length; i++) { + file =3D new File(sourceDirectory[i], sourceFileName); + if (file.exists()) + return file; + } + return file; + } + private void dumpMethods(ClassData classData) { println("<methods>"); Index: test/net/sourceforge/cobertura/reporting/MainTest.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: test/net/sourceforge/cobertura/reporting/MainTest.java diff -N test/net/sourceforge/cobertura/reporting/MainTest.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ test/net/sourceforge/cobertura/reporting/MainTest.java 1 Jan 1970 = 00:00:00 -0000 @@ -0,0 +1,34 @@ +package net.sourceforge.cobertura.reporting; + +import java.io.File; +import java.io.IOException; + +import junit.framework.TestCase; + +public class MainTest extends TestCase { +=09 + private File srcDirectory1; + private File srcDirectory2; + + protected void setUp() throws Exception { + super.setUp(); + File file =3D File.createTempFile("test", ".tmp"); + file.deleteOnExit(); + srcDirectory1 =3D new File(file.getParent(),"src1"); + srcDirectory1.mkdir(); + srcDirectory2 =3D new File(file.getParent(),"src2"); + srcDirectory2.mkdir(); + } + + protected void tearDown() throws Exception { + srcDirectory1.delete(); + srcDirectory2.delete(); + super.tearDown(); + } + + public void testParseSourceDirectory() throws Exception { + File[] files =3D = Main.parseSourceDirectory(srcDirectory1.getCanonicalPath()+","+srcDirecto= ry2.getCanonicalPath()); + assertEquals(2, files.length); + } + +} Index: test/net/sourceforge/cobertura/reporting/html/HTMLReportTest.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: = test/net/sourceforge/cobertura/reporting/html/HTMLReportTest.java diff -N = test/net/sourceforge/cobertura/reporting/html/HTMLReportTest.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ test/net/sourceforge/cobertura/reporting/html/HTMLReportTest.java 1 = Jan 1970 00:00:00 -0000 @@ -0,0 +1,63 @@ +package net.sourceforge.cobertura.reporting.html; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import junit.framework.TestCase; + +public class HTMLReportTest extends TestCase { +=09 + private File[] srcDirectory; + + protected void setUp() throws Exception { + super.setUp(); + File tempFile =3D File.createTempFile("temp", ".tmp"); + tempFile.deleteOnExit(); + srcDirectory =3D new File[2]; + srcDirectory[1] =3D new File(tempFile.getParent(),"src1"); + srcDirectory[1].mkdir(); + filesUnderSourceDir(srcDirectory[1],1); + srcDirectory[0] =3D new File(tempFile.getParent(),"src0"); + srcDirectory[0].mkdir(); + filesUnderSourceDir(srcDirectory[0],2); + } + + private void filesUnderSourceDir(File srcDirectory, int number) throws = IOException, FileNotFoundException { + File sub =3D new File(srcDirectory,"com"); + sub.mkdir(); + File temp =3D new File(sub,"example"); + temp.mkdir(); + File sample1 =3D new File(temp,"Sample"+number); + sample1.createNewFile(); + File sample2 =3D new File(temp,"Sample" + (number+1) ); + sample2.createNewFile(); + } +=09 + protected void tearDown() throws Exception { + deleteTree(srcDirectory[0]); + deleteTree(srcDirectory[1]); + super.tearDown(); + } +=09 + protected void deleteTree(File fileRoot) { + if(fileRoot.isFile()){ + fileRoot.delete(); + return; + } else {=20 + File[] files =3D fileRoot.listFiles(); + for (int i =3D 0; i < files.length; i++) { + deleteTree(files[i]); + } + fileRoot.delete(); + } =09 + =09 + } +=09 + public void testSourceFileForName() throws Exception { + HTMLReport report =3D new HTMLReport(); + report.sourceDir =3D srcDirectory; + File sourceFileForName =3D = report.sourceFileForName("com/example/Sample2"); + assertTrue(sourceFileForName.exists()); + assertTrue(sourceFileForName.getCanonicalPath().endsWith("Sample2")); + } +} |
From: Mark D. <Mar...@sa...> - 2005-05-20 20:31:41
|
Cobertura skips over interfaces and possibly other classes (maybe if the = class does not contain debugging information). If you specify a = directory when running coberutra-instrument, it is not guarranteed that = this directory will contain ALL the classes from your build directory. =20 This is intentional, but it may change in the future. =20 For now, there are two things you can do: 1. Don't specify an output directory and let cobertura overwrite the = original class files with the instrumented versions (I don't remember if = this works with Cobertura 1.2, but it should work with 1.3). 2. Specify both the directory containing the instrumented classes and = the directory containing the original classes in your classpath. If a = class appears in your classpath twice, most classloaders will load the = first one it comes to and ignore any subsequent ones. =20 Hope that helps, Mark =20 ________________________________ From: cob...@li... = [mailto:cob...@li...] On Behalf Of = Gossard, Ann L. Sent: Friday, May 20, 2005 4:18 PM To: cob...@li... Subject: [Cobertura-devel] Question =09 =09 I seem to be short three files. I was trying to instrument by source = code and [cobertura-instrument] dropped three classes. The execution of = my junit tests halted because of the missing classes. Can you give me an = idea how I can get around this? Or what is happening? I have a large = application written in Java 1.5, with over 700 junit test cases. Thanks,=20 Ann Gossard=20 Ann...@jh...=20 |
From: Gossard, A. L. <Ann...@jh...> - 2005-05-20 20:18:28
|
I seem to be short three files. I was trying to instrument by source code and [cobertura-instrument] dropped three classes. The execution of my junit tests halted because of the missing classes. Can you give me an idea how I can get around this? Or what is happening? I have a large application written in Java 1.5, with over 700 junit test cases. Thanks, Ann Gossard Ann...@jh... |
From: Mark D. <ma...@ki...> - 2005-05-20 12:30:04
|
Yes, I switched it back to Jakarta ORO in an attempt to support Java 1.3. But I never quite finished with that. -Mark On Fri, 20 May 2005 06:20:42 -0500, Czechowski, Igor wrote > That's great, but does it mean that cobertura uses Jakarta ORO again > ? The source code I pulled out yesterday contains references to Jakarta > ORO and in the ChangeLog for 1.2 there's a statement indicating > references to ORO have been removed. > > Thanks > Igor > > -----Original Message----- > From: Mark Doliner [mailto:Mar...@sa...] > Sent: Thursday, May 19, 2005 8:58 PM > To: Czechowski, Igor; cob...@li... > Subject: RE: [Cobertura-devel] Source code in the repository > > The code in CVS is current development code, and is newer than 1.2. > When we release 1.3 (hopefully late tonight) it will be a snapshot of > CVS. > -Mark > > > -----Original Message----- > > From: cob...@li... > > [mailto:cob...@li...] On > > Behalf Of Czechowski, Igor > > Sent: Thursday, May 19, 2005 11:35 AM > > To: cob...@li... > > Subject: [Cobertura-devel] Source code in the repository > > > > Hello, > > > > I've pulled a source code out of the > > cvs.sourceforge.net:/cvsroot/cobertura and it looks different then the > > one I can find in the 1.2 release ? > > Does any one knows why and can I expect the newer code will be in the > > repository ? > > > > Thanks > > Igor |
From: Czechowski, I. <Igo...@sa...> - 2005-05-20 11:20:55
|
That's great, but does it mean that cobertura uses Jakarta ORO again ? The source code I pulled out yesterday contains references to Jakarta ORO and in the ChangeLog for 1.2 there's a statement indicating references to ORO have been removed. Thanks Igor -----Original Message----- From: Mark Doliner [mailto:Mar...@sa...]=20 Sent: Thursday, May 19, 2005 8:58 PM To: Czechowski, Igor; cob...@li... Subject: RE: [Cobertura-devel] Source code in the repository The code in CVS is current development code, and is newer than 1.2. When we release 1.3 (hopefully late tonight) it will be a snapshot of CVS. -Mark =20 > -----Original Message----- > From: cob...@li...=20 > [mailto:cob...@li...] On=20 > Behalf Of Czechowski, Igor > Sent: Thursday, May 19, 2005 11:35 AM > To: cob...@li... > Subject: [Cobertura-devel] Source code in the repository >=20 > Hello, >=20 > I've pulled a source code out of the > cvs.sourceforge.net:/cvsroot/cobertura and it looks different then the > one I can find in the 1.2 release ? > Does any one knows why and can I expect the newer code will be in the > repository ? >=20 > Thanks > Igor |
From: Czechowski, I. <Igo...@sa...> - 2005-05-20 10:56:07
|
Hello. See my comments bellow.=20 >> So the scenario would be to produce the entire html report=20 >> and only the >> package overview of the xml one. Then I would use transformation to >> produce the html page for the cruisecontrol. I can merge the existing >> xml report but I thing it's a little bit over reporting for me at the >> current state. >Hmm. I guess you could accomplish something along these lines by generating the XML report then merging it into the >CruiseControl build log (the same way Junit XML is merged). Then you would need to add an xsl transform for displaying >a coverage summary to the CruiseControl build results page. >-Mark Yes, you are right. I can achieve the goal by merging the cobertura log with cruisecontrol one, but the log then contains too much data for the report I need. Ideally I would see the report task too have the level attribute and the format to be a nested tag of a report one. The level could have values like: all, package, class. all - would produce the entire report (default) package - would produce the report for packages only class - would produce the report for packages and classes without information about each source file=20 <cobertura-report destdir=3D"${coveragereport.dir}" = srcdir=3D"${src.dir}" > <format type=3D"html" level=3D"all" /> <format type=3D"xml" level=3D"package" /> </cobertura-report> Thanks Igor |
From: Mark D. <ma...@ki...> - 2005-05-20 03:08:10
|
On Thu, 19 May 2005 21:54:26 -0500, Jeremy Ryan Thomerson wrote > I believe so. I think you can close that bug in Tracker. So, > you're doing to do release 1.3 tonight, correct? Yep. > Assuming we release tonight, over the weekend I'll aggregate the > open bugs / feature requests into an email and estimation of how > long each will take to accomplish. Then I'll email it out to > everyone early next week, and we can all collaborate on what pieces > we can take, and when we think we can have them done. This way we > can propose a date for the next release and post it on the site. I've created 2 HTML pages documenting some of the ant and command line syntax. I'll try to remember to close those feature requests after I put those online. > I for one would like to thank Mark for all the work he did to get > this project going and continue improving it. Mark, it's great! > And I really enjoy being a part of it. I think from all the emails > we've received, everyone that's tried it likes it, and I think with > some of the stuff we have coming up on the radar, it will continue > to improve and gain traction. Thanks :-) And I agree, I like seeing all the emails. > Jeremy > > ----- Original Message ----- > From: "Mark Doliner" <ma...@ki...> > To: "Jody Brownell" <jod...@Q1...>; > <cob...@li...> > Sent: Thursday, May 19, 2005 9:19 PM > Subject: Re: [Cobertura-devel] How can I get involved.... > > > Ok, I guess I'm coming around to yous guyses way of thinking. Jeremy's > change > > does a good job of doing what it does. We'll leave it as-is. So the > issue > > with inner classes not being reported is now completely resolved, correct? > > -Mark |
From: Jeremy R. T. <je...@th...> - 2005-05-20 02:54:34
|
I believe so. I think you can close that bug in Tracker. So, you're doing to do release 1.3 tonight, correct? Assuming we release tonight, over the weekend I'll aggregate the open bugs / feature requests into an email and estimation of how long each will take to accomplish. Then I'll email it out to everyone early next week, and we can all collaborate on what pieces we can take, and when we think we can have them done. This way we can propose a date for the next release and post it on the site. I for one would like to thank Mark for all the work he did to get this project going and continue improving it. Mark, it's great! And I really enjoy being a part of it. I think from all the emails we've received, everyone that's tried it likes it, and I think with some of the stuff we have coming up on the radar, it will continue to improve and gain traction. Jeremy ----- Original Message ----- From: "Mark Doliner" <ma...@ki...> To: "Jody Brownell" <jod...@Q1...>; <cob...@li...> Sent: Thursday, May 19, 2005 9:19 PM Subject: Re: [Cobertura-devel] How can I get involved.... > Ok, I guess I'm coming around to yous guyses way of thinking. Jeremy's change > does a good job of doing what it does. We'll leave it as-is. So the issue > with inner classes not being reported is now completely resolved, correct? > -Mark > > On Thu, 19 May 2005 15:00:54 -0500, Jeremy Ryan Thomerson wrote > > In thinking it over since I talked to Mark yesterday, I'd agree. I don't > > think it makes sense to separate the reporting of the inner classes from > > their parent in the XML any more than it does in the HTML. To > > answer my question, I asked myself: "Would I ever want to look in a > > report and find out just the coverage on an inner (or even anonymous) > > class and not see the coverage of its' respective top-level class?" > > My answer was no. > > > > But, I can change the patch I committed to allow for this if there > > is a consensus otherwise. (and if told early enough, I could get it > > in before a late night release most likely.) > > > > Jeremy > > > > ----- Original Message ----- > > From: "Jody Brownell" <jod...@Q1...> > > To: "Mark Doliner" <Mar...@sa...>; "Jeremy Thomerson" > > <je...@th...> > > Cc: <cob...@li...> > > Sent: Thursday, May 19, 2005 2:56 PM > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > I think it makes sense to have the inner classes reported within the > > parent XML.... that is where I would expect to find it anyway. > > > > -----Original Message----- > > From: Mark Doliner [mailto:Mar...@sa...] > > Sent: Thursday, May 19, 2005 4:54 PM > > To: Jeremy Thomerson; Jody Brownell > > Cc: cob...@li...; Adam Morgan > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > I talked to Jeremy for a few minutes about this yesterday. I guess > > we kind of decided that the fix is an improvement from what it was. > > After his patch, Cobertura lumps all inner classes with their > > parents. So the HTML reports show everything on one page, but the > > XML reports no longer distinguish between inner classes and their parent. > > > > I still think that ideally, inner classes would be listed independently > > of their parent class in the xml reports. What do other people think? > > > > -Mark > > > > > -----Original Message----- > > > From: Jeremy Thomerson [mailto:je...@th...] > > > Sent: Wednesday, May 18, 2005 3:34 AM > > > To: Mark Doliner; Jody Brownell > > > Cc: cob...@li...; Adam Morgan > > > Subject: Re: [Cobertura-devel] How can I get involved.... > > > > > > I just committed the necessary changes to accomodate "coverage for the > > > classes HelloWorld and HelloWorld$1 would both appear on the same HTML > > > page". > > > > > > It also removed the map of classes maintained in ProjectData > > > since we're > > > already maintaining all of our classes in individual > > > PackageData instances. > > > Granted, it would've been handy to continue hanging on to ClassData > > > instances in ProjectData, but it would have required copy and > > > paste logic > > > from PackageData determining how to aggregrate data from > > > inner classes into > > > its parent class. I really hate copy and paste wcode, so I > > > refactored it to > > > avoid needing it. However, I think the better way to > > > refactor this in the > > > future is have an object whose job it is to hold on to > > > multiple ClassData > > > instances, and it can be the only place that contains the aggregration > > > logic. Maybe? > > > > > > It's late enough for now. Hope this was what you were > > > looking for Mark. > > > Let me know if it's not. I can back out my changes. > > > > > > Jeremy Thomerson > > > eBay > > > > > > ----- Original Message ----- > > > From: "Mark Doliner" <Mar...@sa...> > > > To: "Jeremy Ryan Thomerson" <je...@th...>; > > > "Jody Brownell" > > > <jod...@Q1...> > > > Cc: <cob...@li...>; "Adam Morgan" > > > <ada...@Q1...> > > > Sent: Tuesday, May 17, 2005 1:10 PM > > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > > > > No, but how about Thursday? > > > > > > I was hoping to get the inner-class thing resolved before > > > releasing 1.3, but > > > I think I would rather release it as-in and then make changes later. > > > > > > What's wrong with inner-classes, you ask? > > > In 1.2 the HTML reports ignored inner-classes, and did not > > > show them as > > > covered/not covered. > > > In CVS the HTML reports show coverage for inner-classes, but > > > they appear in > > > a separate HTML page instead of being nestled in with their > > > parent, like a > > > happy baby bird. > > > Ideally, the coverage for the classes HelloWorld and > > > HelloWorld$1 would both > > > appear on the same HTML page. > > > > > > In summary, CVS handles this better than 1.2 did, but it's still not > > > perfect. However, if people agree that it's better to release now and > > > improve it later, then let's do that. > > > > > > -Mark > > > > > > > -----Original Message----- > > > > From: Jeremy Ryan Thomerson [mailto:je...@th...] > > > > Sent: Tuesday, May 17, 2005 4:03 PM > > > > To: Mark Doliner; Jody Brownell > > > > Cc: cob...@li...; Adam Morgan > > > > Subject: Re: [Cobertura-devel] How can I get involved.... > > > > > > > > Do we have a proposed release date for 1.3? It seems like we > > > > have some > > > > pretty significant changes that are awaiting a release. > > > > > > > > Jeremy Thomerson > > > > > > > > ----- Original Message ----- > > > > From: "Mark Doliner" <Mar...@sa...> > > > > To: "Jody Brownell" <jod...@Q1...> > > > > Cc: <cob...@li...>; "Adam Morgan" > > > > <ada...@Q1...> > > > > Sent: Tuesday, May 17, 2005 2:57 PM > > > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > > > > > > > No, there are no major changes happening in HEAD right now. > > > > However, the > > > > changes between 1.2 and HEAD are pretty big--I definitely > > > > suggest developing > > > > against CVS HEAD rather than 1.2. > > > > -Mark > > > > > > > > > -----Original Message----- > > > > > From: Jody Brownell [mailto:jod...@Q1...] > > > > > Sent: Tuesday, May 17, 2005 3:55 PM > > > > > To: Mark Doliner > > > > > Cc: cob...@li...; Adam Morgan > > > > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > > > > > Agreed... Plan is to make it part of cobertura - assuming you > > > > > accept the > > > > > patches etc :) I have to get few a number of items at work, > > > > > then I will > > > > > start. > > > > > > > > > > I will be in touch shortly. > > > > > > > > > > BTW - is there anything major happening now on HEAD in cvs? > > > > > > > > > > -----Original Message----- > > > > > From: Mark Doliner [mailto:Mar...@sa...] > > > > > Sent: Tuesday, May 17, 2005 4:41 PM > > > > > To: Jody Brownell > > > > > Cc: cob...@li...; Adam Morgan > > > > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > > > > > It sounds like you have a good idea of what you want to do. > > > > > I would be > > > > > careful to try to keep the data harvesting and the report > > > generation > > > > > reasonably separate from each other. Why? Because > > > > historical "change > > > > > in coverage over time" graphs would be really cool, and I > > > think it's > > > > > something that could be an impressive addition to Cobertura. > > > > > If it WAS > > > > > made a part of Cobertura, it seems likely that the data > > > > > harvesting parts > > > > > of your code would need lots of changes, but hopefully the report > > > > > generation stuff could remain largely unchanged. > > > > > > > > > > -Mark > > > > > > > > > > > -----Original Message----- > > > > > > From: Jody Brownell [mailto:jod...@Q1...] > > > > > > Sent: Friday, May 13, 2005 6:56 AM > > > > > > To: Mark Doliner > > > > > > Cc: cob...@li...; Adam Morgan > > > > > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > > > > > > > Sure does - thanks. > > > > > > > > > > > > My first thoughts were - this could be an addon > > > > > package/application of > > > > > > sorts which can use your .ser file or the XML reports (once > > > > > > successfully > > > > > > completed). I would prefer to not touch your guys code at all if > > > > > > possible and just piggy back on what you have - make > > > > enhancements if > > > > > > required. > > > > > > > > > > > > This implies that, the way users run cobertura now would > > > > > not change at > > > > > > all - providing a single user mode of sorts. Then the new > > > > additional > > > > > > task (ant?) could be run to export that data to a central or non > > > > > > volatile data store. (Data store could be RDBMS, flat file or > > > > > > what have > > > > > > you - makes no difference to me - as long as simple and fast). > > > > > > > > > > > > Key things for me are, it needs to be extremely simple to > > > > > install and > > > > > > maintain. No over complicated configuration etc - keep it as > > > > > > it is today > > > > > > as much as possible. > > > > > > > > > > > > Agree about the UI - has to be clean, intuitive, simple > > > and fast. > > > > > > > > > > > > - Be nice to view reports on product? / project / package / > > > > > > class / ... > > > > > > hierarchy - as you navigate through the hierarchy - > > > > > > graph/plot for where > > > > > > you are > > > > > > - plotting lines of code / coverage over time (Jfreechart has > > > > > > some great > > > > > > plots) > > > > > > - Need to identify and ensure we have the right data in the > > > > > > datastore. A > > > > > > few reports which come to mind are > > > > > > - plain coverage stats > > > > > > - plain coverage stats plotted against lines of code > > > > > > - coverage stats of one project/package/class plotted > > > > against the > > > > > > baseline coverage of all projects (how does this > > > > > project/package/class > > > > > > compare to the running average) ( more advanced :)) > > > > > > > > > > > > For now - I will focus on keeping it simple with two > > > > additional ant > > > > > > tasks, one for exporting/updating to non volatile > > > > > datastore, the other > > > > > > for generating reports from that data. I will put together a > > > > > > more formal > > > > > > list of features / requirements over the next few days. > > > > > > > > > > > > Thoughts? > > > > > > > > > > > > -----Original Message----- > > > > > > From: Mark Doliner [mailto:Mar...@sa...] > > > > > > Sent: Tuesday, May 10, 2005 12:03 PM > > > > > > To: Jody Brownell > > > > > > Cc: cob...@li... > > > > > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > > > > > > > *snip* > > > > > > > > > > > > > Anywho - the purpose of this email is to see how I can get > > > > > > > involved. One > > > > > > > gap in the product which I noticed (and may already be > > > > planned) is > > > > > > > coverage statistics over time. I was thinking, unless > > > this is on > > > > > > > someone's plate already I could start to get familiar with > > > > > > > the code base > > > > > > > and put together a plan of attack - an impact of sorts - and > > > > > > > propose to > > > > > > > you all. > > > > > > > > > > > > *snip* > > > > > > > > > > > > > Please let me know if this is of interest. BTW - what is > > > > > the typical > > > > > > > process of getting involved? Hope I am not jumping the gun. > > > > > > > > > > > > You're not jumping the gun at all. I suppose the typical > > > > process of > > > > > > getting involved is to find something you're interested in > > > > > > fixing/improving/adding and writing a patch for it. I > > > > don't know of > > > > > > anyone working on statistics over time. And it's > > > > > definitely something > > > > > > that would be nice to have. You would definitely want to > > > > > > work with CVS, > > > > > > if you plan on making any changes. Some of the stuff I > > > > > mention below > > > > > > applies to CVS but not to the last release. > > > > > > > > > > > > I guess the easy way to do it would be to name the XML > > > > > > reports based on > > > > > > the date and time they were created, and then you could parse a > > > > > > directory of these files and determine the change over > > > time. This > > > > > > wouldn't even need to be a part of Cobertura--it could be a > > > > > completely > > > > > > separate program. Or maybe instead of reading the data > > > > from the XML > > > > > > reports, you could read it directly from cobertura.ser files. > > > > > > (The ser > > > > > > file contains basically the same information as the XML > > > > > reports. The > > > > > > ser file contains serialized classes from the package > > > > > > net.sourceforge.cobertura.coveragedata. If you choose to go > > > > > > this route, > > > > > > you would need to use these classes to read the > > > serialized file.) > > > > > > > > > > > > However, it might be better to modify the classes in the > > > > > coveragedata > > > > > > package to natively support a time and date. I'm not > > > > sure how this > > > > > > would work exactly. Maybe you could tag the information in > > > > > > the ser file > > > > > > with a datestamp and then zero it out before running the > > > > > next batch of > > > > > > tests. > > > > > > > > > > > > I think it is important that this have a good user interface. > > > > > > How would > > > > > > the statistics be displayed? As a line graph, maybe? > > > > How would the > > > > > > user tell Cobertura to create these reports? Would > > > they specify a > > > > > > "start date" and "end date"? Would the report have a > > > > > separate display > > > > > > for each package? For each class? Would it have a way to show > > > > > > differences in the source files? > > > > > > > > > > > > Does that help you, any? > > > > > > > > > > > > -Mark > > > > ------------------------------------------------------- > This SF.Net email is sponsored by Oracle Space Sweepstakes > Want to be the first software developer in space? > Enter now for the Oracle Space Sweepstakes! > http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click > _______________________________________________ > Cobertura-devel mailing list > Cob...@li... > https://lists.sourceforge.net/lists/listinfo/cobertura-devel |
From: Mark D. <ma...@ki...> - 2005-05-20 02:17:19
|
Ok, I guess I'm coming around to yous guyses way of thinking. Jeremy's change does a good job of doing what it does. We'll leave it as-is. So the issue with inner classes not being reported is now completely resolved, correct? -Mark On Thu, 19 May 2005 15:00:54 -0500, Jeremy Ryan Thomerson wrote > In thinking it over since I talked to Mark yesterday, I'd agree. I don't > think it makes sense to separate the reporting of the inner classes from > their parent in the XML any more than it does in the HTML. To > answer my question, I asked myself: "Would I ever want to look in a > report and find out just the coverage on an inner (or even anonymous) > class and not see the coverage of its' respective top-level class?" > My answer was no. > > But, I can change the patch I committed to allow for this if there > is a consensus otherwise. (and if told early enough, I could get it > in before a late night release most likely.) > > Jeremy > > ----- Original Message ----- > From: "Jody Brownell" <jod...@Q1...> > To: "Mark Doliner" <Mar...@sa...>; "Jeremy Thomerson" > <je...@th...> > Cc: <cob...@li...> > Sent: Thursday, May 19, 2005 2:56 PM > Subject: RE: [Cobertura-devel] How can I get involved.... > > I think it makes sense to have the inner classes reported within the > parent XML.... that is where I would expect to find it anyway. > > -----Original Message----- > From: Mark Doliner [mailto:Mar...@sa...] > Sent: Thursday, May 19, 2005 4:54 PM > To: Jeremy Thomerson; Jody Brownell > Cc: cob...@li...; Adam Morgan > Subject: RE: [Cobertura-devel] How can I get involved.... > > I talked to Jeremy for a few minutes about this yesterday. I guess > we kind of decided that the fix is an improvement from what it was. > After his patch, Cobertura lumps all inner classes with their > parents. So the HTML reports show everything on one page, but the > XML reports no longer distinguish between inner classes and their parent. > > I still think that ideally, inner classes would be listed independently > of their parent class in the xml reports. What do other people think? > > -Mark > > > -----Original Message----- > > From: Jeremy Thomerson [mailto:je...@th...] > > Sent: Wednesday, May 18, 2005 3:34 AM > > To: Mark Doliner; Jody Brownell > > Cc: cob...@li...; Adam Morgan > > Subject: Re: [Cobertura-devel] How can I get involved.... > > > > I just committed the necessary changes to accomodate "coverage for the > > classes HelloWorld and HelloWorld$1 would both appear on the same HTML > > page". > > > > It also removed the map of classes maintained in ProjectData > > since we're > > already maintaining all of our classes in individual > > PackageData instances. > > Granted, it would've been handy to continue hanging on to ClassData > > instances in ProjectData, but it would have required copy and > > paste logic > > from PackageData determining how to aggregrate data from > > inner classes into > > its parent class. I really hate copy and paste wcode, so I > > refactored it to > > avoid needing it. However, I think the better way to > > refactor this in the > > future is have an object whose job it is to hold on to > > multiple ClassData > > instances, and it can be the only place that contains the aggregration > > logic. Maybe? > > > > It's late enough for now. Hope this was what you were > > looking for Mark. > > Let me know if it's not. I can back out my changes. > > > > Jeremy Thomerson > > eBay > > > > ----- Original Message ----- > > From: "Mark Doliner" <Mar...@sa...> > > To: "Jeremy Ryan Thomerson" <je...@th...>; > > "Jody Brownell" > > <jod...@Q1...> > > Cc: <cob...@li...>; "Adam Morgan" > > <ada...@Q1...> > > Sent: Tuesday, May 17, 2005 1:10 PM > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > No, but how about Thursday? > > > > I was hoping to get the inner-class thing resolved before > > releasing 1.3, but > > I think I would rather release it as-in and then make changes later. > > > > What's wrong with inner-classes, you ask? > > In 1.2 the HTML reports ignored inner-classes, and did not > > show them as > > covered/not covered. > > In CVS the HTML reports show coverage for inner-classes, but > > they appear in > > a separate HTML page instead of being nestled in with their > > parent, like a > > happy baby bird. > > Ideally, the coverage for the classes HelloWorld and > > HelloWorld$1 would both > > appear on the same HTML page. > > > > In summary, CVS handles this better than 1.2 did, but it's still not > > perfect. However, if people agree that it's better to release now and > > improve it later, then let's do that. > > > > -Mark > > > > > -----Original Message----- > > > From: Jeremy Ryan Thomerson [mailto:je...@th...] > > > Sent: Tuesday, May 17, 2005 4:03 PM > > > To: Mark Doliner; Jody Brownell > > > Cc: cob...@li...; Adam Morgan > > > Subject: Re: [Cobertura-devel] How can I get involved.... > > > > > > Do we have a proposed release date for 1.3? It seems like we > > > have some > > > pretty significant changes that are awaiting a release. > > > > > > Jeremy Thomerson > > > > > > ----- Original Message ----- > > > From: "Mark Doliner" <Mar...@sa...> > > > To: "Jody Brownell" <jod...@Q1...> > > > Cc: <cob...@li...>; "Adam Morgan" > > > <ada...@Q1...> > > > Sent: Tuesday, May 17, 2005 2:57 PM > > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > > > > No, there are no major changes happening in HEAD right now. > > > However, the > > > changes between 1.2 and HEAD are pretty big--I definitely > > > suggest developing > > > against CVS HEAD rather than 1.2. > > > -Mark > > > > > > > -----Original Message----- > > > > From: Jody Brownell [mailto:jod...@Q1...] > > > > Sent: Tuesday, May 17, 2005 3:55 PM > > > > To: Mark Doliner > > > > Cc: cob...@li...; Adam Morgan > > > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > > > Agreed... Plan is to make it part of cobertura - assuming you > > > > accept the > > > > patches etc :) I have to get few a number of items at work, > > > > then I will > > > > start. > > > > > > > > I will be in touch shortly. > > > > > > > > BTW - is there anything major happening now on HEAD in cvs? > > > > > > > > -----Original Message----- > > > > From: Mark Doliner [mailto:Mar...@sa...] > > > > Sent: Tuesday, May 17, 2005 4:41 PM > > > > To: Jody Brownell > > > > Cc: cob...@li...; Adam Morgan > > > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > > > It sounds like you have a good idea of what you want to do. > > > > I would be > > > > careful to try to keep the data harvesting and the report > > generation > > > > reasonably separate from each other. Why? Because > > > historical "change > > > > in coverage over time" graphs would be really cool, and I > > think it's > > > > something that could be an impressive addition to Cobertura. > > > > If it WAS > > > > made a part of Cobertura, it seems likely that the data > > > > harvesting parts > > > > of your code would need lots of changes, but hopefully the report > > > > generation stuff could remain largely unchanged. > > > > > > > > -Mark > > > > > > > > > -----Original Message----- > > > > > From: Jody Brownell [mailto:jod...@Q1...] > > > > > Sent: Friday, May 13, 2005 6:56 AM > > > > > To: Mark Doliner > > > > > Cc: cob...@li...; Adam Morgan > > > > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > > > > > Sure does - thanks. > > > > > > > > > > My first thoughts were - this could be an addon > > > > package/application of > > > > > sorts which can use your .ser file or the XML reports (once > > > > > successfully > > > > > completed). I would prefer to not touch your guys code at all if > > > > > possible and just piggy back on what you have - make > > > enhancements if > > > > > required. > > > > > > > > > > This implies that, the way users run cobertura now would > > > > not change at > > > > > all - providing a single user mode of sorts. Then the new > > > additional > > > > > task (ant?) could be run to export that data to a central or non > > > > > volatile data store. (Data store could be RDBMS, flat file or > > > > > what have > > > > > you - makes no difference to me - as long as simple and fast). > > > > > > > > > > Key things for me are, it needs to be extremely simple to > > > > install and > > > > > maintain. No over complicated configuration etc - keep it as > > > > > it is today > > > > > as much as possible. > > > > > > > > > > Agree about the UI - has to be clean, intuitive, simple > > and fast. > > > > > > > > > > - Be nice to view reports on product? / project / package / > > > > > class / ... > > > > > hierarchy - as you navigate through the hierarchy - > > > > > graph/plot for where > > > > > you are > > > > > - plotting lines of code / coverage over time (Jfreechart has > > > > > some great > > > > > plots) > > > > > - Need to identify and ensure we have the right data in the > > > > > datastore. A > > > > > few reports which come to mind are > > > > > - plain coverage stats > > > > > - plain coverage stats plotted against lines of code > > > > > - coverage stats of one project/package/class plotted > > > against the > > > > > baseline coverage of all projects (how does this > > > > project/package/class > > > > > compare to the running average) ( more advanced :)) > > > > > > > > > > For now - I will focus on keeping it simple with two > > > additional ant > > > > > tasks, one for exporting/updating to non volatile > > > > datastore, the other > > > > > for generating reports from that data. I will put together a > > > > > more formal > > > > > list of features / requirements over the next few days. > > > > > > > > > > Thoughts? > > > > > > > > > > -----Original Message----- > > > > > From: Mark Doliner [mailto:Mar...@sa...] > > > > > Sent: Tuesday, May 10, 2005 12:03 PM > > > > > To: Jody Brownell > > > > > Cc: cob...@li... > > > > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > > > > > *snip* > > > > > > > > > > > Anywho - the purpose of this email is to see how I can get > > > > > > involved. One > > > > > > gap in the product which I noticed (and may already be > > > planned) is > > > > > > coverage statistics over time. I was thinking, unless > > this is on > > > > > > someone's plate already I could start to get familiar with > > > > > > the code base > > > > > > and put together a plan of attack - an impact of sorts - and > > > > > > propose to > > > > > > you all. > > > > > > > > > > *snip* > > > > > > > > > > > Please let me know if this is of interest. BTW - what is > > > > the typical > > > > > > process of getting involved? Hope I am not jumping the gun. > > > > > > > > > > You're not jumping the gun at all. I suppose the typical > > > process of > > > > > getting involved is to find something you're interested in > > > > > fixing/improving/adding and writing a patch for it. I > > > don't know of > > > > > anyone working on statistics over time. And it's > > > > definitely something > > > > > that would be nice to have. You would definitely want to > > > > > work with CVS, > > > > > if you plan on making any changes. Some of the stuff I > > > > mention below > > > > > applies to CVS but not to the last release. > > > > > > > > > > I guess the easy way to do it would be to name the XML > > > > > reports based on > > > > > the date and time they were created, and then you could parse a > > > > > directory of these files and determine the change over > > time. This > > > > > wouldn't even need to be a part of Cobertura--it could be a > > > > completely > > > > > separate program. Or maybe instead of reading the data > > > from the XML > > > > > reports, you could read it directly from cobertura.ser files. > > > > > (The ser > > > > > file contains basically the same information as the XML > > > > reports. The > > > > > ser file contains serialized classes from the package > > > > > net.sourceforge.cobertura.coveragedata. If you choose to go > > > > > this route, > > > > > you would need to use these classes to read the > > serialized file.) > > > > > > > > > > However, it might be better to modify the classes in the > > > > coveragedata > > > > > package to natively support a time and date. I'm not > > > sure how this > > > > > would work exactly. Maybe you could tag the information in > > > > > the ser file > > > > > with a datestamp and then zero it out before running the > > > > next batch of > > > > > tests. > > > > > > > > > > I think it is important that this have a good user interface. > > > > > How would > > > > > the statistics be displayed? As a line graph, maybe? > > > How would the > > > > > user tell Cobertura to create these reports? Would > > they specify a > > > > > "start date" and "end date"? Would the report have a > > > > separate display > > > > > for each package? For each class? Would it have a way to show > > > > > differences in the source files? > > > > > > > > > > Does that help you, any? > > > > > > > > > > -Mark |
From: Mark D. <Mar...@sa...> - 2005-05-19 21:07:38
|
I just added an entry to the FAQ for this: http://cobertura.sourceforge.net/faq.html Does that help? -Mark > -----Original Message----- > From: cob...@li...=20 > [mailto:cob...@li...] On=20 > Behalf Of Bob Brady > Sent: Thursday, May 19, 2005 4:41 PM > To: cob...@li... > Subject: [Cobertura-devel] Report from multiple/recursive srcdir >=20 > We are trying to build our report from multiple source dirs with the=20 > cobertura-report tag. We tried wildcards as follows: >=20 > <target name=3D"coverage"> > <cobertura-report srcdir=3D"plugins/**"=20 > destdir=3D"${build.coverage.dir}"/> > </target> >=20 > but cobertura-report interprets the wildcards literally. We=20 > tried using=20 > several cobertura-report calls with different srcdirs, but=20 > the destdir=20 > just gets overwritten, not appended to. >=20 > Is there any way to pass a single cobertura-report call=20 > multiple/resursive=20 > source dirs while using a single destdir? >=20 > We'd like to avoid using many individual cobertura-report=20 > calls and then > doing a merge. Any advice you could give would be appreciated. >=20 > Thanks, > Bob Brady >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by Oracle Space Sweepstakes > Want to be the first software developer in space? > Enter now for the Oracle Space Sweepstakes! > http://ads.osdn.com/?ad_id=3D7412&alloc_id=3D16344&op=3Dclick > _______________________________________________ > Cobertura-devel mailing list > Cob...@li... > https://lists.sourceforge.net/lists/listinfo/cobertura-devel >=20 |
From: Bob B. <rb...@gr...> - 2005-05-19 20:41:12
|
We are trying to build our report from multiple source dirs with the cobertura-report tag. We tried wildcards as follows: <target name="coverage"> <cobertura-report srcdir="plugins/**" destdir="${build.coverage.dir}"/> </target> but cobertura-report interprets the wildcards literally. We tried using several cobertura-report calls with different srcdirs, but the destdir just gets overwritten, not appended to. Is there any way to pass a single cobertura-report call multiple/resursive source dirs while using a single destdir? We'd like to avoid using many individual cobertura-report calls and then doing a merge. Any advice you could give would be appreciated. Thanks, Bob Brady |
From: Jeremy R. T. <je...@th...> - 2005-05-19 20:01:04
|
In thinking it over since I talked to Mark yesterday, I'd agree. I don't think it makes sense to separate the reporting of the inner classes from their parent in the XML any more than it does in the HTML. To answer my question, I asked myself: "Would I ever want to look in a report and find out just the coverage on an inner (or even anonymous) class and not see the coverage of its' respective top-level class?" My answer was no. But, I can change the patch I committed to allow for this if there is a consensus otherwise. (and if told early enough, I could get it in before a late night release most likely.) Jeremy ----- Original Message ----- From: "Jody Brownell" <jod...@Q1...> To: "Mark Doliner" <Mar...@sa...>; "Jeremy Thomerson" <je...@th...> Cc: <cob...@li...> Sent: Thursday, May 19, 2005 2:56 PM Subject: RE: [Cobertura-devel] How can I get involved.... I think it makes sense to have the inner classes reported within the parent XML.... that is where I would expect to find it anyway. -----Original Message----- From: Mark Doliner [mailto:Mar...@sa...] Sent: Thursday, May 19, 2005 4:54 PM To: Jeremy Thomerson; Jody Brownell Cc: cob...@li...; Adam Morgan Subject: RE: [Cobertura-devel] How can I get involved.... I talked to Jeremy for a few minutes about this yesterday. I guess we kind of decided that the fix is an improvement from what it was. After his patch, Cobertura lumps all inner classes with their parents. So the HTML reports show everything on one page, but the XML reports no longer distinguish between inner classes and their parent. I still think that ideally, inner classes would be listed independently of their parent class in the xml reports. What do other people think? -Mark > -----Original Message----- > From: Jeremy Thomerson [mailto:je...@th...] > Sent: Wednesday, May 18, 2005 3:34 AM > To: Mark Doliner; Jody Brownell > Cc: cob...@li...; Adam Morgan > Subject: Re: [Cobertura-devel] How can I get involved.... > > I just committed the necessary changes to accomodate "coverage for the > classes HelloWorld and HelloWorld$1 would both appear on the same HTML > page". > > It also removed the map of classes maintained in ProjectData > since we're > already maintaining all of our classes in individual > PackageData instances. > Granted, it would've been handy to continue hanging on to ClassData > instances in ProjectData, but it would have required copy and > paste logic > from PackageData determining how to aggregrate data from > inner classes into > its parent class. I really hate copy and paste wcode, so I > refactored it to > avoid needing it. However, I think the better way to > refactor this in the > future is have an object whose job it is to hold on to > multiple ClassData > instances, and it can be the only place that contains the aggregration > logic. Maybe? > > It's late enough for now. Hope this was what you were > looking for Mark. > Let me know if it's not. I can back out my changes. > > Jeremy Thomerson > eBay > > ----- Original Message ----- > From: "Mark Doliner" <Mar...@sa...> > To: "Jeremy Ryan Thomerson" <je...@th...>; > "Jody Brownell" > <jod...@Q1...> > Cc: <cob...@li...>; "Adam Morgan" > <ada...@Q1...> > Sent: Tuesday, May 17, 2005 1:10 PM > Subject: RE: [Cobertura-devel] How can I get involved.... > > > No, but how about Thursday? > > I was hoping to get the inner-class thing resolved before > releasing 1.3, but > I think I would rather release it as-in and then make changes later. > > What's wrong with inner-classes, you ask? > In 1.2 the HTML reports ignored inner-classes, and did not > show them as > covered/not covered. > In CVS the HTML reports show coverage for inner-classes, but > they appear in > a separate HTML page instead of being nestled in with their > parent, like a > happy baby bird. > Ideally, the coverage for the classes HelloWorld and > HelloWorld$1 would both > appear on the same HTML page. > > In summary, CVS handles this better than 1.2 did, but it's still not > perfect. However, if people agree that it's better to release now and > improve it later, then let's do that. > > -Mark > > > -----Original Message----- > > From: Jeremy Ryan Thomerson [mailto:je...@th...] > > Sent: Tuesday, May 17, 2005 4:03 PM > > To: Mark Doliner; Jody Brownell > > Cc: cob...@li...; Adam Morgan > > Subject: Re: [Cobertura-devel] How can I get involved.... > > > > Do we have a proposed release date for 1.3? It seems like we > > have some > > pretty significant changes that are awaiting a release. > > > > Jeremy Thomerson > > > > ----- Original Message ----- > > From: "Mark Doliner" <Mar...@sa...> > > To: "Jody Brownell" <jod...@Q1...> > > Cc: <cob...@li...>; "Adam Morgan" > > <ada...@Q1...> > > Sent: Tuesday, May 17, 2005 2:57 PM > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > No, there are no major changes happening in HEAD right now. > > However, the > > changes between 1.2 and HEAD are pretty big--I definitely > > suggest developing > > against CVS HEAD rather than 1.2. > > -Mark > > > > > -----Original Message----- > > > From: Jody Brownell [mailto:jod...@Q1...] > > > Sent: Tuesday, May 17, 2005 3:55 PM > > > To: Mark Doliner > > > Cc: cob...@li...; Adam Morgan > > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > Agreed... Plan is to make it part of cobertura - assuming you > > > accept the > > > patches etc :) I have to get few a number of items at work, > > > then I will > > > start. > > > > > > I will be in touch shortly. > > > > > > BTW - is there anything major happening now on HEAD in cvs? > > > > > > -----Original Message----- > > > From: Mark Doliner [mailto:Mar...@sa...] > > > Sent: Tuesday, May 17, 2005 4:41 PM > > > To: Jody Brownell > > > Cc: cob...@li...; Adam Morgan > > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > It sounds like you have a good idea of what you want to do. > > > I would be > > > careful to try to keep the data harvesting and the report > generation > > > reasonably separate from each other. Why? Because > > historical "change > > > in coverage over time" graphs would be really cool, and I > think it's > > > something that could be an impressive addition to Cobertura. > > > If it WAS > > > made a part of Cobertura, it seems likely that the data > > > harvesting parts > > > of your code would need lots of changes, but hopefully the report > > > generation stuff could remain largely unchanged. > > > > > > -Mark > > > > > > > -----Original Message----- > > > > From: Jody Brownell [mailto:jod...@Q1...] > > > > Sent: Friday, May 13, 2005 6:56 AM > > > > To: Mark Doliner > > > > Cc: cob...@li...; Adam Morgan > > > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > > > Sure does - thanks. > > > > > > > > My first thoughts were - this could be an addon > > > package/application of > > > > sorts which can use your .ser file or the XML reports (once > > > > successfully > > > > completed). I would prefer to not touch your guys code at all if > > > > possible and just piggy back on what you have - make > > enhancements if > > > > required. > > > > > > > > This implies that, the way users run cobertura now would > > > not change at > > > > all - providing a single user mode of sorts. Then the new > > additional > > > > task (ant?) could be run to export that data to a central or non > > > > volatile data store. (Data store could be RDBMS, flat file or > > > > what have > > > > you - makes no difference to me - as long as simple and fast). > > > > > > > > Key things for me are, it needs to be extremely simple to > > > install and > > > > maintain. No over complicated configuration etc - keep it as > > > > it is today > > > > as much as possible. > > > > > > > > Agree about the UI - has to be clean, intuitive, simple > and fast. > > > > > > > > - Be nice to view reports on product? / project / package / > > > > class / ... > > > > hierarchy - as you navigate through the hierarchy - > > > > graph/plot for where > > > > you are > > > > - plotting lines of code / coverage over time (Jfreechart has > > > > some great > > > > plots) > > > > - Need to identify and ensure we have the right data in the > > > > datastore. A > > > > few reports which come to mind are > > > > - plain coverage stats > > > > - plain coverage stats plotted against lines of code > > > > - coverage stats of one project/package/class plotted > > against the > > > > baseline coverage of all projects (how does this > > > project/package/class > > > > compare to the running average) ( more advanced :)) > > > > > > > > For now - I will focus on keeping it simple with two > > additional ant > > > > tasks, one for exporting/updating to non volatile > > > datastore, the other > > > > for generating reports from that data. I will put together a > > > > more formal > > > > list of features / requirements over the next few days. > > > > > > > > Thoughts? > > > > > > > > -----Original Message----- > > > > From: Mark Doliner [mailto:Mar...@sa...] > > > > Sent: Tuesday, May 10, 2005 12:03 PM > > > > To: Jody Brownell > > > > Cc: cob...@li... > > > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > > > *snip* > > > > > > > > > Anywho - the purpose of this email is to see how I can get > > > > > involved. One > > > > > gap in the product which I noticed (and may already be > > planned) is > > > > > coverage statistics over time. I was thinking, unless > this is on > > > > > someone's plate already I could start to get familiar with > > > > > the code base > > > > > and put together a plan of attack - an impact of sorts - and > > > > > propose to > > > > > you all. > > > > > > > > *snip* > > > > > > > > > Please let me know if this is of interest. BTW - what is > > > the typical > > > > > process of getting involved? Hope I am not jumping the gun. > > > > > > > > You're not jumping the gun at all. I suppose the typical > > process of > > > > getting involved is to find something you're interested in > > > > fixing/improving/adding and writing a patch for it. I > > don't know of > > > > anyone working on statistics over time. And it's > > > definitely something > > > > that would be nice to have. You would definitely want to > > > > work with CVS, > > > > if you plan on making any changes. Some of the stuff I > > > mention below > > > > applies to CVS but not to the last release. > > > > > > > > I guess the easy way to do it would be to name the XML > > > > reports based on > > > > the date and time they were created, and then you could parse a > > > > directory of these files and determine the change over > time. This > > > > wouldn't even need to be a part of Cobertura--it could be a > > > completely > > > > separate program. Or maybe instead of reading the data > > from the XML > > > > reports, you could read it directly from cobertura.ser files. > > > > (The ser > > > > file contains basically the same information as the XML > > > reports. The > > > > ser file contains serialized classes from the package > > > > net.sourceforge.cobertura.coveragedata. If you choose to go > > > > this route, > > > > you would need to use these classes to read the > serialized file.) > > > > > > > > However, it might be better to modify the classes in the > > > coveragedata > > > > package to natively support a time and date. I'm not > > sure how this > > > > would work exactly. Maybe you could tag the information in > > > > the ser file > > > > with a datestamp and then zero it out before running the > > > next batch of > > > > tests. > > > > > > > > I think it is important that this have a good user interface. > > > > How would > > > > the statistics be displayed? As a line graph, maybe? > > How would the > > > > user tell Cobertura to create these reports? Would > they specify a > > > > "start date" and "end date"? Would the report have a > > > separate display > > > > for each package? For each class? Would it have a way to show > > > > differences in the source files? > > > > > > > > Does that help you, any? > > > > > > > > -Mark > > > > > > > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by Oracle Space Sweepstakes > > Want to be the first software developer in space? > > Enter now for the Oracle Space Sweepstakes! > > http://ads.osdn.com/?ad_idt12&alloc_id344&op=ick > > _______________________________________________ > > Cobertura-devel mailing list > > Cob...@li... > > https://lists.sourceforge.net/lists/listinfo/cobertura-devel > > > > > > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by Oracle Space Sweepstakes > Want to be the first software developer in space? > Enter now for the Oracle Space Sweepstakes! > http://ads.osdn.com/?ad_idt12&alloc_id344&op=ick > _______________________________________________ > Cobertura-devel mailing list > Cob...@li... > https://lists.sourceforge.net/lists/listinfo/cobertura-devel > > |
From: Jody B. <jod...@Q1...> - 2005-05-19 19:56:42
|
I think it makes sense to have the inner classes reported within the parent XML.... that is where I would expect to find it anyway. -----Original Message----- From: Mark Doliner [mailto:Mar...@sa...]=20 Sent: Thursday, May 19, 2005 4:54 PM To: Jeremy Thomerson; Jody Brownell Cc: cob...@li...; Adam Morgan Subject: RE: [Cobertura-devel] How can I get involved.... I talked to Jeremy for a few minutes about this yesterday. I guess we kind of decided that the fix is an improvement from what it was. After his patch, Cobertura lumps all inner classes with their parents. So the HTML reports show everything on one page, but the XML reports no longer distinguish between inner classes and their parent. I still think that ideally, inner classes would be listed independently of their parent class in the xml reports. What do other people think? -Mark > -----Original Message----- > From: Jeremy Thomerson [mailto:je...@th...]=20 > Sent: Wednesday, May 18, 2005 3:34 AM > To: Mark Doliner; Jody Brownell > Cc: cob...@li...; Adam Morgan > Subject: Re: [Cobertura-devel] How can I get involved.... >=20 > I just committed the necessary changes to accomodate "coverage for the > classes HelloWorld and HelloWorld$1 would both appear on the same HTML > page". >=20 > It also removed the map of classes maintained in ProjectData=20 > since we're > already maintaining all of our classes in individual=20 > PackageData instances. > Granted, it would've been handy to continue hanging on to ClassData > instances in ProjectData, but it would have required copy and=20 > paste logic > from PackageData determining how to aggregrate data from=20 > inner classes into > its parent class. I really hate copy and paste wcode, so I=20 > refactored it to > avoid needing it. However, I think the better way to=20 > refactor this in the > future is have an object whose job it is to hold on to=20 > multiple ClassData > instances, and it can be the only place that contains the aggregration > logic. Maybe? >=20 > It's late enough for now. Hope this was what you were=20 > looking for Mark. > Let me know if it's not. I can back out my changes. >=20 > Jeremy Thomerson > eBay >=20 > ----- Original Message ----- > From: "Mark Doliner" <Mar...@sa...> > To: "Jeremy Ryan Thomerson" <je...@th...>;=20 > "Jody Brownell" > <jod...@Q1...> > Cc: <cob...@li...>; "Adam Morgan" > <ada...@Q1...> > Sent: Tuesday, May 17, 2005 1:10 PM > Subject: RE: [Cobertura-devel] How can I get involved.... >=20 >=20 > No, but how about Thursday? >=20 > I was hoping to get the inner-class thing resolved before=20 > releasing 1.3, but > I think I would rather release it as-in and then make changes later. >=20 > What's wrong with inner-classes, you ask? > In 1.2 the HTML reports ignored inner-classes, and did not=20 > show them as > covered/not covered. > In CVS the HTML reports show coverage for inner-classes, but=20 > they appear in > a separate HTML page instead of being nestled in with their=20 > parent, like a > happy baby bird. > Ideally, the coverage for the classes HelloWorld and=20 > HelloWorld$1 would both > appear on the same HTML page. >=20 > In summary, CVS handles this better than 1.2 did, but it's still not > perfect. However, if people agree that it's better to release now and > improve it later, then let's do that. >=20 > -Mark >=20 > > -----Original Message----- > > From: Jeremy Ryan Thomerson [mailto:je...@th...] > > Sent: Tuesday, May 17, 2005 4:03 PM > > To: Mark Doliner; Jody Brownell > > Cc: cob...@li...; Adam Morgan > > Subject: Re: [Cobertura-devel] How can I get involved.... > > > > Do we have a proposed release date for 1.3? It seems like we > > have some > > pretty significant changes that are awaiting a release. > > > > Jeremy Thomerson > > > > ----- Original Message ----- > > From: "Mark Doliner" <Mar...@sa...> > > To: "Jody Brownell" <jod...@Q1...> > > Cc: <cob...@li...>; "Adam Morgan" > > <ada...@Q1...> > > Sent: Tuesday, May 17, 2005 2:57 PM > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > No, there are no major changes happening in HEAD right now. > > However, the > > changes between 1.2 and HEAD are pretty big--I definitely > > suggest developing > > against CVS HEAD rather than 1.2. > > -Mark > > > > > -----Original Message----- > > > From: Jody Brownell [mailto:jod...@Q1...] > > > Sent: Tuesday, May 17, 2005 3:55 PM > > > To: Mark Doliner > > > Cc: cob...@li...; Adam Morgan > > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > Agreed... Plan is to make it part of cobertura - assuming you > > > accept the > > > patches etc :) I have to get few a number of items at work, > > > then I will > > > start. > > > > > > I will be in touch shortly. > > > > > > BTW - is there anything major happening now on HEAD in cvs? > > > > > > -----Original Message----- > > > From: Mark Doliner [mailto:Mar...@sa...] > > > Sent: Tuesday, May 17, 2005 4:41 PM > > > To: Jody Brownell > > > Cc: cob...@li...; Adam Morgan > > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > It sounds like you have a good idea of what you want to do. > > > I would be > > > careful to try to keep the data harvesting and the report=20 > generation > > > reasonably separate from each other. Why? Because > > historical "change > > > in coverage over time" graphs would be really cool, and I=20 > think it's > > > something that could be an impressive addition to Cobertura. > > > If it WAS > > > made a part of Cobertura, it seems likely that the data > > > harvesting parts > > > of your code would need lots of changes, but hopefully the report > > > generation stuff could remain largely unchanged. > > > > > > -Mark > > > > > > > -----Original Message----- > > > > From: Jody Brownell [mailto:jod...@Q1...] > > > > Sent: Friday, May 13, 2005 6:56 AM > > > > To: Mark Doliner > > > > Cc: cob...@li...; Adam Morgan > > > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > > > Sure does - thanks. > > > > > > > > My first thoughts were - this could be an addon > > > package/application of > > > > sorts which can use your .ser file or the XML reports (once > > > > successfully > > > > completed). I would prefer to not touch your guys code at all if > > > > possible and just piggy back on what you have - make > > enhancements if > > > > required. > > > > > > > > This implies that, the way users run cobertura now would > > > not change at > > > > all - providing a single user mode of sorts. Then the new > > additional > > > > task (ant?) could be run to export that data to a central or non > > > > volatile data store. (Data store could be RDBMS, flat file or > > > > what have > > > > you - makes no difference to me - as long as simple and fast). > > > > > > > > Key things for me are, it needs to be extremely simple to > > > install and > > > > maintain. No over complicated configuration etc - keep it as > > > > it is today > > > > as much as possible. > > > > > > > > Agree about the UI - has to be clean, intuitive, simple=20 > and fast. > > > > > > > > - Be nice to view reports on product? / project / package / > > > > class / ... > > > > hierarchy - as you navigate through the hierarchy - > > > > graph/plot for where > > > > you are > > > > - plotting lines of code / coverage over time (Jfreechart has > > > > some great > > > > plots) > > > > - Need to identify and ensure we have the right data in the > > > > datastore. A > > > > few reports which come to mind are > > > > - plain coverage stats > > > > - plain coverage stats plotted against lines of code > > > > - coverage stats of one project/package/class plotted > > against the > > > > baseline coverage of all projects (how does this > > > project/package/class > > > > compare to the running average) ( more advanced :)) > > > > > > > > For now - I will focus on keeping it simple with two > > additional ant > > > > tasks, one for exporting/updating to non volatile > > > datastore, the other > > > > for generating reports from that data. I will put together a > > > > more formal > > > > list of features / requirements over the next few days. > > > > > > > > Thoughts? > > > > > > > > -----Original Message----- > > > > From: Mark Doliner [mailto:Mar...@sa...] > > > > Sent: Tuesday, May 10, 2005 12:03 PM > > > > To: Jody Brownell > > > > Cc: cob...@li... > > > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > > > *snip* > > > > > > > > > Anywho - the purpose of this email is to see how I can get > > > > > involved. One > > > > > gap in the product which I noticed (and may already be > > planned) is > > > > > coverage statistics over time. I was thinking, unless=20 > this is on > > > > > someone's plate already I could start to get familiar with > > > > > the code base > > > > > and put together a plan of attack - an impact of sorts - and > > > > > propose to > > > > > you all. > > > > > > > > *snip* > > > > > > > > > Please let me know if this is of interest. BTW - what is > > > the typical > > > > > process of getting involved? Hope I am not jumping the gun. > > > > > > > > You're not jumping the gun at all. I suppose the typical > > process of > > > > getting involved is to find something you're interested in > > > > fixing/improving/adding and writing a patch for it. I > > don't know of > > > > anyone working on statistics over time. And it's > > > definitely something > > > > that would be nice to have. You would definitely want to > > > > work with CVS, > > > > if you plan on making any changes. Some of the stuff I > > > mention below > > > > applies to CVS but not to the last release. > > > > > > > > I guess the easy way to do it would be to name the XML > > > > reports based on > > > > the date and time they were created, and then you could parse a > > > > directory of these files and determine the change over=20 > time. This > > > > wouldn't even need to be a part of Cobertura--it could be a > > > completely > > > > separate program. Or maybe instead of reading the data > > from the XML > > > > reports, you could read it directly from cobertura.ser files. > > > > (The ser > > > > file contains basically the same information as the XML > > > reports. The > > > > ser file contains serialized classes from the package > > > > net.sourceforge.cobertura.coveragedata. If you choose to go > > > > this route, > > > > you would need to use these classes to read the=20 > serialized file.) > > > > > > > > However, it might be better to modify the classes in the > > > coveragedata > > > > package to natively support a time and date. I'm not > > sure how this > > > > would work exactly. Maybe you could tag the information in > > > > the ser file > > > > with a datestamp and then zero it out before running the > > > next batch of > > > > tests. > > > > > > > > I think it is important that this have a good user interface. > > > > How would > > > > the statistics be displayed? As a line graph, maybe? > > How would the > > > > user tell Cobertura to create these reports? Would=20 > they specify a > > > > "start date" and "end date"? Would the report have a > > > separate display > > > > for each package? For each class? Would it have a way to show > > > > differences in the source files? > > > > > > > > Does that help you, any? > > > > > > > > -Mark > > > > > > > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by Oracle Space Sweepstakes > > Want to be the first software developer in space? > > Enter now for the Oracle Space Sweepstakes! > > http://ads.osdn.com/?ad_idt12&alloc_id=16344&op=3Dick > > _______________________________________________ > > Cobertura-devel mailing list > > Cob...@li... > > https://lists.sourceforge.net/lists/listinfo/cobertura-devel > > > > > > > > >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by Oracle Space Sweepstakes > Want to be the first software developer in space? > Enter now for the Oracle Space Sweepstakes! > http://ads.osdn.com/?ad_idt12&alloc_id=16344&op=3Dick > _______________________________________________ > Cobertura-devel mailing list > Cob...@li... > https://lists.sourceforge.net/lists/listinfo/cobertura-devel >=20 >=20 |
From: Mark D. <Mar...@sa...> - 2005-05-19 19:54:18
|
I talked to Jeremy for a few minutes about this yesterday. I guess we = kind of decided that the fix is an improvement from what it was. After = his patch, Cobertura lumps all inner classes with their parents. So the = HTML reports show everything on one page, but the XML reports no longer = distinguish between inner classes and their parent. I still think that ideally, inner classes would be listed independently = of their parent class in the xml reports. What do other people think? -Mark > -----Original Message----- > From: Jeremy Thomerson [mailto:je...@th...]=20 > Sent: Wednesday, May 18, 2005 3:34 AM > To: Mark Doliner; Jody Brownell > Cc: cob...@li...; Adam Morgan > Subject: Re: [Cobertura-devel] How can I get involved.... >=20 > I just committed the necessary changes to accomodate "coverage for the > classes HelloWorld and HelloWorld$1 would both appear on the same HTML > page". >=20 > It also removed the map of classes maintained in ProjectData=20 > since we're > already maintaining all of our classes in individual=20 > PackageData instances. > Granted, it would've been handy to continue hanging on to ClassData > instances in ProjectData, but it would have required copy and=20 > paste logic > from PackageData determining how to aggregrate data from=20 > inner classes into > its parent class. I really hate copy and paste wcode, so I=20 > refactored it to > avoid needing it. However, I think the better way to=20 > refactor this in the > future is have an object whose job it is to hold on to=20 > multiple ClassData > instances, and it can be the only place that contains the aggregration > logic. Maybe? >=20 > It's late enough for now. Hope this was what you were=20 > looking for Mark. > Let me know if it's not. I can back out my changes. >=20 > Jeremy Thomerson > eBay >=20 > ----- Original Message ----- > From: "Mark Doliner" <Mar...@sa...> > To: "Jeremy Ryan Thomerson" <je...@th...>;=20 > "Jody Brownell" > <jod...@Q1...> > Cc: <cob...@li...>; "Adam Morgan" > <ada...@Q1...> > Sent: Tuesday, May 17, 2005 1:10 PM > Subject: RE: [Cobertura-devel] How can I get involved.... >=20 >=20 > No, but how about Thursday? >=20 > I was hoping to get the inner-class thing resolved before=20 > releasing 1.3, but > I think I would rather release it as-in and then make changes later. >=20 > What's wrong with inner-classes, you ask? > In 1.2 the HTML reports ignored inner-classes, and did not=20 > show them as > covered/not covered. > In CVS the HTML reports show coverage for inner-classes, but=20 > they appear in > a separate HTML page instead of being nestled in with their=20 > parent, like a > happy baby bird. > Ideally, the coverage for the classes HelloWorld and=20 > HelloWorld$1 would both > appear on the same HTML page. >=20 > In summary, CVS handles this better than 1.2 did, but it's still not > perfect. However, if people agree that it's better to release now and > improve it later, then let's do that. >=20 > -Mark >=20 > > -----Original Message----- > > From: Jeremy Ryan Thomerson [mailto:je...@th...] > > Sent: Tuesday, May 17, 2005 4:03 PM > > To: Mark Doliner; Jody Brownell > > Cc: cob...@li...; Adam Morgan > > Subject: Re: [Cobertura-devel] How can I get involved.... > > > > Do we have a proposed release date for 1.3? It seems like we > > have some > > pretty significant changes that are awaiting a release. > > > > Jeremy Thomerson > > > > ----- Original Message ----- > > From: "Mark Doliner" <Mar...@sa...> > > To: "Jody Brownell" <jod...@Q1...> > > Cc: <cob...@li...>; "Adam Morgan" > > <ada...@Q1...> > > Sent: Tuesday, May 17, 2005 2:57 PM > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > No, there are no major changes happening in HEAD right now. > > However, the > > changes between 1.2 and HEAD are pretty big--I definitely > > suggest developing > > against CVS HEAD rather than 1.2. > > -Mark > > > > > -----Original Message----- > > > From: Jody Brownell [mailto:jod...@Q1...] > > > Sent: Tuesday, May 17, 2005 3:55 PM > > > To: Mark Doliner > > > Cc: cob...@li...; Adam Morgan > > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > Agreed... Plan is to make it part of cobertura - assuming you > > > accept the > > > patches etc :) I have to get few a number of items at work, > > > then I will > > > start. > > > > > > I will be in touch shortly. > > > > > > BTW - is there anything major happening now on HEAD in cvs? > > > > > > -----Original Message----- > > > From: Mark Doliner [mailto:Mar...@sa...] > > > Sent: Tuesday, May 17, 2005 4:41 PM > > > To: Jody Brownell > > > Cc: cob...@li...; Adam Morgan > > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > It sounds like you have a good idea of what you want to do. > > > I would be > > > careful to try to keep the data harvesting and the report=20 > generation > > > reasonably separate from each other. Why? Because > > historical "change > > > in coverage over time" graphs would be really cool, and I=20 > think it's > > > something that could be an impressive addition to Cobertura. > > > If it WAS > > > made a part of Cobertura, it seems likely that the data > > > harvesting parts > > > of your code would need lots of changes, but hopefully the report > > > generation stuff could remain largely unchanged. > > > > > > -Mark > > > > > > > -----Original Message----- > > > > From: Jody Brownell [mailto:jod...@Q1...] > > > > Sent: Friday, May 13, 2005 6:56 AM > > > > To: Mark Doliner > > > > Cc: cob...@li...; Adam Morgan > > > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > > > Sure does - thanks. > > > > > > > > My first thoughts were - this could be an addon > > > package/application of > > > > sorts which can use your .ser file or the XML reports (once > > > > successfully > > > > completed). I would prefer to not touch your guys code at all if > > > > possible and just piggy back on what you have - make > > enhancements if > > > > required. > > > > > > > > This implies that, the way users run cobertura now would > > > not change at > > > > all - providing a single user mode of sorts. Then the new > > additional > > > > task (ant?) could be run to export that data to a central or non > > > > volatile data store. (Data store could be RDBMS, flat file or > > > > what have > > > > you - makes no difference to me - as long as simple and fast). > > > > > > > > Key things for me are, it needs to be extremely simple to > > > install and > > > > maintain. No over complicated configuration etc - keep it as > > > > it is today > > > > as much as possible. > > > > > > > > Agree about the UI - has to be clean, intuitive, simple=20 > and fast. > > > > > > > > - Be nice to view reports on product? / project / package / > > > > class / ... > > > > hierarchy - as you navigate through the hierarchy - > > > > graph/plot for where > > > > you are > > > > - plotting lines of code / coverage over time (Jfreechart has > > > > some great > > > > plots) > > > > - Need to identify and ensure we have the right data in the > > > > datastore. A > > > > few reports which come to mind are > > > > - plain coverage stats > > > > - plain coverage stats plotted against lines of code > > > > - coverage stats of one project/package/class plotted > > against the > > > > baseline coverage of all projects (how does this > > > project/package/class > > > > compare to the running average) ( more advanced :)) > > > > > > > > For now - I will focus on keeping it simple with two > > additional ant > > > > tasks, one for exporting/updating to non volatile > > > datastore, the other > > > > for generating reports from that data. I will put together a > > > > more formal > > > > list of features / requirements over the next few days. > > > > > > > > Thoughts? > > > > > > > > -----Original Message----- > > > > From: Mark Doliner [mailto:Mar...@sa...] > > > > Sent: Tuesday, May 10, 2005 12:03 PM > > > > To: Jody Brownell > > > > Cc: cob...@li... > > > > Subject: RE: [Cobertura-devel] How can I get involved.... > > > > > > > > *snip* > > > > > > > > > Anywho - the purpose of this email is to see how I can get > > > > > involved. One > > > > > gap in the product which I noticed (and may already be > > planned) is > > > > > coverage statistics over time. I was thinking, unless=20 > this is on > > > > > someone's plate already I could start to get familiar with > > > > > the code base > > > > > and put together a plan of attack - an impact of sorts - and > > > > > propose to > > > > > you all. > > > > > > > > *snip* > > > > > > > > > Please let me know if this is of interest. BTW - what is > > > the typical > > > > > process of getting involved? Hope I am not jumping the gun. > > > > > > > > You're not jumping the gun at all. I suppose the typical > > process of > > > > getting involved is to find something you're interested in > > > > fixing/improving/adding and writing a patch for it. I > > don't know of > > > > anyone working on statistics over time. And it's > > > definitely something > > > > that would be nice to have. You would definitely want to > > > > work with CVS, > > > > if you plan on making any changes. Some of the stuff I > > > mention below > > > > applies to CVS but not to the last release. > > > > > > > > I guess the easy way to do it would be to name the XML > > > > reports based on > > > > the date and time they were created, and then you could parse a > > > > directory of these files and determine the change over=20 > time. This > > > > wouldn't even need to be a part of Cobertura--it could be a > > > completely > > > > separate program. Or maybe instead of reading the data > > from the XML > > > > reports, you could read it directly from cobertura.ser files. > > > > (The ser > > > > file contains basically the same information as the XML > > > reports. The > > > > ser file contains serialized classes from the package > > > > net.sourceforge.cobertura.coveragedata. If you choose to go > > > > this route, > > > > you would need to use these classes to read the=20 > serialized file.) > > > > > > > > However, it might be better to modify the classes in the > > > coveragedata > > > > package to natively support a time and date. I'm not > > sure how this > > > > would work exactly. Maybe you could tag the information in > > > > the ser file > > > > with a datestamp and then zero it out before running the > > > next batch of > > > > tests. > > > > > > > > I think it is important that this have a good user interface. > > > > How would > > > > the statistics be displayed? As a line graph, maybe? > > How would the > > > > user tell Cobertura to create these reports? Would=20 > they specify a > > > > "start date" and "end date"? Would the report have a > > > separate display > > > > for each package? For each class? Would it have a way to show > > > > differences in the source files? > > > > > > > > Does that help you, any? > > > > > > > > -Mark > > > > > > > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by Oracle Space Sweepstakes > > Want to be the first software developer in space? > > Enter now for the Oracle Space Sweepstakes! > > http://ads.osdn.com/?ad_idt12&alloc_id=16344&op=3Dick > > _______________________________________________ > > Cobertura-devel mailing list > > Cob...@li... > > https://lists.sourceforge.net/lists/listinfo/cobertura-devel > > > > > > > > >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by Oracle Space Sweepstakes > Want to be the first software developer in space? > Enter now for the Oracle Space Sweepstakes! > http://ads.osdn.com/?ad_idt12&alloc_id=16344&op=3Dick > _______________________________________________ > Cobertura-devel mailing list > Cob...@li... > https://lists.sourceforge.net/lists/listinfo/cobertura-devel >=20 >=20 |