Hi,
1) We have a problem with the following construct:
public final int getId() {
int retValue = -1;
switch (getDevice()) {
case MIREL1:
retValue = 1;
break;
case MIREL2:
retValue = 2;
break;
default:
getMyTestScript().error("Invalid device!");
break;
}
return retValue;
}
All 3 branches are covered, but "switch getDevice()" is marked yellow. On
internet i found the info, that getId() can return null and then a Exception is
thrown.
I generated a 4.th test case via mocking getId() to null. Then a
nullptrexception is thrown, i tested this in the unit-test, but Jacoco always
marks the row "switch getDevice()" yellow and the static coverage is not 100%.
How can we solve this problem?
2) On the page https://github.com/jacoco/jacoco/wiki/FilteringOptions Jacoco
filtering options are described.
I want to use JAVAC.ENUM to suppress coverage of values() and valueOf().
On the side above there is the following statement: "This page discusses a not
yet available feature!", but behind the option JAVAC.ENUM there is the remark
"Done".
Is this feature already implemented in Jacoco? If it is available, in which
version is it implemented and how can i set the filtering option in the
following ANT-script:
<target name="instrument" depends="test-compile">
<!-- Step 2: Instrument class files -->
<jacoco:instrument destdir="${result.classes.instr.dir}">
<fileset dir="${result.classes.dir}" />
</jacoco:instrument>
</target>
<target name="unittestall" depends="instrument">
<junit printsummary="yes" haltonfailure="no" fork="true">
<sysproperty key="jacoco-agent.destfile" file="${result.exec.file}"/>
<classpath refid="Plug-in Dependencies.libraryclasspath"/>
<classpath refid="classpath.tools"/>
<classpath refid="classpath.instr"/>
<classpath refid="classpath.test"/>
<batchtest fork="yes">
<fileset dir="${test.dir}" includes="**/*Test.java" />
<formatter type="plain"/>
<formatter type="xml"/>
</batchtest>
</junit>
</target>
<target name="unittestreport" depends="unittestall">
<mkdir dir="${report.dir}/html"/>
<junitreport todir="${report.dir}">
<fileset dir="${xml.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report todir="${report.dir}/html"/>
</junitreport>
</target>
<target name="report" depends="unittestreport">
<!-- Step 3: Create coverage report -->
<jacoco:report>
<!-- This task needs the collected execution data and ... -->
<executiondata>
<file file="${result.exec.file}" />
</executiondata>
<!-- the class files and optional source files ... -->
<structure name="JaCoCo Ant Example">
<classfiles>
<fileset dir="${result.classes.dir}" />
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${src.dir}" />
</sourcefiles>
</structure>
<!-- to produce reports in different formats. -->
<html destdir="${result.report.dir}" />
<csv destfile="${result.report.dir}/report.csv" />
<xml destfile="${result.report.dir}/report.xml" />
</jacoco:report>
</target>
<target name="rebuild" depends="clean, compile, test-compile, instrument,
unittest, unittestreport, report" />
</project>
--
You received this message because you are subscribed to the Google Groups
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jacoco/436b9b1a-db51-4ae8-9d82-4fd07ff6d170%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.