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: Jim S. <ji...@ji...> - 2010-05-20 16:38:27
|
It's giving you 100% statement coverage but not 100% branch coverage. It is behaving correctly. The reason you don't have 100% branch coverage is that you are testing the boolean condition again instead of just using else. So you have no way to make it take the second branch in the else if, because that second condition was already covered by the first conditional. In other words: if (cond(some boolean)) { <<< you can get this to evaluate true or false, but if true it will not get to the else if [...] else if (!cond(some boolean)) { <<< you can get this to evaluate true when first conditional is false, but not the other way around [...] } So when it gets to the else if, the only value cond can ever return is false, so the only way the second conditional can ever evaluate is true. It can never evaluate to false, so you can only take half the branches on the second conditional. ----- Original Message ----- From: "Anton Trapp" <tm...@al...> To: <cob...@li...> Sent: Thursday, May 20, 2010 6:59 AM Subject: Re: [Cobertura-devel] branch coverage of two function calls??? Hi! Thank you for your fast answer! As I said, I do run tests with true/false and the if statement is not even mentioned in the branches: Overview: code: So yes/No is working, but line 88 has line coverage but no branch coverage. I am understanding my question, but I don't understand what cobertura needs to branch in line 88 where there is not even a control structure... Regards, Anton Am 20.05.2010 um 15:39 schrieb Alejandro Pérez García: > Hi > > I'm sorry, but I thikn that I don't understand your question. > > If you want to cover the "else" sentence (the sentence you marked with > "THIS LINE") you only have to do "false" the yesNo expresion. > > I don't understand where is the problem. > > Regards > > > > > 2010/5/20 Anton Trapp <tm...@al...> > Hi! > > How can I cover the 4 branches of: > > if (yesNo) { > verifyTrue(selenium.isTextPresent("secure page")); > } else { > verifyFalse(selenium.isTextPresent("secure page")); <-- THIS LINE??? > } > > Code coverage is 100%, this test is called multiple times (yes I do > perform a code coverage of the tests, please do NOT ask why...) with yesNo > both true and false. So how can I test the 4 branches in the function > calls that I don't even see and why are there no function calls in the > second line which is almost identical. > > I always thought that branches are only for control structures like if, > ...? > > Anybody can help me? > > Thank you very much in advance! > > Regards, > Anton > > ------------------------------------------------------------------------------ > > > _______________________________________________ > Cobertura-devel mailing list > Cob...@li... > https://lists.sourceforge.net/lists/listinfo/cobertura-devel > > > > > -- > Alejandro Pérez García > Socio fundador de Autentia y www.adictosaltrabajo.com > (Formación, Consultoría, Desarrollo de sistemas transaccionales) > mailto:ale...@au... > Tel.: 655 99 11 75 > > Autentia Real Business Solutions S.L. > "Soporte a Desarrollo" > http://www.autentia.com > > > > Este mensaje, y en su caso cualquier fichero anexo al mismo, puede > contener información confidencial y/o privilegiada, siendo para uso > exclusivo del destinatario. Si Vd. no es el destinatario o lo ha recibido > por error, por favor, informe inmediatamente al emisor y destrúyalo. Está > estrictamente prohibido por la legislación vigente realizar sin > autorización cualquier copia, revelación o distribución del contenido de > este mensaje sin la autorización expresa del remitente. Las opiniones > expresadas en este correo son las de su autor y no son, necesariamente, > compartidas por Autentia Real Business Solutions S.L. > > This e-mail, and in the case of any file annexed to it, may contain > confidential and/or privileged information, and it is exclusively for the > use of the addresses of the message. If you are not the intended recipient > (or have received this e-mail in error), please notify the sender > immediately and destroy this e-mail. Any unauthorised copying, disclosure > or distribution of the material in this e-mail is strictly forbidden by > current legislation. The points of view expressed in this e-mail are > solely those of the author and may not necessarily be from, or supported > by, Autentia Real Business Solutions S.L. > -------------------------------------------------------------------------------- Hi! Thank you for your fast answer! As I said, I do run tests with true/false and the if statement is not even mentioned in the branches: Overview: code: So yes/No is working, but line 88 has line coverage but no branch coverage. I am understanding my question, but I don't understand what cobertura needs to branch in line 88 where there is not even a control structure... Regards, Anton Am 20.05.2010 um 15:39 schrieb Alejandro Pérez García: Hi I'm sorry, but I thikn that I don't understand your question. If you want to cover the "else" sentence (the sentence you marked with "THIS LINE") you only have to do "false" the yesNo expresion. I don't understand where is the problem. Regards 2010/5/20 Anton Trapp <tm...@al...> Hi! How can I cover the 4 branches of: if (yesNo) { verifyTrue(selenium.isTextPresent("secure page")); } else { verifyFalse(selenium.isTextPresent("secure page")); <-- THIS LINE??? } Code coverage is 100%, this test is called multiple times (yes I do perform a code coverage of the tests, please do NOT ask why...) with yesNo both true and false. So how can I test the 4 branches in the function calls that I don't even see and why are there no function calls in the second line which is almost identical. I always thought that branches are only for control structures like if, ...? Anybody can help me? Thank you very much in advance! Regards, Anton ------------------------------------------------------------------------------ _______________________________________________ Cobertura-devel mailing list Cob...@li... https://lists.sourceforge.net/lists/listinfo/cobertura-devel -- Alejandro Pérez García Socio fundador de Autentia y www.adictosaltrabajo.com (Formación, Consultoría, Desarrollo de sistemas transaccionales) mailto:ale...@au... Tel.: 655 99 11 75 Autentia Real Business Solutions S.L. "Soporte a Desarrollo" http://www.autentia.com Este mensaje, y en su caso cualquier fichero anexo al mismo, puede contener información confidencial y/o privilegiada, siendo para uso exclusivo del destinatario. Si Vd. no es el destinatario o lo ha recibido por error, por favor, informe inmediatamente al emisor y destrúyalo. Está estrictamente prohibido por la legislación vigente realizar sin autorización cualquier copia, revelación o distribución del contenido de este mensaje sin la autorización expresa del remitente. Las opiniones expresadas en este correo son las de su autor y no son, necesariamente, compartidas por Autentia Real Business Solutions S.L. This e-mail, and in the case of any file annexed to it, may contain confidential and/or privileged information, and it is exclusively for the use of the addresses of the message. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden by current legislation. The points of view expressed in this e-mail are solely those of the author and may not necessarily be from, or supported by, Autentia Real Business Solutions S.L. -------------------------------------------------------------------------------- > ------------------------------------------------------------------------------ > > |
From: Anton T. <tm...@al...> - 2010-05-20 14:16:41
|
Sorry, the missing images are: http://downloads.allproducts.info/deleteme/img1.png and http://downloads.allproducts.info/deleteme/img2.png |
From: Alan C. <al...@me...> - 2010-05-20 14:10:26
|
Hi Anton Anton Trapp wrote: > Hi! > > code: > > > So yes/No is working, but line 88 has line coverage but no branch > coverage. I am understanding my question, but I don't understand what > cobertura needs to branch in line 88 where there is not even a control > structure... > If you want to get full green coverage you will have to make sure that the test 'selenium.isTextPresent' returns true in one case and false in the other. What I suspect cobertura is telling you is that there are two possible conditions for 'isTextPresent' and you probably haven't exercised both of them. Regards Alan >> Hi >> >> I'm sorry, but I thikn that I don't understand your question. >> >> If you want to cover the "else" sentence (the sentence you marked >> with "THIS LINE") you only have to do "false" the yesNo expresion. >> >> I don't understand where is the problem. >> >> Regards >> >> >> >> >> 2010/5/20 Anton Trapp <tm...@al... >> <mailto:tm...@al...>> >> >> Hi! >> >> How can I cover the 4 branches of: >> >> if (yesNo) { >> verifyTrue(selenium.isTextPresent("secure page")); >> } else { >> verifyFalse(selenium.isTextPresent("secure page")); <-- >> THIS LINE??? >> } >> >> Code coverage is 100%, this test is called multiple times (yes I >> do perform a code coverage of the tests, please do NOT ask >> why...) with yesNo both true and false. So how can I test the 4 >> branches in the function calls that I don't even see and why are >> there no function calls in the second line which is almost identical. >> >> I always thought that branches are only for control structures >> like if, ...? >> >> Anybody can help me? >> >> Thank you very much in advance! >> >> Regards, >> Anton >> >> ------------------------------------------------------------------------------ >> >> >> _______________________________________________ >> Cobertura-devel mailing list >> Cob...@li... >> <mailto:Cob...@li...> >> https://lists.sourceforge.net/lists/listinfo/cobertura-devel >> >> >> >> >> -- >> Alejandro Pérez García >> Socio fundador de Autentia y www.adictosaltrabajo.com >> <http://www.adictosaltrabajo.com/> >> (Formación, Consultoría, Desarrollo de sistemas transaccionales) >> mailto:ale...@au... <mailto:ale...@au...> >> Tel.: 655 99 11 75 >> >> Autentia Real Business Solutions S.L. >> "Soporte a Desarrollo" >> http://www.autentia.com <http://www.autentia.com/> >> >> >> >> Este mensaje, y en su caso cualquier fichero anexo al mismo, puede >> contener información confidencial y/o privilegiada, siendo para uso >> exclusivo del destinatario. Si Vd. no es el destinatario o lo ha >> recibido por error, por favor, informe inmediatamente al emisor y >> destrúyalo. Está estrictamente prohibido por la legislación vigente >> realizar sin autorización cualquier copia, revelación o distribución >> del contenido de este mensaje sin la autorización expresa del >> remitente. Las opiniones expresadas en este correo son las de su >> autor y no son, necesariamente, compartidas por Autentia Real >> Business Solutions S.L. >> >> This e-mail, and in the case of any file annexed to it, may contain >> confidential and/or privileged information, and it is exclusively for >> the use of the addresses of the message. If you are not the intended >> recipient (or have received this e-mail in error), please notify the >> sender immediately and destroy this e-mail. Any unauthorised copying, >> disclosure or distribution of the material in this e-mail is strictly >> forbidden by current legislation. The points of view expressed in >> this e-mail are solely those of the author and may not necessarily be >> from, or supported by, Autentia Real Business Solutions S.L. >> > > !DSPAM:4bf5415c144214221013052! > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > > > > !DSPAM:4bf5415c144214221013052! > > ------------------------------------------------------------------------ > > _______________________________________________ > Cobertura-devel mailing list > Cob...@li... > https://lists.sourceforge.net/lists/listinfo/cobertura-devel > > > !DSPAM:4bf5415c144214221013052! > |
From: Anton T. <tm...@al...> - 2010-05-20 13:59:15
|
Hi! Thank you for your fast answer! As I said, I do run tests with true/false and the if statement is not even mentioned in the branches: Overview: code: So yes/No is working, but line 88 has line coverage but no branch coverage. I am understanding my question, but I don't understand what cobertura needs to branch in line 88 where there is not even a control structure... Regards, Anton Am 20.05.2010 um 15:39 schrieb Alejandro Pérez García: > Hi > > I'm sorry, but I thikn that I don't understand your question. > > If you want to cover the "else" sentence (the sentence you marked with "THIS LINE") you only have to do "false" the yesNo expresion. > > I don't understand where is the problem. > > Regards > > > > > 2010/5/20 Anton Trapp <tm...@al...> > Hi! > > How can I cover the 4 branches of: > > if (yesNo) { > verifyTrue(selenium.isTextPresent("secure page")); > } else { > verifyFalse(selenium.isTextPresent("secure page")); <-- THIS LINE??? > } > > Code coverage is 100%, this test is called multiple times (yes I do perform a code coverage of the tests, please do NOT ask why...) with yesNo both true and false. So how can I test the 4 branches in the function calls that I don't even see and why are there no function calls in the second line which is almost identical. > > I always thought that branches are only for control structures like if, ...? > > Anybody can help me? > > Thank you very much in advance! > > Regards, > Anton > > ------------------------------------------------------------------------------ > > > _______________________________________________ > Cobertura-devel mailing list > Cob...@li... > https://lists.sourceforge.net/lists/listinfo/cobertura-devel > > > > > -- > Alejandro Pérez García > Socio fundador de Autentia y www.adictosaltrabajo.com > (Formación, Consultoría, Desarrollo de sistemas transaccionales) > mailto:ale...@au... > Tel.: 655 99 11 75 > > Autentia Real Business Solutions S.L. > "Soporte a Desarrollo" > http://www.autentia.com > > > > Este mensaje, y en su caso cualquier fichero anexo al mismo, puede contener información confidencial y/o privilegiada, siendo para uso exclusivo del destinatario. Si Vd. no es el destinatario o lo ha recibido por error, por favor, informe inmediatamente al emisor y destrúyalo. Está estrictamente prohibido por la legislación vigente realizar sin autorización cualquier copia, revelación o distribución del contenido de este mensaje sin la autorización expresa del remitente. Las opiniones expresadas en este correo son las de su autor y no son, necesariamente, compartidas por Autentia Real Business Solutions S.L. > > This e-mail, and in the case of any file annexed to it, may contain confidential and/or privileged information, and it is exclusively for the use of the addresses of the message. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden by current legislation. The points of view expressed in this e-mail are solely those of the author and may not necessarily be from, or supported by, Autentia Real Business Solutions S.L. > |
From: Alejandro P. G. <ale...@au...> - 2010-05-20 13:46:00
|
Hi I'm sorry, but I thikn that I don't understand your question. If you want to cover the "else" sentence (the sentence you marked with "THIS LINE") you only have to do "false" the yesNo expresion. I don't understand where is the problem. Regards 2010/5/20 Anton Trapp <tm...@al...> > Hi! > > How can I cover the 4 branches of: > > if (yesNo) { > verifyTrue(selenium.isTextPresent("secure page")); > } else { > verifyFalse(selenium.isTextPresent("secure page")); <-- THIS LINE??? > } > > Code coverage is 100%, this test is called multiple times (yes I do perform > a code coverage of the tests, please do NOT ask why...) with yesNo both true > and false. So how can I test the 4 branches in the function calls that I > don't even see and why are there no function calls in the second line which > is almost identical. > > I always thought that branches are only for control structures like if, > ...? > > Anybody can help me? > > Thank you very much in advance! > > Regards, > Anton > > > ------------------------------------------------------------------------------ > > > _______________________________________________ > Cobertura-devel mailing list > Cob...@li... > https://lists.sourceforge.net/lists/listinfo/cobertura-devel > > -- Alejandro Pérez García Socio fundador de Autentia y www.adictosaltrabajo.com (Formación, Consultoría, Desarrollo de sistemas transaccionales) mailto:ale...@au... Tel.: 655 99 11 75 Autentia Real Business Solutions S.L. "Soporte a Desarrollo" http://www.autentia.com Este mensaje, y en su caso cualquier fichero anexo al mismo, puede contener información confidencial y/o privilegiada, siendo para uso exclusivo del destinatario. Si Vd. no es el destinatario o lo ha recibido por error, por favor, informe inmediatamente al emisor y destrúyalo. Está estrictamente prohibido por la legislación vigente realizar sin autorización cualquier copia, revelación o distribución del contenido de este mensaje sin la autorización expresa del remitente. Las opiniones expresadas en este correo son las de su autor y no son, necesariamente, compartidas por Autentia Real Business Solutions S.L. This e-mail, and in the case of any file annexed to it, may contain confidential and/or privileged information, and it is exclusively for the use of the addresses of the message. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden by current legislation. The points of view expressed in this e-mail are solely those of the author and may not necessarily be from, or supported by, Autentia Real Business Solutions S.L. |
From: Anton T. <tm...@al...> - 2010-05-20 13:29:25
|
Hi! How can I cover the 4 branches of: if (yesNo) { verifyTrue(selenium.isTextPresent("secure page")); } else { verifyFalse(selenium.isTextPresent("secure page")); <-- THIS LINE??? } Code coverage is 100%, this test is called multiple times (yes I do perform a code coverage of the tests, please do NOT ask why...) with yesNo both true and false. So how can I test the 4 branches in the function calls that I don't even see and why are there no function calls in the second line which is almost identical. I always thought that branches are only for control structures like if, ...? Anybody can help me? Thank you very much in advance! Regards, Anton |
From: John W. L. <Joh...@sa...> - 2010-05-20 02:08:46
|
1.8 works with Java 1.4. From: Jeremy Thomerson [mailto:jth...@us...] Sent: Wednesday, May 19, 2010 9:28 PM To: Yerukala, Chandra (US - Austin); cobertura-devel Subject: Re: [Cobertura-devel] FW: cobertura I actually don't know - I have been inactive on Cobertura for quite a while. Someone from the list should be able to help. Jeremy On Wed, May 19, 2010 at 5:33 PM, Yerukala, Chandra (US - Austin) <cye...@de...<mailto:cye...@de...>> wrote: Best Regards, Chandra Yerukala T&PM | Public Sector Deloitte Consulting LLP 400 W. 15th Street, Austin TX 78701 | United States Tel/Direct 512 691 2198 | Mobile 602 770 0603 | Fax 512 480 1318 cye...@de...<mailto:cye...@de...> | www.deloitte.com<http://www.deloitte.com> P Please consider the environment before printing. From: Yerukala, Chandra (US - Austin) Sent: Wednesday, May 19, 2010 5:29 PM To: 'cob...@li...<mailto:cob...@li...>' Subject: cobertura Hello, Thank you for great work you are doing for the java community. We need your help; we have JDK 1.4 application, could you please tell which version of cobertura would help us? Cobertura 1.9 runs only on JDK1.5 or newer, I need Cobertura version to work on JDK 1.4 Best Regards, Chandra Yerukala T&PM | Public Sector Deloitte Consulting LLP 400 W. 15th Street, Austin TX 78701 | United States Tel/Direct 512 691 2198 | Mobile 602 770 0603 | Fax 512 480 1318 cye...@de...<mailto:cye...@de...> | www.deloitte.com<http://www.deloitte.com> P Please consider the environment before printing. This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message. Any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. [v.E.1] |
From: Jeremy T. <jth...@us...> - 2010-05-20 01:28:12
|
I actually don't know - I have been inactive on Cobertura for quite a while. Someone from the list should be able to help. Jeremy On Wed, May 19, 2010 at 5:33 PM, Yerukala, Chandra (US - Austin) < cye...@de...> wrote: > > > > > Best Regards, > > * * > > Chandra Yerukala > > T&PM | Public Sector > > Deloitte Consulting LLP > > 400 W. 15th Street, Austin TX 78701 | United States > > Tel/Direct 512 691 2198 | Mobile 602 770 0603 | Fax 512 480 1318 > > cye...@de... | www.deloitte.com > > > > P Please consider the environment before printing. > > > > *From:* Yerukala, Chandra (US - Austin) > *Sent:* Wednesday, May 19, 2010 5:29 PM > *To:* 'cob...@li...' > *Subject:* cobertura > > > > Hello, > > Thank you for great work you are doing for the java community. We need your > help; we have JDK 1.4 application, could you please tell which version of > cobertura would help us? > > > > *Cobertura 1.9 runs only on JDK1.5 or newer, I need Cobertura version to > work on JDK 1.4* > > > > > > Best Regards, > > * * > > Chandra Yerukala > > T&PM | Public Sector > > Deloitte Consulting LLP > > 400 W. 15th Street, Austin TX 78701 | United States > > Tel/Direct 512 691 2198 | Mobile 602 770 0603 | Fax 512 480 1318 > > cye...@de... | www.deloitte.com > > > > P Please consider the environment before printing. > > > > > This message (including any attachments) contains confidential information > intended for a specific individual and purpose, and is protected by law. If > you are not the intended recipient, you should delete this message. > > Any disclosure, copying, or distribution of this message, or the taking of > any action based on it, is strictly prohibited. [v.E.1] > |
From: Holmes, D. <Dan...@ne...> - 2010-05-04 14:49:13
|
I noticed on a simple class that the annotation for a method was listed as not covered while every line in the method itself was. This resulted in a less than 100% coverage metric. What is cobertura's approach in terms of Java annotations and coverage counting? Daniel The thing about quick and dirty fixes is that the dirty remains long after the quick has been forgotten. |
From: tte5 <jt...@em...> - 2010-04-30 11:27:48
|
This is not a problem with some old files. Maybe I did not explain it clearly. Imagine I have a maven project with 2 maven modules - "project-api" and "project-impl" The module "project-api" contains class "com.devel.A.class", the module "project-impl" contains class "com.devel.B.class". Now I use the cobertura maven plugin on both modules and I get "cobertura.ser" files and reports in both modules. They are ok. Now I use ant task <cobertura-merge> and create one "csummary.ser" file from both "cobertura.ser" files. Ant than I use ant task <cobertura-report> and create a report from "csummary.ser" file. When I look into this summary report I can see the package "com.devel", I can see the "com.devel.A.class" but there is missing the "com.devel.B.class". So I think this is a bug either in the merge or in the report generation. Be sure that you delete the merged .ser file from the previous run before merging. The symptoms you describe are slightly different than mine but could be caused by the same issue. -- View this message in context: http://old.nabble.com/Cobertura-in-maven-multi-module-project---problem-with-merge-tp28287958p28411239.html Sent from the cobertura-devel mailing list archive at Nabble.com. |
From: Khue Vu <kh...@gm...> - 2010-04-30 02:08:48
|
Dear John Thank you very much for your help. I finally get it works. :D. It turns out that there is the cobertura.ser file generated under C:/Users/...../AppData/JDeveloper/.../DefaultDomain . as I am using the WL integrated with JDeveloper. I don't know why it didn't appear under my search, Maybe the folder under protection. Best regards Khue. On Fri, Apr 30, 2010 at 4:33 AM, John W. Lewis <Joh...@sa...> wrote: > > > I don’t see where you are deleting classes.dir. Just make sure you do not > instrument classes that are already instrumented. > > > > Correct me if I am wrong, but your tests run in a different process than > your application. Your application runs in weblogic, right? If so, then > adding the code from the FAQ to the teardown methods will not work. You > have to execute the code in weblogic. There is a coberturaFlush.war file > that can be loaded into weblogic that can assist with this. Then, you can > just call a URL to do the flush. I can find the URL for you if you want to > do it this way. > > > > Next, I see that gems.ejb.file is created with the instrumented classes in > it, but I do not see anywhere gems.ejb.file is being used. I see a > gems.ejb.file.name in the package-gems-ear-for-apps-server, but that is > not gems.ejb.file. So, I’m not even certain that weblogic is loading the > instrumented classes. If this is the case, then the only thing you would > see in the ${basedir}/cobertura.ser file is the coverage of classes loaded > by the test client. I’m assuming your tests do not exercise any of the > instrumented classes directly. The tests exercise the application by > communication with weblogic. Therefore, the coverage would be zero. > > > > Next, I would not put the cobertura.jar into the gems.ear.file. You will > want weblogic to load that in its root classloader. In Tomcat, that means > putting the cobertura.jar in Tomcat’s lib directory. I don’t know the > corresponding directory in weblogic. > > > > Some old code of mine makes me think that we used to put the cobertura.ser > file under weblogic’s installation dir under user_projects/domains/MyDomain. > > > > John > > > > > > > > *From:* Khue Vu [mailto:kh...@gm...] > *Sent:* Thursday, April 29, 2010 6:28 AM > *To:* John W. Lewis > *Cc:* cob...@li... > *Subject:* Re: [Cobertura-devel] Using Cobertura with cactus test: > > > > Hi John, > > I search over my harddisk a few time but the file nowhere to be found. > There is only the cobertura.ser file generated when I first instrumented the > classes. If I generate report from this one, there will be 0% coverage. > > > > It definitely need to save to the ser file somewhere right? as I get it > from WL log output: > > > > Flushing results... > > Flushing results done > > Cobertura: Loaded information on 23 classes. > > Cobertura: Saved information on 23 classes. > > > > Is there away I can force cobertura to print out where it save information > to ? > > > > Thanks for your help > > Regards > > Khue. > > > > > > On Thu, Apr 29, 2010 at 6:08 PM, John W. Lewis <Joh...@sa...> > wrote: > > > > The cobertura.ser that is being updated by weblogic is bound to be on your > hard drive somewhere. I would search the entire hard drive if you have to, > but first I would look under the entire weblogic installation. Let me know > how it goes. > > > > John > > > > *From:* Khue Vu [mailto:kh...@gm...] > *Sent:* Thursday, April 29, 2010 1:59 AM > *To:* cob...@li... > *Subject:* [Cobertura-devel] Using Cobertura with cactus test: > > > > Hi all > > > > I have problem when using cobertura with cactus. I run the test and flush > the result fine. Here is the output log of Weblogic Server: > > *Flushing results...* > > *Flushing results done* > > *Cobertura: Loaded information on 23 classes.* > > *Cobertura: Saved information on 23 classes.* > > *Flushing results...* > > *Flushing results done* > > *Cobertura: Loaded information on 23 classes.* > > *Cobertura: Saved information on 23 classes.* > > *Query is null* > > *Total size is 88* > > *First result is 0* > > *maxRows is 25* > > *result size is 25* > > *Flushing results...* > > *Flushing results done* > > *Cobertura: Loaded information on 23 classes.* > > *Cobertura: Saved information on 23 classes.* > > *Query is null* > > *Total size is 10* > > *First result is 0* > > *maxRows is 25* > > *result size is 10* > > *Flushing results...* > > *Flushing results done* > > *Cobertura: Loaded information on 23 classes.* > > *Cobertura: Saved information on 23 classes.* > > > > So the result is flushed but when the coverage report is generated, I > always get 0% coverage. And according to the Cobertura FAQ, there will be > cobertura.ser file in the working directory of server(WLHOME/server/bin) but > I can't find it there. ( I add the code from FAQ to tearDown() methods of > test cases so that server need not to shutdown to flush the result: > > try { > > String className = "net.sourceforge.cobertura.coveragedata.ProjectData"; > > String methodName = "saveGlobalProjectData"; > > Class saveClass = Class.forName(className); > > java.lang.reflect.Method saveMethod = saveClass.getDeclaredMethod(methodName, new Class[0]); > > saveMethod.invoke(null,new Object[0]); > > } catch (Throwable t) { > > } > > > > > > > > > ) > > > > Any suggestion? What did I do wrong? > > Here is part of my build.xml file: > > > > > > > > <target name="intrument-classes-for-coverage-testing" depends="move-toplink-files-to-deployment-folder, compile-gems" > > > <echo message="--instrumenting classes--" /> > > <!-- delete the cobertura file which contain the info of instrumented classes --> > > <delete file="${basedir}/cobertura.ser" /> > > <cobertura-instrument > > > <fileset dir="${classes.dir}"> > > <include name="**" /> > > </fileset> > > </cobertura-instrument> > > <!-- generated cobertura.ser is at base by default --> > > </target> > > ... > > <target name="package-gems-ejb" > depends="intrument-classes-for-coverage-testing" description="compiles and > packages the gems ejb jar file"> > > <echo message="--- Packaging gems ejb ---"></echo> > > <delete file="${gems.ejb.file}"/> > > <jar destfile="${gems.ejb.file}"> > > <fileset dir="${classes.dir}"> > > <include name="**"/> > > </fileset> > > <fileset dir="${gems.base.dir}"> > > <include name="toplink\DAPS\descriptors\*.xml"/> > > </fileset> > > <metainf dir="${gems.source.dir}/META-INF"> > > <include name="*.xml"/> > > </metainf> > > <manifest> > > <attribute name="Class-Path" value="${search.jar.file.name} > commons-logging.jar cobertura.jar" /> > > </manifest> > > </jar> > > </target> > > > > <target name="package-gems-ear-for-apps-server" description="compiles and > packages the ear file, " > > depends="package-gems-ejb"> > > <echo message="${gems.ear.file}" /> > > <delete file="${gems.ear.file}"/> > > > > <ear destfile="${gems.ear.file}" > appxml="${gems.config.dir}/META-INF/application.xml"> > > <fileset dir="${deployment.dir}"> > > <include name="${gems.ejb.file.name}"/> > > <include name="${search.jar.file.name}"/> > > </fileset> > > <fileset dir="${buildlib.dir}"> > > <include name="commons-logging.jar" /> > > </fileset> > > <fileset dir="${cobertura.dir}" > > > <include name="cobertura.jar" /> > > > > </fileset> > > <metainf dir="${gems.config.dir}/META-INF"> > > <include name="weblogic-application.xml"/> > > > > </metainf> > > > > </ear> > > </target> > > > > <target name="cactify-gems-ear-file" > depends="package-war-file-for-gems-test-cases"> > > <echo message="--Cactifying ear file--" /> > > <cactifyear srcfile="${gems.ear.file}" > destfile="${gems.cactified.ear.file}"> > > <cactuswar srcfile="${gems.cactus.test.war.file}" > context="DapsWS-DataModel-context-root" /> > > > > </cactifyear> > > </target> > > > > <!-- deploy to gems-ear to application server --> > > <target name="deploy-cactified-gems-ear-to-app-server" > depends="cactify-gems-ear-file"> > > <echo message="--Deploying to app server--" /> > > > > <wldeploy > > action="deploy" verbose="true" debug="true" > > name="GEMS" source="${gems.cactified.ear.file}" > > user="weblogic" password="weblogic1" > > adminurl="t3://localhost:7101" targets="DefaultServer" /> > > </target> > > <target name="move-cactus.properties" > depends="deploy-cactified-gems-ear-to-app-server"> > > <echo message="Moving" /> > > <copy todir="${deployment.dir}/classes" > > > <fileset dir="${gems.base.dir}/classes"> > > <include name="cactus.properties" /> > > </fileset> > > </copy> > > </target> > > > > <target name="run-with-junit" depends="move-cactus.properties"> > > <junit printsummary="false" fork="yes" forkmode="once" > > > > > <sysproperty key="net.sourceforge.cobertura.datafile" > > file="${basedir}/cobertura.ser" /> > > <formatter type="brief" usefile="false" /> > > <formatter type="xml" /> > > > > <classpath location="${classes.dir}" /> > > <classpath location="${test.classes.dir}" /> > > <classpath refid="cactus.classpath" /> > > <classpath refid="buildlib" /> > > <classpath refid="testlib" /> > > <classpath refid="cobertura.classpath" /> > > <test name="packagename.TestClass" todir="${test.report.dir}"> > > </test> > > </junit> > > > > </target> > > > > > > <target name="generate-coverage-report"> > > <cobertura-report format="html" destdir="${coverage.report.dir}" > srcdir="${gems.source.dir}" datafile="${basedir}/cobertura.ser" /> > > </target> > > > > Thank you very much. > > > > > > > > > |
From: John W. L. <Joh...@sa...> - 2010-04-29 20:33:45
|
I don't see where you are deleting classes.dir. Just make sure you do not instrument classes that are already instrumented. Correct me if I am wrong, but your tests run in a different process than your application. Your application runs in weblogic, right? If so, then adding the code from the FAQ to the teardown methods will not work. You have to execute the code in weblogic. There is a coberturaFlush.war file that can be loaded into weblogic that can assist with this. Then, you can just call a URL to do the flush. I can find the URL for you if you want to do it this way. Next, I see that gems.ejb.file is created with the instrumented classes in it, but I do not see anywhere gems.ejb.file is being used. I see a gems.ejb.file.name in the package-gems-ear-for-apps-server, but that is not gems.ejb.file. So, I'm not even certain that weblogic is loading the instrumented classes. If this is the case, then the only thing you would see in the ${basedir}/cobertura.ser file is the coverage of classes loaded by the test client. I'm assuming your tests do not exercise any of the instrumented classes directly. The tests exercise the application by communication with weblogic. Therefore, the coverage would be zero. Next, I would not put the cobertura.jar into the gems.ear.file. You will want weblogic to load that in its root classloader. In Tomcat, that means putting the cobertura.jar in Tomcat's lib directory. I don't know the corresponding directory in weblogic. Some old code of mine makes me think that we used to put the cobertura.ser file under weblogic's installation dir under user_projects/domains/MyDomain. John From: Khue Vu [mailto:kh...@gm...] Sent: Thursday, April 29, 2010 6:28 AM To: John W. Lewis Cc: cob...@li... Subject: Re: [Cobertura-devel] Using Cobertura with cactus test: Hi John, I search over my harddisk a few time but the file nowhere to be found. There is only the cobertura.ser file generated when I first instrumented the classes. If I generate report from this one, there will be 0% coverage. It definitely need to save to the ser file somewhere right? as I get it from WL log output: Flushing results... Flushing results done Cobertura: Loaded information on 23 classes. Cobertura: Saved information on 23 classes. Is there away I can force cobertura to print out where it save information to ? Thanks for your help Regards Khue. On Thu, Apr 29, 2010 at 6:08 PM, John W. Lewis <Joh...@sa...<mailto:Joh...@sa...>> wrote: The cobertura.ser that is being updated by weblogic is bound to be on your hard drive somewhere. I would search the entire hard drive if you have to, but first I would look under the entire weblogic installation. Let me know how it goes. John From: Khue Vu [mailto:kh...@gm...<mailto:kh...@gm...>] Sent: Thursday, April 29, 2010 1:59 AM To: cob...@li...<mailto:cob...@li...> Subject: [Cobertura-devel] Using Cobertura with cactus test: Hi all I have problem when using cobertura with cactus. I run the test and flush the result fine. Here is the output log of Weblogic Server: Flushing results... Flushing results done Cobertura: Loaded information on 23 classes. Cobertura: Saved information on 23 classes. Flushing results... Flushing results done Cobertura: Loaded information on 23 classes. Cobertura: Saved information on 23 classes. Query is null Total size is 88 First result is 0 maxRows is 25 result size is 25 Flushing results... Flushing results done Cobertura: Loaded information on 23 classes. Cobertura: Saved information on 23 classes. Query is null Total size is 10 First result is 0 maxRows is 25 result size is 10 Flushing results... Flushing results done Cobertura: Loaded information on 23 classes. Cobertura: Saved information on 23 classes. So the result is flushed but when the coverage report is generated, I always get 0% coverage. And according to the Cobertura FAQ, there will be cobertura.ser file in the working directory of server(WLHOME/server/bin) but I can't find it there. ( I add the code from FAQ to tearDown() methods of test cases so that server need not to shutdown to flush the result: try { String className = "net.sourceforge.cobertura.coveragedata.ProjectData"; String methodName = "saveGlobalProjectData"; Class saveClass = Class.forName(className); java.lang.reflect.Method saveMethod = saveClass.getDeclaredMethod(methodName, new Class[0]); saveMethod.invoke(null,new Object[0]); } catch (Throwable t) { } ) Any suggestion? What did I do wrong? Here is part of my build.xml file: <target name="intrument-classes-for-coverage-testing" depends="move-toplink-files-to-deployment-folder, compile-gems" > <echo message="--instrumenting classes--" /> <!-- delete the cobertura file which contain the info of instrumented classes --> <delete file="${basedir}/cobertura.ser" /> <cobertura-instrument > <fileset dir="${classes.dir}"> <include name="**" /> </fileset> </cobertura-instrument> <!-- generated cobertura.ser is at base by default --> </target> ... <target name="package-gems-ejb" depends="intrument-classes-for-coverage-testing" description="compiles and packages the gems ejb jar file"> <echo message="--- Packaging gems ejb ---"></echo> <delete file="${gems.ejb.file}"/> <jar destfile="${gems.ejb.file}"> <fileset dir="${classes.dir}"> <include name="**"/> </fileset> <fileset dir="${gems.base.dir}"> <include name="toplink\DAPS\descriptors\*.xml"/> </fileset> <metainf dir="${gems.source.dir}/META-INF"> <include name="*.xml"/> </metainf> <manifest> <attribute name="Class-Path" value="${search.jar.file.name<http://search.jar.file.name>} commons-logging.jar cobertura.jar" /> </manifest> </jar> </target> <target name="package-gems-ear-for-apps-server" description="compiles and packages the ear file, " depends="package-gems-ejb"> <echo message="${gems.ear.file}" /> <delete file="${gems.ear.file}"/> <ear destfile="${gems.ear.file}" appxml="${gems.config.dir}/META-INF/application.xml"> <fileset dir="${deployment.dir}"> <include name="${gems.ejb.file.name<http://gems.ejb.file.name>}"/> <include name="${search.jar.file.name<http://search.jar.file.name>}"/> </fileset> <fileset dir="${buildlib.dir}"> <include name="commons-logging.jar" /> </fileset> <fileset dir="${cobertura.dir}" > <include name="cobertura.jar" /> </fileset> <metainf dir="${gems.config.dir}/META-INF"> <include name="weblogic-application.xml"/> </metainf> </ear> </target> <target name="cactify-gems-ear-file" depends="package-war-file-for-gems-test-cases"> <echo message="--Cactifying ear file--" /> <cactifyear srcfile="${gems.ear.file}" destfile="${gems.cactified.ear.file}"> <cactuswar srcfile="${gems.cactus.test.war.file}" context="DapsWS-DataModel-context-root" /> </cactifyear> </target> <!-- deploy to gems-ear to application server --> <target name="deploy-cactified-gems-ear-to-app-server" depends="cactify-gems-ear-file"> <echo message="--Deploying to app server--" /> <wldeploy action="deploy" verbose="true" debug="true" name="GEMS" source="${gems.cactified.ear.file}" user="weblogic" password="weblogic1" adminurl="t3://localhost:7101" targets="DefaultServer" /> </target> <target name="move-cactus.properties" depends="deploy-cactified-gems-ear-to-app-server"> <echo message="Moving" /> <copy todir="${deployment.dir}/classes" > <fileset dir="${gems.base.dir}/classes"> <include name="cactus.properties" /> </fileset> </copy> </target> <target name="run-with-junit" depends="move-cactus.properties"> <junit printsummary="false" fork="yes" forkmode="once" > <sysproperty key="net.sourceforge.cobertura.datafile" file="${basedir}/cobertura.ser" /> <formatter type="brief" usefile="false" /> <formatter type="xml" /> <classpath location="${classes.dir}" /> <classpath location="${test.classes.dir}" /> <classpath refid="cactus.classpath" /> <classpath refid="buildlib" /> <classpath refid="testlib" /> <classpath refid="cobertura.classpath" /> <test name="packagename.TestClass" todir="${test.report.dir}"> </test> </junit> </target> <target name="generate-coverage-report"> <cobertura-report format="html" destdir="${coverage.report.dir}" srcdir="${gems.source.dir}" datafile="${basedir}/cobertura.ser" /> </target> Thank you very much. |
From: Khue Vu <kh...@gm...> - 2010-04-29 10:28:52
|
Hi John, I search over my harddisk a few time but the file nowhere to be found. There is only the cobertura.ser file generated when I first instrumented the classes. If I generate report from this one, there will be 0% coverage. It definitely need to save to the ser file somewhere right? as I get it from WL log output: Flushing results... Flushing results done Cobertura: Loaded information on 23 classes. Cobertura: Saved information on 23 classes. Is there away I can force cobertura to print out where it save information to ? Thanks for your help Regards Khue. On Thu, Apr 29, 2010 at 6:08 PM, John W. Lewis <Joh...@sa...> wrote: > > > The cobertura.ser that is being updated by weblogic is bound to be on your > hard drive somewhere. I would search the entire hard drive if you have to, > but first I would look under the entire weblogic installation. Let me know > how it goes. > > > > John > > > > *From:* Khue Vu [mailto:kh...@gm...] > *Sent:* Thursday, April 29, 2010 1:59 AM > *To:* cob...@li... > *Subject:* [Cobertura-devel] Using Cobertura with cactus test: > > > > Hi all > > > > I have problem when using cobertura with cactus. I run the test and flush > the result fine. Here is the output log of Weblogic Server: > > *Flushing results...* > > *Flushing results done* > > *Cobertura: Loaded information on 23 classes.* > > *Cobertura: Saved information on 23 classes.* > > *Flushing results...* > > *Flushing results done* > > *Cobertura: Loaded information on 23 classes.* > > *Cobertura: Saved information on 23 classes.* > > *Query is null* > > *Total size is 88* > > *First result is 0* > > *maxRows is 25* > > *result size is 25* > > *Flushing results...* > > *Flushing results done* > > *Cobertura: Loaded information on 23 classes.* > > *Cobertura: Saved information on 23 classes.* > > *Query is null* > > *Total size is 10* > > *First result is 0* > > *maxRows is 25* > > *result size is 10* > > *Flushing results...* > > *Flushing results done* > > *Cobertura: Loaded information on 23 classes.* > > *Cobertura: Saved information on 23 classes.* > > > > So the result is flushed but when the coverage report is generated, I > always get 0% coverage. And according to the Cobertura FAQ, there will be > cobertura.ser file in the working directory of server(WLHOME/server/bin) but > I can't find it there. ( I add the code from FAQ to tearDown() methods of > test cases so that server need not to shutdown to flush the result: > > try { > > String className = "net.sourceforge.cobertura.coveragedata.ProjectData"; > > String methodName = "saveGlobalProjectData"; > > Class saveClass = Class.forName(className); > > java.lang.reflect.Method saveMethod = saveClass.getDeclaredMethod(methodName, new Class[0]); > > saveMethod.invoke(null,new Object[0]); > > } catch (Throwable t) { > > } > > > > > ) > > > > Any suggestion? What did I do wrong? > > Here is part of my build.xml file: > > > > > > <target name="intrument-classes-for-coverage-testing" depends="move-toplink-files-to-deployment-folder, compile-gems" > > > <echo message="--instrumenting classes--" /> > > <!-- delete the cobertura file which contain the info of instrumented classes --> > > <delete file="${basedir}/cobertura.ser" /> > > <cobertura-instrument > > > <fileset dir="${classes.dir}"> > > <include name="**" /> > > </fileset> > > </cobertura-instrument> > > <!-- generated cobertura.ser is at base by default --> > > </target> > > ... > > <target name="package-gems-ejb" > depends="intrument-classes-for-coverage-testing" description="compiles and > packages the gems ejb jar file"> > > <echo message="--- Packaging gems ejb ---"></echo> > > <delete file="${gems.ejb.file}"/> > > <jar destfile="${gems.ejb.file}"> > > <fileset dir="${classes.dir}"> > > <include name="**"/> > > </fileset> > > <fileset dir="${gems.base.dir}"> > > <include name="toplink\DAPS\descriptors\*.xml"/> > > </fileset> > > <metainf dir="${gems.source.dir}/META-INF"> > > <include name="*.xml"/> > > </metainf> > > <manifest> > > <attribute name="Class-Path" value="${search.jar.file.name} > commons-logging.jar cobertura.jar" /> > > </manifest> > > </jar> > > </target> > > > > <target name="package-gems-ear-for-apps-server" description="compiles and > packages the ear file, " > > depends="package-gems-ejb"> > > <echo message="${gems.ear.file}" /> > > <delete file="${gems.ear.file}"/> > > > > <ear destfile="${gems.ear.file}" > appxml="${gems.config.dir}/META-INF/application.xml"> > > <fileset dir="${deployment.dir}"> > > <include name="${gems.ejb.file.name}"/> > > <include name="${search.jar.file.name}"/> > > </fileset> > > <fileset dir="${buildlib.dir}"> > > <include name="commons-logging.jar" /> > > </fileset> > > <fileset dir="${cobertura.dir}" > > > <include name="cobertura.jar" /> > > > > </fileset> > > <metainf dir="${gems.config.dir}/META-INF"> > > <include name="weblogic-application.xml"/> > > > > </metainf> > > > > </ear> > > </target> > > > > <target name="cactify-gems-ear-file" > depends="package-war-file-for-gems-test-cases"> > > <echo message="--Cactifying ear file--" /> > > <cactifyear srcfile="${gems.ear.file}" > destfile="${gems.cactified.ear.file}"> > > <cactuswar srcfile="${gems.cactus.test.war.file}" > context="DapsWS-DataModel-context-root" /> > > > > </cactifyear> > > </target> > > > > <!-- deploy to gems-ear to application server --> > > <target name="deploy-cactified-gems-ear-to-app-server" > depends="cactify-gems-ear-file"> > > <echo message="--Deploying to app server--" /> > > > > <wldeploy > > action="deploy" verbose="true" debug="true" > > name="GEMS" source="${gems.cactified.ear.file}" > > user="weblogic" password="weblogic1" > > adminurl="t3://localhost:7101" targets="DefaultServer" /> > > </target> > > <target name="move-cactus.properties" > depends="deploy-cactified-gems-ear-to-app-server"> > > <echo message="Moving" /> > > <copy todir="${deployment.dir}/classes" > > > <fileset dir="${gems.base.dir}/classes"> > > <include name="cactus.properties" /> > > </fileset> > > </copy> > > </target> > > > > <target name="run-with-junit" depends="move-cactus.properties"> > > <junit printsummary="false" fork="yes" forkmode="once" > > > > > <sysproperty key="net.sourceforge.cobertura.datafile" > > file="${basedir}/cobertura.ser" /> > > <formatter type="brief" usefile="false" /> > > <formatter type="xml" /> > > > > <classpath location="${classes.dir}" /> > > <classpath location="${test.classes.dir}" /> > > <classpath refid="cactus.classpath" /> > > <classpath refid="buildlib" /> > > <classpath refid="testlib" /> > > <classpath refid="cobertura.classpath" /> > > <test name="packagename.TestClass" todir="${test.report.dir}"> > > </test> > > </junit> > > > > </target> > > > > > > <target name="generate-coverage-report"> > > <cobertura-report format="html" destdir="${coverage.report.dir}" > srcdir="${gems.source.dir}" datafile="${basedir}/cobertura.ser" /> > > </target> > > > > Thank you very much. > > > > > > > |
From: John W. L. <Joh...@sa...> - 2010-04-29 10:08:32
|
The cobertura.ser that is being updated by weblogic is bound to be on your hard drive somewhere. I would search the entire hard drive if you have to, but first I would look under the entire weblogic installation. Let me know how it goes. John From: Khue Vu [mailto:kh...@gm...] Sent: Thursday, April 29, 2010 1:59 AM To: cob...@li... Subject: [Cobertura-devel] Using Cobertura with cactus test: Hi all I have problem when using cobertura with cactus. I run the test and flush the result fine. Here is the output log of Weblogic Server: Flushing results... Flushing results done Cobertura: Loaded information on 23 classes. Cobertura: Saved information on 23 classes. Flushing results... Flushing results done Cobertura: Loaded information on 23 classes. Cobertura: Saved information on 23 classes. Query is null Total size is 88 First result is 0 maxRows is 25 result size is 25 Flushing results... Flushing results done Cobertura: Loaded information on 23 classes. Cobertura: Saved information on 23 classes. Query is null Total size is 10 First result is 0 maxRows is 25 result size is 10 Flushing results... Flushing results done Cobertura: Loaded information on 23 classes. Cobertura: Saved information on 23 classes. So the result is flushed but when the coverage report is generated, I always get 0% coverage. And according to the Cobertura FAQ, there will be cobertura.ser file in the working directory of server(WLHOME/server/bin) but I can't find it there. ( I add the code from FAQ to tearDown() methods of test cases so that server need not to shutdown to flush the result: try { String className = "net.sourceforge.cobertura.coveragedata.ProjectData"; String methodName = "saveGlobalProjectData"; Class saveClass = Class.forName(className); java.lang.reflect.Method saveMethod = saveClass.getDeclaredMethod(methodName, new Class[0]); saveMethod.invoke(null,new Object[0]); } catch (Throwable t) { } ) Any suggestion? What did I do wrong? Here is part of my build.xml file: <target name="intrument-classes-for-coverage-testing" depends="move-toplink-files-to-deployment-folder, compile-gems" > <echo message="--instrumenting classes--" /> <!-- delete the cobertura file which contain the info of instrumented classes --> <delete file="${basedir}/cobertura.ser" /> <cobertura-instrument > <fileset dir="${classes.dir}"> <include name="**" /> </fileset> </cobertura-instrument> <!-- generated cobertura.ser is at base by default --> </target> ... <target name="package-gems-ejb" depends="intrument-classes-for-coverage-testing" description="compiles and packages the gems ejb jar file"> <echo message="--- Packaging gems ejb ---"></echo> <delete file="${gems.ejb.file}"/> <jar destfile="${gems.ejb.file}"> <fileset dir="${classes.dir}"> <include name="**"/> </fileset> <fileset dir="${gems.base.dir}"> <include name="toplink\DAPS\descriptors\*.xml"/> </fileset> <metainf dir="${gems.source.dir}/META-INF"> <include name="*.xml"/> </metainf> <manifest> <attribute name="Class-Path" value="${search.jar.file.name<http://search.jar.file.name>} commons-logging.jar cobertura.jar" /> </manifest> </jar> </target> <target name="package-gems-ear-for-apps-server" description="compiles and packages the ear file, " depends="package-gems-ejb"> <echo message="${gems.ear.file}" /> <delete file="${gems.ear.file}"/> <ear destfile="${gems.ear.file}" appxml="${gems.config.dir}/META-INF/application.xml"> <fileset dir="${deployment.dir}"> <include name="${gems.ejb.file.name<http://gems.ejb.file.name>}"/> <include name="${search.jar.file.name<http://search.jar.file.name>}"/> </fileset> <fileset dir="${buildlib.dir}"> <include name="commons-logging.jar" /> </fileset> <fileset dir="${cobertura.dir}" > <include name="cobertura.jar" /> </fileset> <metainf dir="${gems.config.dir}/META-INF"> <include name="weblogic-application.xml"/> </metainf> </ear> </target> <target name="cactify-gems-ear-file" depends="package-war-file-for-gems-test-cases"> <echo message="--Cactifying ear file--" /> <cactifyear srcfile="${gems.ear.file}" destfile="${gems.cactified.ear.file}"> <cactuswar srcfile="${gems.cactus.test.war.file}" context="DapsWS-DataModel-context-root" /> </cactifyear> </target> <!-- deploy to gems-ear to application server --> <target name="deploy-cactified-gems-ear-to-app-server" depends="cactify-gems-ear-file"> <echo message="--Deploying to app server--" /> <wldeploy action="deploy" verbose="true" debug="true" name="GEMS" source="${gems.cactified.ear.file}" user="weblogic" password="weblogic1" adminurl="t3://localhost:7101" targets="DefaultServer" /> </target> <target name="move-cactus.properties" depends="deploy-cactified-gems-ear-to-app-server"> <echo message="Moving" /> <copy todir="${deployment.dir}/classes" > <fileset dir="${gems.base.dir}/classes"> <include name="cactus.properties" /> </fileset> </copy> </target> <target name="run-with-junit" depends="move-cactus.properties"> <junit printsummary="false" fork="yes" forkmode="once" > <sysproperty key="net.sourceforge.cobertura.datafile" file="${basedir}/cobertura.ser" /> <formatter type="brief" usefile="false" /> <formatter type="xml" /> <classpath location="${classes.dir}" /> <classpath location="${test.classes.dir}" /> <classpath refid="cactus.classpath" /> <classpath refid="buildlib" /> <classpath refid="testlib" /> <classpath refid="cobertura.classpath" /> <test name="packagename.TestClass" todir="${test.report.dir}"> </test> </junit> </target> <target name="generate-coverage-report"> <cobertura-report format="html" destdir="${coverage.report.dir}" srcdir="${gems.source.dir}" datafile="${basedir}/cobertura.ser" /> </target> Thank you very much. |
From: Khue Vu <kh...@gm...> - 2010-04-29 05:59:00
|
Hi all I have problem when using cobertura with cactus. I run the test and flush the result fine. Here is the output log of Weblogic Server: *Flushing results...* *Flushing results done* *Cobertura: Loaded information on 23 classes.* *Cobertura: Saved information on 23 classes.* *Flushing results...* *Flushing results done* *Cobertura: Loaded information on 23 classes.* *Cobertura: Saved information on 23 classes.* *Query is null* *Total size is 88* *First result is 0* *maxRows is 25* *result size is 25* *Flushing results...* *Flushing results done* *Cobertura: Loaded information on 23 classes.* *Cobertura: Saved information on 23 classes.* *Query is null* *Total size is 10* *First result is 0* *maxRows is 25* *result size is 10* *Flushing results...* *Flushing results done* *Cobertura: Loaded information on 23 classes.* *Cobertura: Saved information on 23 classes.* * * So the result is flushed but when the coverage report is generated, I always get 0% coverage. And according to the Cobertura FAQ, there will be cobertura.ser file in the working directory of server(WLHOME/server/bin) but I can't find it there. ( I add the code from FAQ to tearDown() methods of test cases so that server need not to shutdown to flush the result: try { String className = "net.sourceforge.cobertura.coveragedata.ProjectData"; String methodName = "saveGlobalProjectData"; Class saveClass = Class.forName(className); java.lang.reflect.Method saveMethod = saveClass.getDeclaredMethod(methodName, new Class[0]); saveMethod.invoke(null,new Object[0]); } catch (Throwable t) { } ) Any suggestion? What did I do wrong? Here is part of my build.xml file: <target name="intrument-classes-for-coverage-testing" depends="move-toplink-files-to-deployment-folder, compile-gems" > <echo message="--instrumenting classes--" /> <!-- delete the cobertura file which contain the info of instrumented classes --> <delete file="${basedir}/cobertura.ser" /> <cobertura-instrument > <fileset dir="${classes.dir}"> <include name="**" /> </fileset> </cobertura-instrument> <!-- generated cobertura.ser is at base by default --> </target> ... <target name="package-gems-ejb" depends="intrument-classes-for-coverage-testing" description="compiles and packages the gems ejb jar file"> <echo message="--- Packaging gems ejb ---"></echo> <delete file="${gems.ejb.file}"/> <jar destfile="${gems.ejb.file}"> <fileset dir="${classes.dir}"> <include name="**"/> </fileset> <fileset dir="${gems.base.dir}"> <include name="toplink\DAPS\descriptors\*.xml"/> </fileset> <metainf dir="${gems.source.dir}/META-INF"> <include name="*.xml"/> </metainf> <manifest> <attribute name="Class-Path" value="${search.jar.file.name} commons-logging.jar cobertura.jar" /> </manifest> </jar> </target> <target name="package-gems-ear-for-apps-server" description="compiles and packages the ear file, " depends="package-gems-ejb"> <echo message="${gems.ear.file}" /> <delete file="${gems.ear.file}"/> <ear destfile="${gems.ear.file}" appxml="${gems.config.dir}/META-INF/application.xml"> <fileset dir="${deployment.dir}"> <include name="${gems.ejb.file.name}"/> <include name="${search.jar.file.name}"/> </fileset> <fileset dir="${buildlib.dir}"> <include name="commons-logging.jar" /> </fileset> <fileset dir="${cobertura.dir}" > <include name="cobertura.jar" /> </fileset> <metainf dir="${gems.config.dir}/META-INF"> <include name="weblogic-application.xml"/> </metainf> </ear> </target> <target name="cactify-gems-ear-file" depends="package-war-file-for-gems-test-cases"> <echo message="--Cactifying ear file--" /> <cactifyear srcfile="${gems.ear.file}" destfile="${gems.cactified.ear.file}"> <cactuswar srcfile="${gems.cactus.test.war.file}" context="DapsWS-DataModel-context-root" /> </cactifyear> </target> <!-- deploy to gems-ear to application server --> <target name="deploy-cactified-gems-ear-to-app-server" depends="cactify-gems-ear-file"> <echo message="--Deploying to app server--" /> <wldeploy action="deploy" verbose="true" debug="true" name="GEMS" source="${gems.cactified.ear.file}" user="weblogic" password="weblogic1" adminurl="t3://localhost:7101" targets="DefaultServer" /> </target> <target name="move-cactus.properties" depends="deploy-cactified-gems-ear-to-app-server"> <echo message="Moving" /> <copy todir="${deployment.dir}/classes" > <fileset dir="${gems.base.dir}/classes"> <include name="cactus.properties" /> </fileset> </copy> </target> <target name="run-with-junit" depends="move-cactus.properties"> <junit printsummary="false" fork="yes" forkmode="once" > <sysproperty key="net.sourceforge.cobertura.datafile" file="${basedir}/cobertura.ser" /> <formatter type="brief" usefile="false" /> <formatter type="xml" /> <classpath location="${classes.dir}" /> <classpath location="${test.classes.dir}" /> <classpath refid="cactus.classpath" /> <classpath refid="buildlib" /> <classpath refid="testlib" /> <classpath refid="cobertura.classpath" /> <test name="packagename.TestClass" todir="${test.report.dir}"> </test> </junit> </target> <target name="generate-coverage-report"> <cobertura-report format="html" destdir="${coverage.report.dir}" srcdir="${gems.source.dir}" datafile="${basedir}/cobertura.ser" /> </target> Thank you very much. |
From: Khue Vu <kh...@gm...> - 2010-04-29 01:43:04
|
Hi John It is finally done when I declare class-path in Manifest.mf file of the ejb.jar Thanks for your help. Regards K. On Thu, Apr 29, 2010 at 9:23 AM, Khue Vu <kh...@gm...> wrote: > Hi John, > Thanks for your response. I have tried to put the file in my server's lib > or pack it with the war file but it doesn't work. > Any other suggestion? > > > On Thu, Apr 29, 2010 at 2:53 AM, John W. Lewis <Joh...@sa...>wrote: > >> >> >> The NoClassDefFoundError tells me that you do not have the cobertura jar >> in the web server’s lib directory. >> >> >> >> *From:* Khue Vu [mailto:kh...@gm...] >> *Sent:* Wednesday, April 28, 2010 11:06 AM >> *To:* cob...@li... >> *Subject:* [Cobertura-devel] Problem deploying app with EJB to Server >> after instrumenting classes: >> >> >> >> Hi all >> >> after instrumenting my EJB classes and put it into jar file and deploy to >> weblogic server, I have this error: >> >> weblogic.application.ModuleException: Exception preparing module: >> EJBModule(GEMS.jar) >> >> [EJB:011023]An error occurred while reading the deployment descriptor. The >> error was: >> >> Error processing annotations: . >> >> at >> weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:454) >> >> at >> weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199) >> >> at >> weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:391) >> >> at >> weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:83) >> >> at >> weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:59) >> >> at >> weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:43) >> >> at >> weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:1221) >> >> at >> weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:83) >> >> at >> weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:367) >> >> at >> weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:54) >> >> at >> weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154) >> >> at >> weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60) >> >> at >> weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:207) >> >> at >> weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:98) >> >> at >> weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217) >> >> at >> weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:747) >> >> at >> weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1216) >> >> at >> weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:250) >> >> at >> weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159) >> >> at >> weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:157) >> >> at >> weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:12) >> >> at >> weblogic.deploy.service.internal.targetserver.DeploymentReceiverC >> >> at >> weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516) >> >> at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201) >> >> at weblogic.work.ExecuteThread.run(ExecuteThread.java:173) >> >> Caused by: weblogic.utils.ErrorCollectionException: >> >> >> >> There are 1 nested errors: >> >> >> >> weblogic.j2ee.dd.xml.AnnotationProcessException: [EJB:015001]Unable to >> link class oracle.oardc.daps.gems.eav.element.ejb.ElementFacadeEJBBean in >> Jar >> C:\Users\Napoleon\AppData\Roaming\JDeveloper\system11.1.1.2.36.55.36\DefaultDomain\servers\DefaultServer\tmp\_WL_user\GEMS\yvthsx\GEMS.jar >> : java.lang.NoClassDefFoundError: >> net/sourceforge/cobertura/coveragedata/HasBeenInstrumented >> >> at >> weblogic.j2ee.dd.xml.BaseJ2eeAnnotationProcessor.addProcessingError(BaseJ2eeAnnotationProcessor.java:1272) >> >> at >> weblogic.j2ee.dd.xml.BaseJ2eeAnnotationProcessor.addFatalProcessingError(BaseJ2eeAnnotationProcessor.java:1277) >> >> at >> weblogic.ejb.container.dd.xml.EjbAnnotationProcessor.processAnnotations(EjbAnnotationProcessor.java:168) >> >> at >> weblogic.ejb.container.dd.xml.EjbDescriptorReaderImpl.processStandardAnnotations(EjbDescriptorReaderImpl.java:344) >> >> at >> weblogic.ejb.container.dd.xml.EjbDescriptorReaderImpl.createReadOnlyDescriptorFromJarFile(EjbDescriptorReaderImpl.java:204) >> >> at >> weblogic.ejb.spi.EjbDescriptorFactory.createReadOnlyDescriptorFromJarFile(EjbDescrip >> >> at >> weblogic.ejb.container.deployer.EJBModule.loadEJBDescriptor(EJBModule.java:1210) >> >> at >> weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:382) >> >> at >> weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199) >> >> at >> weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:391) >> >> at >> weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:83) >> >> at >> weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:59) >> >> at >> weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:43) >> >> at >> weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:1221) >> >> at >> weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:83) >> >> at >> weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:367) >> >> at >> weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:54) >> >> at >> weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154) >> >> at >> weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60) >> >> at >> weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:207) >> >> at >> weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:98) >> >> at >> weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217) >> >> at >> weblogic.deploy.internal.targetserver.Deploymen.................... >> >> >> >> >> >> My deployment descriptor of the jar file is sessions.xm, >> weblogic-ejb-jar.xml >> >> >> >> I don't know what should I do. Any one has suggestion? please email to me >> as well as I haven't subscribe to the mailing list >> >> Thank you very much >> >> Best regards >> >> K. >> > > |
From: Khue Vu <kh...@gm...> - 2010-04-29 01:24:05
|
Hi John, Thanks for your response. I have tried to put the file in my server's lib or pack it with the war file but it doesn't work. Any other suggestion? On Thu, Apr 29, 2010 at 2:53 AM, John W. Lewis <Joh...@sa...> wrote: > > > The NoClassDefFoundError tells me that you do not have the cobertura jar in > the web server’s lib directory. > > > > *From:* Khue Vu [mailto:kh...@gm...] > *Sent:* Wednesday, April 28, 2010 11:06 AM > *To:* cob...@li... > *Subject:* [Cobertura-devel] Problem deploying app with EJB to Server > after instrumenting classes: > > > > Hi all > > after instrumenting my EJB classes and put it into jar file and deploy to > weblogic server, I have this error: > > weblogic.application.ModuleException: Exception preparing module: > EJBModule(GEMS.jar) > > [EJB:011023]An error occurred while reading the deployment descriptor. The > error was: > > Error processing annotations: . > > at > weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:454) > > at > weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199) > > at > weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:391) > > at > weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:83) > > at > weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:59) > > at > weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:43) > > at > weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:1221) > > at > weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:83) > > at > weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:367) > > at > weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:54) > > at > weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154) > > at > weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60) > > at > weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:207) > > at > weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:98) > > at > weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217) > > at > weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:747) > > at > weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1216) > > at > weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:250) > > at > weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159) > > at > weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:157) > > at > weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:12) > > at > weblogic.deploy.service.internal.targetserver.DeploymentReceiverC > > at > weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516) > > at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201) > > at weblogic.work.ExecuteThread.run(ExecuteThread.java:173) > > Caused by: weblogic.utils.ErrorCollectionException: > > > > There are 1 nested errors: > > > > weblogic.j2ee.dd.xml.AnnotationProcessException: [EJB:015001]Unable to link > class oracle.oardc.daps.gems.eav.element.ejb.ElementFacadeEJBBean in Jar > C:\Users\Napoleon\AppData\Roaming\JDeveloper\system11.1.1.2.36.55.36\DefaultDomain\servers\DefaultServer\tmp\_WL_user\GEMS\yvthsx\GEMS.jar > : java.lang.NoClassDefFoundError: > net/sourceforge/cobertura/coveragedata/HasBeenInstrumented > > at > weblogic.j2ee.dd.xml.BaseJ2eeAnnotationProcessor.addProcessingError(BaseJ2eeAnnotationProcessor.java:1272) > > at > weblogic.j2ee.dd.xml.BaseJ2eeAnnotationProcessor.addFatalProcessingError(BaseJ2eeAnnotationProcessor.java:1277) > > at > weblogic.ejb.container.dd.xml.EjbAnnotationProcessor.processAnnotations(EjbAnnotationProcessor.java:168) > > at > weblogic.ejb.container.dd.xml.EjbDescriptorReaderImpl.processStandardAnnotations(EjbDescriptorReaderImpl.java:344) > > at > weblogic.ejb.container.dd.xml.EjbDescriptorReaderImpl.createReadOnlyDescriptorFromJarFile(EjbDescriptorReaderImpl.java:204) > > at > weblogic.ejb.spi.EjbDescriptorFactory.createReadOnlyDescriptorFromJarFile(EjbDescrip > > at > weblogic.ejb.container.deployer.EJBModule.loadEJBDescriptor(EJBModule.java:1210) > > at > weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:382) > > at > weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199) > > at > weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:391) > > at > weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:83) > > at > weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:59) > > at > weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:43) > > at > weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:1221) > > at > weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:83) > > at > weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:367) > > at > weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:54) > > at > weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154) > > at > weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60) > > at > weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:207) > > at > weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:98) > > at > weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217) > > at > weblogic.deploy.internal.targetserver.Deploymen.................... > > > > > > My deployment descriptor of the jar file is sessions.xm, > weblogic-ejb-jar.xml > > > > I don't know what should I do. Any one has suggestion? please email to me > as well as I haven't subscribe to the mailing list > > Thank you very much > > Best regards > > K. > |
From: John W. L. <Joh...@sa...> - 2010-04-28 18:54:03
|
The NoClassDefFoundError tells me that you do not have the cobertura jar in the web server's lib directory. From: Khue Vu [mailto:kh...@gm...] Sent: Wednesday, April 28, 2010 11:06 AM To: cob...@li... Subject: [Cobertura-devel] Problem deploying app with EJB to Server after instrumenting classes: Hi all after instrumenting my EJB classes and put it into jar file and deploy to weblogic server, I have this error: weblogic.application.ModuleException: Exception preparing module: EJBModule(GEMS.jar) [EJB:011023]An error occurred while reading the deployment descriptor. The error was: Error processing annotations: . at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:454) at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199) at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:391) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:83) at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:59) at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:43) at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:1221) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:83) at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:367) at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:54) at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154) at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60) at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:207) at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:98) at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217) at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:747) at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1216) at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:250) at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:157) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:12) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverC at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201) at weblogic.work.ExecuteThread.run(ExecuteThread.java:173) Caused by: weblogic.utils.ErrorCollectionException: There are 1 nested errors: weblogic.j2ee.dd.xml.AnnotationProcessException: [EJB:015001]Unable to link class oracle.oardc.daps.gems.eav.element.ejb.ElementFacadeEJBBean in Jar C:\Users\Napoleon\AppData\Roaming\JDeveloper\system11.1.1.2.36.55.36\DefaultDomain\servers\DefaultServer\tmp\_WL_user\GEMS\yvthsx\GEMS.jar : java.lang.NoClassDefFoundError: net/sourceforge/cobertura/coveragedata/HasBeenInstrumented at weblogic.j2ee.dd.xml.BaseJ2eeAnnotationProcessor.addProcessingError(BaseJ2eeAnnotationProcessor.java:1272) at weblogic.j2ee.dd.xml.BaseJ2eeAnnotationProcessor.addFatalProcessingError(BaseJ2eeAnnotationProcessor.java:1277) at weblogic.ejb.container.dd.xml.EjbAnnotationProcessor.processAnnotations(EjbAnnotationProcessor.java:168) at weblogic.ejb.container.dd.xml.EjbDescriptorReaderImpl.processStandardAnnotations(EjbDescriptorReaderImpl.java:344) at weblogic.ejb.container.dd.xml.EjbDescriptorReaderImpl.createReadOnlyDescriptorFromJarFile(EjbDescriptorReaderImpl.java:204) at weblogic.ejb.spi.EjbDescriptorFactory.createReadOnlyDescriptorFromJarFile(EjbDescrip at weblogic.ejb.container.deployer.EJBModule.loadEJBDescriptor(EJBModule.java:1210) at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:382) at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199) at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:391) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:83) at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:59) at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:43) at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:1221) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:83) at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:367) at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:54) at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154) at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60) at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:207) at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:98) at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217) at weblogic.deploy.internal.targetserver.Deploymen.................... My deployment descriptor of the jar file is sessions.xm, weblogic-ejb-jar.xml I don't know what should I do. Any one has suggestion? please email to me as well as I haven't subscribe to the mailing list Thank you very much Best regards K. |
From: John W. L. <Joh...@sa...> - 2010-04-28 18:44:15
|
There are some limitations with generating a coverage report with Groovy. Please take a look here: http://jira.codehaus.org/browse/GROOVY-3118 From: Shurgin,Gary [mailto:sh...@oc...] Sent: Wednesday, April 28, 2010 12:20 PM To: cob...@li... Subject: [Cobertura-devel] Incomplete coverage reported for a groovy constructor class. I have the following groovy code. class MyClass extends BaseClass { MyClass( OtherClass field ) { super ( field ) } .... } The BaseClass has only 1 constructor, with the same parameter. Cobertura reports that the 'super' statement does not complete branch coverage. The error message is Line 16: Conditional coverage 50% (2/4) [each condition: 50%, 50%]. Is there something that I am not doing correctly? Is this a cobertura problem with groovy? If so, is it known? Thanks Gary Shurgin Software Engineer OCLC, Inc. |
From: Shurgin,Gary <sh...@oc...> - 2010-04-28 16:19:47
|
I have the following groovy code. class MyClass extends BaseClass { MyClass( OtherClass field ) { super ( field ) } .... } The BaseClass has only 1 constructor, with the same parameter. Cobertura reports that the 'super' statement does not complete branch coverage. The error message is Line 16: Conditional coverage 50% (2/4) [each condition: 50%, 50%]. Is there something that I am not doing correctly? Is this a cobertura problem with groovy? If so, is it known? Thanks Gary Shurgin Software Engineer OCLC, Inc. |
From: Khue Vu <kh...@gm...> - 2010-04-28 15:06:25
|
Hi all after instrumenting my EJB classes and put it into jar file and deploy to weblogic server, I have this error: weblogic.application.ModuleException: Exception preparing module: EJBModule(GEMS.jar) [EJB:011023]An error occurred while reading the deployment descriptor. The error was: Error processing annotations: . at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:454) at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199) at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:391) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:83) at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:59) at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:43) at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:1221) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:83) at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:367) at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:54) at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154) at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60) at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:207) at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:98) at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217) at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:747) at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1216) at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:250) at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:157) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:12) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverC at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201) at weblogic.work.ExecuteThread.run(ExecuteThread.java:173) Caused by: weblogic.utils.ErrorCollectionException: There are 1 nested errors: weblogic.j2ee.dd.xml.AnnotationProcessException: [EJB:015001]Unable to link class oracle.oardc.daps.gems.eav.element.ejb.ElementFacadeEJBBean in Jar C:\Users\Napoleon\AppData\Roaming\JDeveloper\system11.1.1.2.36.55.36\DefaultDomain\servers\DefaultServer\tmp\_WL_user\GEMS\yvthsx\GEMS.jar : java.lang.NoClassDefFoundError: net/sourceforge/cobertura/coveragedata/HasBeenInstrumented at weblogic.j2ee.dd.xml.BaseJ2eeAnnotationProcessor.addProcessingError(BaseJ2eeAnnotationProcessor.java:1272) at weblogic.j2ee.dd.xml.BaseJ2eeAnnotationProcessor.addFatalProcessingError(BaseJ2eeAnnotationProcessor.java:1277) at weblogic.ejb.container.dd.xml.EjbAnnotationProcessor.processAnnotations(EjbAnnotationProcessor.java:168) at weblogic.ejb.container.dd.xml.EjbDescriptorReaderImpl.processStandardAnnotations(EjbDescriptorReaderImpl.java:344) at weblogic.ejb.container.dd.xml.EjbDescriptorReaderImpl.createReadOnlyDescriptorFromJarFile(EjbDescriptorReaderImpl.java:204) at weblogic.ejb.spi.EjbDescriptorFactory.createReadOnlyDescriptorFromJarFile(EjbDescrip at weblogic.ejb.container.deployer.EJBModule.loadEJBDescriptor(EJBModule.java:1210) at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:382) at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199) at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:391) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:83) at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:59) at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:43) at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:1221) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:83) at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:367) at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:54) at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154) at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60) at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:207) at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:98) at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217) at weblogic.deploy.internal.targetserver.Deploymen.................... My deployment descriptor of the jar file is sessions.xm, weblogic-ejb-jar.xml I don't know what should I do. Any one has suggestion? please email to me as well as I haven't subscribe to the mailing list Thank you very much Best regards K. |
From: <dun...@bt...> - 2010-04-23 16:47:51
|
...oops, I meant "private static JPAHelper dummy=new JPAHelper();" That definitely works (just tried it) Duncan. ________________________________ From: Loveday,DAH,Duncan,DMK7 R Sent: 23 April 2010 17:22 To: Jake Cobb; Alan Chaney Cc: cob...@li... Subject: RE: [Cobertura-devel] report shows class statement as red on simplestatic class ...so you have to instantiate the class, even though it was never designed for that. Try adding "private JPAHelper dummy=new JPAHelper();" Duncan. ________________________________ From: Jake Cobb [mailto:jak...@ga...] Sent: 23 April 2010 17:13 To: Alan Chaney Cc: cob...@li... Subject: Re: [Cobertura-devel] report shows class statement as red on simplestatic class Alan, You're seeing the default constructor (equivalent to public JPAHelper() {}) that is automatically generated when no constructors exist in the source. Cobertura operates on the byte-code and when a default constructor is generated this way it maps to the class declaration in the source. -Jake On Fri, Apr 23, 2010 at 11:58 AM, Alan Chaney <al...@me...> wrote: Hi I'm new to cobertura, but increasingly impressed with how useful having an understanding of coverage can be. I'm spending some time trying to understand some odd cases in my coverage reports where I think I should have tested everything but I'm still getting some indications that coverage is not 100% complete. My question concerns a simple static class that I have. I've written some Junit tests for it, and the report shows 100% branch coverage, but the line coverage shows 7/8 because the class statement line appears in red. I can't think of any test that I can write that would exercise this becauset the class has only one method (as below.) Why is it failing? What should I do to make it green? Does it matter? and is there anywhere I find more information about how the coverage report is generated (apart from reading the source, of course!) I've read all the referenced articles on the FAQ and Googled for Thanks in advance Alan package com.mycompany.project import java.lang.reflect.Field; import javax.persistence.ManyToMany; import javax.persistence.OneToMany; import javax.persistence.OneToOne; public class JPAHelper { <<=== THIS LINE APPEARS IN RED, everything else is green or gray /** * The parent of the field should be an @Entity. It should have either a OneToOne, * ManyToOne, or ManyToMany annotation * @param f * @return The implementation class */ public static Class<?> findImplementationClass(Field f) { if (f.isAnnotationPresent(OneToMany.class)) { return f.getAnnotation(OneToMany.class).targetEntity(); } else if (f.isAnnotationPresent(ManyToMany.class)) { return f.getAnnotation(ManyToMany.class).targetEntity(); } else if (f.isAnnotationPresent(OneToOne.class)) { return f.getAnnotation(OneToOne.class).targetEntity(); } return null; } } ------------------------------------------------------------------------ ------ _______________________________________________ Cobertura-devel mailing list Cob...@li... https://lists.sourceforge.net/lists/listinfo/cobertura-devel |
From: Bennett, J. <JJB...@On...> - 2010-04-23 16:37:50
|
Even a static class has a constructor, and to get 100% coverage, you have to invoke it. If you're thorough, you likely made the ctor explicitly private - if you do so, cobertura will tell you that's what's missing. If you didn't, cobertura will display as you indicated. -------------------- I put this generic utility at the root of my "TestCase" classes. It invokes a no-arg ctor (explicit or the default one Java gives you) via reflection. public static Object genericTestConstructor(final Class<?> cls) throws InstantiationException, IllegalAccessException, InvocationTargetException { final Constructor<?> c = cls.getDeclaredConstructors()[0]; c.setAccessible(true); final Object n = c.newInstance((Object[])null); Assert.assertNotNull(n); return n; } Test is then something like: public void testUtils() { genericTestConstructor(MyStaticUtilClass.class); } It's a silly test purely for the sake of coverage. Yes, I am that obsessive. -----Original Message----- From: Alan Chaney [mailto:al...@me...] Sent: Friday, April 23, 2010 11:59 AM To: cob...@li... Subject: [Cobertura-devel] report shows class statement as red on simplestatic class Hi I'm new to cobertura, but increasingly impressed with how useful having an understanding of coverage can be. I'm spending some time trying to understand some odd cases in my coverage reports where I think I should have tested everything but I'm still getting some indications that coverage is not 100% complete. My question concerns a simple static class that I have. I've written some Junit tests for it, and the report shows 100% branch coverage, but the line coverage shows 7/8 because the class statement line appears in red. I can't think of any test that I can write that would exercise this becauset the class has only one method (as below.) Why is it failing? What should I do to make it green? Does it matter? and is there anywhere I find more information about how the coverage report is generated (apart from reading the source, of course!) I've read all the referenced articles on the FAQ and Googled for Thanks in advance Alan package com.mycompany.project import java.lang.reflect.Field; import javax.persistence.ManyToMany; import javax.persistence.OneToMany; import javax.persistence.OneToOne; public class JPAHelper { <<=== THIS LINE APPEARS IN RED, everything else is green or gray /** * The parent of the field should be an @Entity. It should have either a OneToOne, * ManyToOne, or ManyToMany annotation * @param f * @return The implementation class */ public static Class<?> findImplementationClass(Field f) { if (f.isAnnotationPresent(OneToMany.class)) { return f.getAnnotation(OneToMany.class).targetEntity(); } else if (f.isAnnotationPresent(ManyToMany.class)) { return f.getAnnotation(ManyToMany.class).targetEntity(); } else if (f.isAnnotationPresent(OneToOne.class)) { return f.getAnnotation(OneToOne.class).targetEntity(); } return null; } } ------------------------------------------------------------------------ ------ _______________________________________________ Cobertura-devel mailing list Cob...@li... https://lists.sourceforge.net/lists/listinfo/cobertura-devel |
From: Alan C. <al...@me...> - 2010-04-23 16:31:50
|
Thanks Jeffrey and Jake and Duncan Explains my problem. I'll try something like you suggested to make it go away. It leads to a philosophical issue which is whether or not to try for 100% green on both lines and branches. This is of course likely to be something that people hold strong (and conflicting) opinions on. I'm of the view that if you don't go for green/green the problem is that each time you look at the coverage report you have assess whether or not something bad has crept in. I fully understand that 100% coverage doesn't mean that your program has no problems - I think however, that like unit tests, the true advantage of a coverage report comes later, maybe when even in production, when you can check that changes haven't broken things. As I said before, I'm a newbie, but I can see two ways of making it easier: 1. Arrange that cobertura can ignore certain things - maybe by annotations in the source (a bit like @SuppressWarning) 2. Provide a library of simple utilities similar to the one Jeffrey proposed below. I do a lot of ORM code which requires hashcode and equals to be implemented for domain objects and I've started writing a utility to exercise each branch by reflection (you specify the fields used in the equals) If anyone else is interested I'd be happy to start such a project - unless, of course, it exists already and I've failed to find it! Regards Alan Bennett, Jeffrey wrote: > Even a static class has a constructor, and to get 100% coverage, you > have to invoke it. If you're thorough, you likely made the ctor > explicitly private - if you do so, cobertura will tell you that's what's > missing. If you didn't, cobertura will display as you indicated. > > -------------------- > > I put this generic utility at the root of my "TestCase" classes. It > invokes a no-arg ctor (explicit or the default one Java gives you) via > reflection. > > public static Object genericTestConstructor(final Class<?> cls) > throws InstantiationException, IllegalAccessException, > InvocationTargetException > { > final Constructor<?> c = cls.getDeclaredConstructors()[0]; > c.setAccessible(true); > final Object n = c.newInstance((Object[])null); > > Assert.assertNotNull(n); > return n; > } > > Test is then something like: > public void testUtils() { > genericTestConstructor(MyStaticUtilClass.class); > } > > It's a silly test purely for the sake of coverage. Yes, I am that > obsessive. > > > -----Original Message----- > From: Alan Chaney [mailto:al...@me...] > Sent: Friday, April 23, 2010 11:59 AM > To: cob...@li... > Subject: [Cobertura-devel] report shows class statement as red on > simplestatic class > > Hi > > I'm new to cobertura, but increasingly impressed with how useful having > an understanding of coverage can be. I'm spending some time trying to > understand some odd cases in my coverage reports where I think I should > have tested everything but I'm still getting some indications that > coverage is not 100% complete. > > My question concerns a simple static class that I have. I've written > some Junit tests for it, and the report shows 100% branch coverage, but > the line coverage shows 7/8 because the class statement line appears in > red. I can't think of any test that I can write that would exercise this > becauset the class has only one method (as below.) > > Why is it failing? What should I do to make it green? Does it matter? > and is there anywhere I find more information about how the coverage > report is generated (apart from reading the source, of course!) I've > read all the referenced articles on the FAQ and Googled for > > Thanks in advance > > Alan > > package com.mycompany.project > > import java.lang.reflect.Field; > > import javax.persistence.ManyToMany; > import javax.persistence.OneToMany; > import javax.persistence.OneToOne; > > public class JPAHelper { <<=== THIS LINE APPEARS IN RED, everything > > else is green or gray > /** > * The parent of the field should be an @Entity. It should have > either a OneToOne, > * ManyToOne, or ManyToMany annotation > * @param f > * @return The implementation class > */ > public static Class<?> findImplementationClass(Field f) { > if (f.isAnnotationPresent(OneToMany.class)) { > return f.getAnnotation(OneToMany.class).targetEntity(); > } else if (f.isAnnotationPresent(ManyToMany.class)) { > return f.getAnnotation(ManyToMany.class).targetEntity(); > } else if (f.isAnnotationPresent(OneToOne.class)) { > return f.getAnnotation(OneToOne.class).targetEntity(); > } > return null; > } > } > > > ------------------------------------------------------------------------ > ------ > _______________________________________________ > Cobertura-devel mailing list > Cob...@li... > https://lists.sourceforge.net/lists/listinfo/cobertura-devel > > > !DSPAM:4bd1c76696383033718476! > > |
From: <dun...@bt...> - 2010-04-23 16:23:23
|
...so you have to instantiate the class, even though it was never designed for that. Try adding "private JPAHelper dummy=new JPAHelper();" Duncan. ________________________________ From: Jake Cobb [mailto:jak...@ga...] Sent: 23 April 2010 17:13 To: Alan Chaney Cc: cob...@li... Subject: Re: [Cobertura-devel] report shows class statement as red on simplestatic class Alan, You're seeing the default constructor (equivalent to public JPAHelper() {}) that is automatically generated when no constructors exist in the source. Cobertura operates on the byte-code and when a default constructor is generated this way it maps to the class declaration in the source. -Jake On Fri, Apr 23, 2010 at 11:58 AM, Alan Chaney <al...@me...> wrote: Hi I'm new to cobertura, but increasingly impressed with how useful having an understanding of coverage can be. I'm spending some time trying to understand some odd cases in my coverage reports where I think I should have tested everything but I'm still getting some indications that coverage is not 100% complete. My question concerns a simple static class that I have. I've written some Junit tests for it, and the report shows 100% branch coverage, but the line coverage shows 7/8 because the class statement line appears in red. I can't think of any test that I can write that would exercise this becauset the class has only one method (as below.) Why is it failing? What should I do to make it green? Does it matter? and is there anywhere I find more information about how the coverage report is generated (apart from reading the source, of course!) I've read all the referenced articles on the FAQ and Googled for Thanks in advance Alan package com.mycompany.project import java.lang.reflect.Field; import javax.persistence.ManyToMany; import javax.persistence.OneToMany; import javax.persistence.OneToOne; public class JPAHelper { <<=== THIS LINE APPEARS IN RED, everything else is green or gray /** * The parent of the field should be an @Entity. It should have either a OneToOne, * ManyToOne, or ManyToMany annotation * @param f * @return The implementation class */ public static Class<?> findImplementationClass(Field f) { if (f.isAnnotationPresent(OneToMany.class)) { return f.getAnnotation(OneToMany.class).targetEntity(); } else if (f.isAnnotationPresent(ManyToMany.class)) { return f.getAnnotation(ManyToMany.class).targetEntity(); } else if (f.isAnnotationPresent(OneToOne.class)) { return f.getAnnotation(OneToOne.class).targetEntity(); } return null; } } ------------------------------------------------------------------------ ------ _______________________________________________ Cobertura-devel mailing list Cob...@li... https://lists.sourceforge.net/lists/listinfo/cobertura-devel |