From: John W. L. <Joh...@sa...> - 2010-06-03 17:49:03
|
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...<mailto:ash...@si...> www.siemens.co.in<BLOCKED::http://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...<mailto:ash...@si...> www.siemens.co.in<BLOCKED::http://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. |