Java – how to delete / filter / ignore certain packages from Emma (code coverage)
I tried to delete some packages from my report and got into trouble
Can someone help me?
I use Emma in my ant process
<! - Generate Emma report in XML and HTML - > < Emma > < report source path = "${} build. Report. SRC" measure = "class: ${coverage. Classes. Min}, method: ${coverage. Methods. Min}" > < fileset dir = "${build. Report. JUnit. Data. Dir}" > < include name = "*. Emma" / > < / fileset > < HTML outfile = "${build. Report. Reports} / Emma / raw. HTML" depth = "method" />< XML outfile = "${build. Report. TMP} / Emma. XML" depth = "method" / > < / report > < / Emma >
I tried:
< filter excludes =“com.my.package.*”/>
But without success:(
Solution
Emma allows filters to be used during the detection phase to specify a set of files to be detected Instead, you are trying to do this during the report generation phase Link given above describes how to define a detection set
I have used this filter:
<property name="emma.filter" value="-*.unittest.* -*.unittests.* -*.TST* -*TestCase -*Test -*TestSuite" /> <emma> <instr instrpath="${build.dir}" mode="overwrite" Metadatafile="${build.dir}/coverage.em" filter="${emma.filter}" /> </emma>
You can also use nested elements under < Filter > < instr >