Running the application and generating statistics in remote build environments
Using the Java™ tasks
built into Ant, you can run Java applications
and generate code coverage statistics (Java task,
JUnit task, and so on).
About this task
<jvmarg value=""${llc-jvm-arg-output}${coverageOutputFile}"" />
<jvmarg value=""${llc-jvm-arg-engine}"" />
<jvmarg value=""${llc-jvm-arg-jvmti}${probescriptFile}"" />
The JVM argument parameters are described in the following
table:
Property name | Description |
---|---|
llc-jvm-arg-output | This property is automatically defined in the file CodeCoverageProperties.xml or CodeCoverageProperties64.xml and it is not necessary for the user to set it. |
llc-jvm-arg-engine | This property is automatically defined in the file CodeCoverageProperties.xml or CodeCoverageProperties64.xml and it is not necessary for the user to set it. |
llc-jvm-arg-jvmti | This property is automatically defined in the file CodeCoverageProperties.xml or CodeCoverageProperties64.xml and it is not necessary for the user to set it. |
coverageOutputFile | This property is the output location of the coverage statistics file. It must be set as a property by the user before running. This property must be a file within the basedir and must have the ".coveragedata" extension. |
probescriptFile | This property is the path to the probescript file generated in the previous step. This property is used as input into the instrumentation engine. |
Example
<property name="coverageOutputFile" value="D:\codecoverage\outputFile.coveragedata"/>
<property name="probescriptFile" value="D:\codecoverage\myproject.probescript"/>
<java classname="com.ibm.storeapp.models.Store" fork="true" newenvironment="true">
<jvmarg value=""${llc-jvm-arg-output}${coverageOutputFile}"" />
<jvmarg value=""${llc-jvm-arg-engine}"" />
<jvmarg value=""${llc-jvm-arg-jvmti}${probescriptFile}"" />
<classpath>
<pathelement path="${basedir}\StoreApp.jar" />
</classpath>
</java>
In the following example, a regular Java application is run with code
coverage enabled by using the JUnit Ant task:<property name="coverageOutputFile" value="D:\codecoverage\outputFile.coveragedata"/>
<property name="probescriptFile" value="D:\codecoverage\myproject.probescript"/>
<junit showoutput="true" fork="yes" newenvironment="true">
<jvmarg value=""${llc-jvm-arg-output}${coverageOutputFile}"" />
<jvmarg value=""${llc-jvm-arg-engine}"" />
<jvmarg value=""${llc-jvm-arg-jvmti}${probescriptFile}"" />
<formatter type="xml" />
<test name="com.ibm.storeapp.models.test.TestCustomer" outfile="TestCustomer" />
<classpath>
<pathelement path="${basedir}\StoreApp.jar" />
<pathelement path="${junitJar}" />
</classpath>
</junit>