From: Soni, A. IN B. S. <ash...@si...> - 2010-06-04 03:37:29
|
Yes I have so many PackageTestSuite for different packages and unittest will run for all packages one by one. So during the instrumentation I am using single Cobertura.ser datafile and during the unit test execution I am creating the Cobertura.ser datafile for each test package later I am doing a merge of all Cobertura.ser into the one file and using it for Cobertura-report task. As I discussed with you I have a regular expression for to exclude a class called ImsMessageIds, use ".*ImsMessageIds" but in report section it's creating a report for a class called ImsMessageIds with coverage 0% for line and branch. <excludeClasses regex=".*\.ImsMessageIds.*" /> Source Classes are distributed in gen\jars\lin and gen\classes\lin. ---------------------------------------------------------------- With best regards, Ashish Soni Siemens Information Systems Ltd. SWP-HC3 No 84, Keonics Electronics City, Hosur Road, Bangalore 560100 Tel.: +91 80 2511 3353 mailto.: ash...@si... www.siemens.co.in -----Original Message----- From: John W. Lewis [mailto:Joh...@sa...] Sent: Friday, June 04, 2010 2:19 AM To: John W. Lewis; Soni, Ashish IN BLR SISL; cob...@li... Subject: RE: Uses of Cobertura-instrument task 1) Yes 2) I'm not sure what you are asking. The regular expression for "anything" is ".*". 3) Cobertura.ser contains the line and branch information of the classes. After junit execution, the file contains the number of times each line/branch was hit. 4) Usually the same cobertura.ser file that is created during the instrumentation is used during junit and used for the report generation - one file is all that is needed. One report is usually created. Are you trying to create multiple reports? From: Soni, Ashish IN BLR SISL [mailto:ash...@si...] Sent: Thursday, June 03, 2010 3:14 PM To: John W. Lewis; cob...@li... Cc: Soni, Ashish IN BLR SISL Subject: RE: Uses of Cobertura-instrument task I have some more questions: 1) As per the previous statement I understand that includeClasses and excludeClasses with regex's will work with the classes in jars and also if classes is available in directory location like gen\classes\lin. Is it right? 2) What's a right way to understand a regular expression to exclude\include anything from anything? 3) What's information Cobertura-instrument will write in Cobertura.ser datafile. What information further appended into the Cobertura.ser during the junit execution task. 4) Is it correct to write all Cobertura-instrument task information for each package in common Cobertura.ser datafile into the one location and during the junit execution write the other information into the testcase package Cobertura.ser datafile. Then later append all Cobertura.ser into the one file that we can use during Cobertura-check and Cobertura-report task. -------------------------------------------------------------- With best regards, Ashish Soni Siemens Information Systems Ltd. SWP-HC3 No 84, Keonics Electronics City, Hosur Road, Bangalore 560100 Tel.: +91 80 2511 3353 mailto.: ash...@si... www.siemens.co.in ________________________________________ From: John W. Lewis [mailto:Joh...@sa...] Sent: Thursday, June 03, 2010 11:19 PM To: Soni, Ashish IN BLR SISL; cob...@li... Subject: RE: Uses of Cobertura-instrument task If you are trying to instrument class files, then it is convenient to use <include> and <exclude> with a <fileset>, but if you are trying to instrument a jar file, it will not work. You have to specify regex's for fully qualified classnames. To exclude any class that has "Test" in it, use ".*Test.*". To exclude any class starts with "contrib", use "contrib.*". To exclude a class called ImsMessageIds, use ".*ImsMessageIds". To exclude all classes in package a.b.c, use "a.b.c.*" From: Soni, Ashish IN BLR SISL [mailto:ash...@si...] Sent: Thursday, June 03, 2010 2:38 AM To: cob...@li...; John W. Lewis Subject: RE: Uses of Cobertura-instrument task But if I want to exclude some file and folder with specific name then I have to include them in excludeClasses? Like: <excludeClasses regex="*.*Test*" /> <excludeClasses regex="*.contrib.*" /> <excludeClasses regex="*.ImsMessageIds*" /> <excludeClasses regex="*Mock*" /> <excludeClasses regex="PackageTestSuite*" /> <excludeClasses regex="*Base64*" /> <excludeClasses regex="*TransformerUI*" /> But when I am using this I am getting the error like: [cobertura-instrument] WARN addRegex, The regular expression *.*Test* is invalid: ?+* follows nothing in expression [cobertura-instrument] WARN addRegex, The regular expression *.contrib.* is invalid: ?+* follows nothing in expression [cobertura-instrument] WARN addRegex, The regular expression *.ImsMessageIds is invalid: ?+* follows nothing in expression [cobertura-instrument] WARN addRegex, The regular expression *Mock* is invalid: ?+* follows nothing in expression [cobertura-instrument] WARN addRegex, The regular expression *Base64* is invalid: ?+* follows nothing in expression [cobertura-instrument] WARN addRegex, The regular expression *TransformerUI* is invalid: ?+* follows nothing in expression Same rule is working fine in Emma Code coverage. ---------------------------------------------------------------- With best regards, Ashish Soni Siemens Information Systems Ltd. SWP-HC3 No 84, Keonics Electronics City, Hosur Road, Bangalore 560100 Tel.: +91 80 2511 3353 mailto.: ash...@si... www.siemens.co.in ________________________________________ From: John W. Lewis [mailto:Joh...@sa...] Sent: Thursday, June 03, 2010 1:20 AM To: Soni, Ashish IN BLR SISL; cob...@li... Subject: RE: Uses of Cobertura-instrument task You will probably want to use something more like (from http://cobertura.sourceforge.net/anttaskreference.html): <cobertura-instrument todir="${instrumented.dir}"> <includeClasses regex=".*" /> <excludeClasses regex=".*\.Test.*" /> <instrumentationClasspath> <path refid="test.classpath" /> <pathelement location="${test.build}" /> </instrumentationClasspath> </cobertura-instrument> The regular expressions would be ".*Test.*", ".*\.contrib\..*", etc. John From: Soni, Ashish IN BLR SISL [mailto:ash...@si...] Sent: Wednesday, June 02, 2010 4:47 AM To: cob...@li... Cc: Soni, Ashish IN BLR SISL Subject: [Cobertura-devel] Uses of Cobertura-instrument task Hello All, Can please help me for following scenario: I want to do the Cobertura instrumentation on more than 1 jar and one gen\classes folder but I want to do for some specific package. Like: <!--include/exclude package pattern set --> <patternset id="filter.instrument"> <include name="org/jaxen/javabean/${package.name}/*"/> <exclude name="*/*Test*" /> <exclude name="*/contrib.*" /> <exclude name="*/ImsMessageIds" /> <exclude name="*Mock*" /> <exclude name="PackageTestSuite*" /> <exclude name="*Base64*" /> <exclude name="*TransformerUI*" /> </patternset> <cobertura-instrument todir="${dir.build}/cobertura.ser"> <fileset dir="${ dir.build.jars}"> <include name="A1.jar" /> <include name="A2.jar" /> <include name="A3.jar" /> <include name="A4.jar" /> <include name="A5.jar" /> <include name="A6.jar" /> <include name="A7.jar" /> <include name="A8.jar" /> <patternset refid="filter.instrument"/> </fileset> <fileset dir="${dir.build.class}"> <include name="org/jaxen/javabean/${package.name}/*"/> <exclude name="*/*Test*" /> <exclude name="*/contrib.*" /> <exclude name="*/ImsMessageIds" /> <exclude name="*Mock*" /> <exclude name="PackageTestSuite*" /> <exclude name="*Base64*" /> <exclude name="*TransformerUI*" /> <patternset refid="filter.instrument"/> </fileset> </cobertura-instrument> Please help me for the above example is that will work or I have to write it in different way. In Advance Thanks for the help. ---------------------------------------------------------------- With best regards, Ashish Soni Siemens Information Systems Ltd. SWP-HC3 No 84, Keonics Electronics City, Hosur Road, Bangalore 560100 Tel.: +91 80 2511 3353 mailto.: ash...@si... www.siemens.co.in ________________________________________ Important notice: This e-mail and any attachment there to contains corporate proprietary information. If you have received it by mistake, please notify us immediately by reply e-mail and delete this e-mail and its attachments from your system. Thank You. ________________________________________ Important notice: This e-mail and any attachment there to contains corporate proprietary information. If you have received it by mistake, please notify us immediately by reply e-mail and delete this e-mail and its attachments from your system. Thank You. ________________________________________ Important notice: This e-mail and any attachment there to contains corporate proprietary information. If you have received it by mistake, please notify us immediately by reply e-mail and delete this e-mail and its attachments from your system. Thank You. Important notice: This e-mail and any attachment there to contains corporate proprietary information. If you have received it by mistake, please notify us immediately by reply e-mail and delete this e-mail and its attachments from your system. Thank You. |