Generating Code Coverage Report
The code coverage must be checked on a dev machine before submitting the customization and automation. It must be generated using JaCoCo tool. It needs the related third-party jars to be present in the environment where code coverage generation is needed. To fetch the third-party jars, see Getting the Required Third-Party Dependencies.
1. To generate code coverage report from the Windchill shell traverse to <WT_HOME>\bin\customizationTools directory.
2. Execute the commands mentioned in Building the Automation section in Building and Deploying the Tests in Development System and execute the following commands.
ant test.unit -DcodeCoverage=true
* 
The above command will execute the tests and generate the test execution report in the <WT_HOME>\buildlogs\customizationLogs\UnitTest\<moduleName>\TestExecutionReport directory. It will also instrument the module specific source code and generate module specific code coverage related jacoco.exec file. For example, <moduleName>_unit_jacoco.exec in the <WT_HOME>\buildlogs\customizationLogs\UnitTest\<moduleName>\CodeCoverageReport directory. If any unit test fails, then this command or target will also fail.
ant test.coverage.report
* 
The above command will generate the code coverage reports in HTML and XML format in the <WT_HOME>\buildlogs\customizationLogs\UnitTest\<moduleName>\CodeCoverageReport\jacoco directory. The Index.html file can be used to view the code coverage.
Was this helpful?