<%@ page isELIgnored="true" %> <%@ taglib uri="cms" prefix="cms" %> Coverage Tools

Coverage Tools

The coverage integrations, implemented as job steps, allow AnthillPro to collect information on the coverage tests that you invoke with your build script. Once configured, AnthillPro will collect the output and store it in the AnthillPro data warehouse. This makes it possible for you to perform trending over time, see which tests are failing, track coverage, and even fail a build based on the captured results.

Each integration allows you to add the following job steps as part of your build process:

  • Retrieve the coverage report. AnthillPro gets any reports generated by the coverage tool and publishes them on the build's Dashboard.

  • Fail a build based on coverage. Using a script, you can have AnthillPro fail a build if the percentage of test coverage falls below a preset value.

Clover

Run Clover and publish coverage reports with the Clover 1.x integration. Users can also fail a workflow based on percentage of code coverage (see Configure Evaluate Script Step [Clover]).

To use the integration, Clover is added to the builder either through the command line, as an Ant task, or as a Plugin within the Maven environment (see Codestation [Developers] and Clover documentation). Once Clover has been added to the builder, configure the report publisher as a step during job configuration.

Clover steps:

  • Clover Coverage Report. Retrieves the report generated by Clover for the individual build.

  • Evaluate Script. Reads the information in the database and then fails a workflow if the percentage of test coverage is less than the minimum limit.

Your jobs will vary, but the Clover integration is added as a job step similar to what is described below. When using the integration, click the Create Step button (or select the Insert After/Before icon) to add steps to a job. Once the job is configured, it is then added to a workflow (under the Definition tab).

The Clover job will be typically configured to make the coverage report available to the AnthillPro UI via the Build Life Reports tab. Once Clover is configured with the builder, the Clover Report step is included after the Populate Workspace, Changelog, Stamp, Dependency, Build, Publish Changelog, and Artifact Delivery steps of the typical Build job.

Clover Prerequisites

  • You must have AnthillPro administrative privileges to configure the integration. See Manage Security.

  • A project with at least one Build Life must be active in AnthillPro.

  • A Life-Cycle Model must be configured with the appropriate Status and Artifact Sets. See Using Life-Cycle Models.

  • Clover must be added to your command-line build script, as an Ant task, or as part of the Maven environment. See Codestation (Developers) and Clover documentation.

  • The source directory where the Clover report file is located must be available.

Configure Clover Report Step

Configure the Clover Report step in this section. This step is tasked with retrieving the report generated by Clover.

  1. Go to Administration, select the appropriate project, and click the Add Job icon.

  2. On the New Job Configuration page, choose No (do not use the Job Wizard). Click Select.

  3. Follow the steps for creating a build job.

    Before proceeding to Item Four, add Clover to your build script, as an Ant task, or as part of the Maven environment. See Clover documentation.

  4. Clover Coverage Report. Select the Insert After icon of the step prior to the point where the Clover step is to be included (e.g., the Artifact Delivery step). Go to Coverage > Clover, select the Clover Coverage Report step, and click Select.

    • Name the step (required).

    • Description. Provide a short description.

    • Report Name (required). Give the name for this report (default is same as step name).

    • Performing Digest. Check yes to perform a digest on the published files integrity. The digest algorithm is set by the administrator in the Server Settings. The digest will not occur if no algorithm is selected. See Configure Server Security.

    • Source Directory. Provide the directory where the Clover report files are retrieved from.

    • Include Patterns. Give the file name patterns that describe the files to be retrieved. Each include pattern must be entered on a separate line.

      You can also use the following wild cards to tell AnthillPro what to include:

      • ** Indicates include every directory within the base directory.

      • * Used to include every file. So, if you use *.zip, the files matching this pattern will be included.

      • **/* Tells AnthillPro to retrieve the entire file tree underneath the base directory.

    • Exclude Patterns. Provide the file name patterns identifying the files that will NOT be retrieved. This field is set in the same way as the Include Patterns field, only you are telling AnthillPro what NOT to include.

    • Show Additional Options (advanced). Select the Show Additional Options link to configure more options.

      • Is Active. Select No to temporarily deactivate the step without deleting it; otherwise select Yes.

      • Pre-Condition Script. From the drop down menu, select the condition which must be met for the step to continue. Before editing an existing script or creating a new one, see Step Pre-Condition Scripts.

      • Ignore Failures. Select Yes if this step should not effect the determination for step continuation or the status determination of the job.

      • PostProcessingScript. Select a script for determining when commands should count as fail or succeed. See Post Processing Scripts.

      • Timeout. Enter the time in minutes after the start of the step when AnthillPro will consider the step as timed out and abort it.

  5. Click Save.

  6. If configuring the Evaluate Script step to fail the workflow based on coverage percentage, see Configure Evaluate Script Step (Clover). Otherwise, proceed to Add Clover Job to Workflow.

Configure Evaluate Script Step (Clover)

To have AnthillPro fail a workflow based on the Clover report, add an Evaluate Script step to the Build job. The Evaluate Script step, added after the Clover Report step, will read the information in the database and then fail a workflow if the percentage of test coverage is less than the minimum limit. See Tools > Developer Tools > Scripting API > CoverageHelper.

Example Coverage Report Script:

import com.urbancode.anthill3.domain.coverage.CoverageReport;
import org.apache.log4j.Logger;

static private final Logger log = Logger.getLogger("Stuff");
CoverageReport[] reports = null;
try {
  reports = CoverageHelper.getForCurrentBuildLife();
}
catch (Exception e) {
  log.warn(e);
}

if (reports != null) {
  log.warn("Coverage getForCurrentBuildLife " + reports.length);
  log.warn("Coverage " + reports[0].getLinePercentage());
  log.warn("Coverage " + reports[0].getBranchPercentage());
  log.warn("Coverage " + reports[0].getCoverageType());
  log.warn("Coverage " + reports[0].getName());
}


CoverageReport[] reports = CoverageHelper.getForBuildLife(BuildLifeLookup.getCurrent());
if (reports != null) {
  log.warn("Coverage getForBuildLife " + reports.length);
  log.warn("Coverage " + reports[0].getLinePercentage());
  log.warn("Coverage " + reports[0].getBranchPercentage());
  log.warn("Coverage " + reports[0].getCoverageType());
  log.warn("Coverage " + reports[0].getName());
}

CoverageReport[] reports = CoverageHelper.getForCurrentJobTrace();
if (reports != null) {
  log.warn("Coverage getForCurrentJobTrace " + reports.length);
  log.warn("Coverage " + reports[0].getLinePercentage());
  log.warn("Coverage " + reports[0].getBranchPercentage());
  log.warn("Coverage " + reports[0].getCoverageType());
  log.warn("Coverage " + reports[0].getName());
}

CoverageReport[] reports = CoverageHelper.getForJobTrace(JobTraceLookup.getCurrent());
if (reports != null) {
  log.warn("Coverage getForJobTrace " + reports.length);
  log.warn("Coverage " + reports[0].getLinePercentage());
  log.warn("Coverage " + reports[0].getBranchPercentage());
  log.warn("Coverage " + reports[0].getCoverageType());
  log.warn("Coverage " + reports[0].getName());
}

CoverageReport[] reports = CoverageHelper.getRecentForCurrentWorkflow();
if (reports != null) {
  log.warn("Coverage getRecentForCurrentWorkflow " + reports.length);
  log.warn("Coverage " + reports[0].getLinePercentage());
  log.warn("Coverage " + reports[0].getBranchPercentage());
  log.warn("Coverage " + reports[0].getCoverageType());
  log.warn("Coverage " + reports[0].getName());
}

CoverageReport[] reports = CoverageHelper.getRecentForWorkflow(WorkflowLookup.getCurrent());
if (reports != null) {
  log.warn("Coverage getRecentForWorkflow " + reports.length);
  log.warn("Coverage " + reports[0].getLinePercentage());
  log.warn("Coverage " + reports[0].getBranchPercentage());
  log.warn("Coverage " + reports[0].getCoverageType());
  log.warn("Coverage " + reports[0].getName());
}

To configure the Evaluate Script step:

  1. Select the Insert After icon of the Clover Report step. Expand the Miscellaneous folder, select the Evaluate Script step, and click Select.

  2. Name the step (required).

  3. Description. Provide a short description.

  4. Script. Give the BeanShell script to evaluate. See Scripting.

  5. Show Additional Options (advanced). Select the Show Additional Options link to configure more options.

    • Is Active. Select No to temporarily deactivate the step without deleting it; otherwise select Yes.

    • Pre-Condition Script. From the drop down menu, select the condition which must be met for the step to continue. Before editing an existing script or creating a new one, see Step Pre-Condition Scripts.

    • Ignore Failures. Select Yes if this step should not effect the determination for step continuation or the status determination of the job.

    • PostProcessingScript. Select a script for determining when commands should count as fail or succeed. See Post Processing Scripts.

    • Timeout. Enter the time in minutes after the start of the step when AnthillPro will consider the step as timed out and abort it.

  6. Click Save.

Add Clover Job to Workflow

The Job with the Clover step(s) must be executed as part of a workflow (see Configure Clover Report Step). This section will assume that an originating workflow has already been configured, and will cover the process of adding the Clover build job to the appropriate workflow. Complete workflow configuration is beyond the scope of this tutorial. The topics covered in detail below are specific to using the Clover integration.

  1. Go to Administration, select the project, and select the build workflow.

  2. On the workflow Main page, select the Definition tab.

  3. From the drop-down menu, choose Embedded Definition and click Select.

  4. Left-click the Start icon and select Insert Job After.

  5. Select the Build job created in the Configure Clover Report section, choose a job pre-condition script, and click Insert Job.

Run Workflow and View Report (Clover)

  1. Go to Dashboard and select the workflow created in the Add Clover Job to Workflow section.

  2. On the workflow Main page, click the Build button for the workflow.

  3. Once the workflow has completed, select the appropriate Build Life and click the Reports tab.

  4. Select the Clover link to view the Clover coverage report for this build.

Cobertura

Run Cobertura and publish coverage reports with the Cobertura 1.9 integration. In addition, AnthillPro users can generate a coverage report for every project that uses Cobertura. Users can also fail a workflow based on percentage of code coverage (see Configure Evaluate Script Step [Cobertura]).

To use the integration, Cobertura is added to the builder either through the command line, as an Ant task, or as a Plugin within the Maven environment (see Codestation [Developers] and Cobertura documentation). Once Cobertura has been added to the builder, configure the report publisher as a step during job configuration.

Cobertura steps:

  • Cobertura Coverage Report. Retrieves the report generated by Cobertura for the individual build.

  • Evaluate Script. Reads the information in the database and then fails a workflow if the percentage of test coverage is less than the minimum limit.

Your jobs will vary, but the Cobertura integration is added as a job step similar to what is described below. When using the integration, click the Create Step button (or select the Insert After/Before icon) to add steps to a job. Once the job is configured, it is then added to a workflow (under the Definition tab).

The Cobertura job will typically be configured to make the coverage report available to the AnthillPro UI via the Build Life Reports tab. If the coverage.xml file is stored in AnthillPro's data warehouse, metrics and trending are available on the Coverage tab. Once Cobertura is configured with the builder, the Report Publish step is included after the Populate Workspace, Changelog, Stamp, Dependency, Build, Publish Changelog, and Artifact Delivery steps of the typical Build job.

Cobertura Prerequisites

  • You must have AnthillPro administrative privileges to configure the integration. See Manage Security.

  • A project with at least one Build Life must be active in AnthillPro.

  • A Life-Cycle Model must be configured with the appropriate Status and Artifact Sets. See Using Life-Cycle Models.

  • Cobertura must be added to your command-line build script, as an Ant task, or as part of the Maven environment. See Codestation (Developers) and Cobertura documentation.

  • The source directory where the Cobertura report file is located must be available.

  • To have AnthillPro generate a report of all the projects that use Cobertura, an AnthillPro report must first be created.

Configure Cobertura Report Publisher Step

Configure the Cobertura Report Publisher in this section. This step is tasked with retrieving the report generated by Cobertura. You may also choose to publish the data that AnthillPro adds to its database.

  1. Go to Administration, select the appropriate project, and click the Add Job icon.

  2. On the New Job Configuration page, choose No (do not use the Job Wizard). Click Select.

  3. Follow the steps for creating a build job.

    Before proceeding to Item Four, add Cobertura to your build script, as an Ant task, or as part of the Maven environment. See Cobertura documentation.

  4. Cobertura Coverage Report. Select the Insert After icon of the step prior to the point where the Cobertura step is to be included (e.g., the Artifact Delivery step). Go to Coverage > Cobertura, select the Cobertura Coverage Report step, and click Select.

    • Name the step (required).

    • Description. Provide a short description.

    • Report Name (required). Give the name for this report (default is same as step name).

    • Report Directory. Give the directory where the Cobertura HTML report files will be retrieved from.

    • Include Patterns. Give the file name patterns that describe the files to be retrieved. Each include pattern must be entered on a separate line.

      You can also use the following wild cards to tell AnthillPro what to include:

      • ** Indicates include every directory within the base directory.

      • * Used to include every file. So, if you use *.zip, the files matching this pattern will be included.

      • **/* Tells AnthillPro to retrieve the entire file tree underneath the base directory.

    • Exclude Patterns. Provide the file name patterns identifying the files that will NOT be retrieved. This field is set in the same way as the Include Patterns field, only you are telling AnthillPro what NOT to include.

    • Store Data. Check the box to store the coverage.xml results in the AnthillPro database for trending and metrics usage.

      If the box is checked, give the base directory where the Cobertura coverage.xml files will be retrieved from if different than the report directory. All files matching the pattern **/coverage.xml in the directory will be used.

    • Data Directory. Give the base directory where the Cobertura coverage.xml files will be retrieved from. Default is the same as Source Directory. All files matching the pattern **/coverage.xml in the directory will be used.

    • Show Additional Options (advanced). Select the Show Additional Options link to configure more options.

      • Is Active. Select No to temporarily deactivate the step without deleting it; otherwise select Yes.

      • Pre-Condition Script. From the drop down menu, select the condition which must be met for the step to continue. Before editing an existing script or creating a new one, see Step Pre-Condition Scripts.

      • Ignore Failures. Select Yes if this step should not effect the determination for step continuation or the status determination of the job.

      • PostProcessingScript. Select a script for determining when commands should count as fail or succeed. See Post Processing Scripts.

      • Timeout. Enter the time in minutes after the start of the step when AnthillPro will consider the step as timed out and abort it.

  5. Click Save.

  6. If configuring the Evaluate Script step to fail the workflow based on coverage percentage, see Configure Evaluate Script Step (Cobertura). Otherwise, proceed to Add Cobertura Job to Workflow.

Configure Evaluate Script Step (Cobertura)

To have AnthillPro fail a workflow based on the Cobertura report, add an Evaluate Script step to the Build job. The Evaluate Script step, added after the Configure Cobertura Report Publish Step, will read the information in the database and then fail a workflow if the percentage of test coverage is less than the minimum limit. See Tools > Developer Tools > Scripting API > CoverageHelper.

Example Coverage Report Script:

import com.urbancode.anthill3.domain.coverage.CoverageReport;
import org.apache.log4j.Logger;

static private final Logger log = Logger.getLogger("Stuff");
CoverageReport[] reports = null;
try {
  reports = CoverageHelper.getForCurrentBuildLife();
}
catch (Exception e) {
  log.warn(e);
}

if (reports != null) {
  log.warn("Coverage getForCurrentBuildLife " + reports.length);
  log.warn("Coverage " + reports[0].getLinePercentage());
  log.warn("Coverage " + reports[0].getBranchPercentage());
  log.warn("Coverage " + reports[0].getCoverageType());
  log.warn("Coverage " + reports[0].getName());
}


CoverageReport[] reports = CoverageHelper.getForBuildLife(BuildLifeLookup.getCurrent());
if (reports != null) {
  log.warn("Coverage getForBuildLife " + reports.length);
  log.warn("Coverage " + reports[0].getLinePercentage());
  log.warn("Coverage " + reports[0].getBranchPercentage());
  log.warn("Coverage " + reports[0].getCoverageType());
  log.warn("Coverage " + reports[0].getName());
}

CoverageReport[] reports = CoverageHelper.getForCurrentJobTrace();
if (reports != null) {
  log.warn("Coverage getForCurrentJobTrace " + reports.length);
  log.warn("Coverage " + reports[0].getLinePercentage());
  log.warn("Coverage " + reports[0].getBranchPercentage());
  log.warn("Coverage " + reports[0].getCoverageType());
  log.warn("Coverage " + reports[0].getName());
}

CoverageReport[] reports = CoverageHelper.getForJobTrace(JobTraceLookup.getCurrent());
if (reports != null) {
  log.warn("Coverage getForJobTrace " + reports.length);
  log.warn("Coverage " + reports[0].getLinePercentage());
  log.warn("Coverage " + reports[0].getBranchPercentage());
  log.warn("Coverage " + reports[0].getCoverageType());
  log.warn("Coverage " + reports[0].getName());
}

CoverageReport[] reports = CoverageHelper.getRecentForCurrentWorkflow();
if (reports != null) {
  log.warn("Coverage getRecentForCurrentWorkflow " + reports.length);
  log.warn("Coverage " + reports[0].getLinePercentage());
  log.warn("Coverage " + reports[0].getBranchPercentage());
  log.warn("Coverage " + reports[0].getCoverageType());
  log.warn("Coverage " + reports[0].getName());
}

CoverageReport[] reports = CoverageHelper.getRecentForWorkflow(WorkflowLookup.getCurrent());
if (reports != null) {
  log.warn("Coverage getRecentForWorkflow " + reports.length);
  log.warn("Coverage " + reports[0].getLinePercentage());
  log.warn("Coverage " + reports[0].getBranchPercentage());
  log.warn("Coverage " + reports[0].getCoverageType());
  log.warn("Coverage " + reports[0].getName());
}

To configure the Evaluate Script step:

  1. Select the Insert After icon of the Cobertura Report Publisher step. Expand the Miscellaneous folder, select the Evaluate Script step, and click Select.

  2. Name the step (required).

  3. Description. Provide a short description.

  4. Script. Give the BeanShell script to evaluate. See Scripting.

  5. Show Additional Options (advanced). Select the Show Additional Options link to configure more options.

    • Is Active. Select No to temporarily deactivate the step without deleting it; otherwise select Yes.

    • Pre-Condition Script. From the drop down menu, select the condition which must be met for the step to continue. Before editing an existing script or creating a new one, see Step Pre-Condition Scripts.

    • Ignore Failures. Select Yes if this step should not effect the determination for step continuation or the status determination of the job.

    • PostProcessingScript. Select a script for determining when commands should count as fail or succeed. See Post Processing Scripts.

    • Timeout. Enter the time in minutes after the start of the step when AnthillPro will consider the step as timed out and abort it.

  6. Click Save.

Add Cobertura Job to Workflow

The Job with the Cobertura step(s) must be executed as part of a workflow (see Configure Cobertura Report Publish Step). This section will assume that an originating workflow has already been configured, and will cover the process of adding the Cobertura build job to the appropriate workflow. Complete workflow configuration is beyond the scope of this tutorial. The topics covered in detail below are specific to using the Cobertura integration.

  1. Go to Administration, select the project, and select the build workflow.

  2. On the workflow Main page, select the Definition tab.

  3. From the drop-down menu, choose Embedded Definition and click Select.

  4. Left-click the Start icon and select Insert Job After.

  5. Select the Build job created in the Configure Cobertura Report Publish Step section, choose a job pre-condition script, and click Insert Job.

Run Workflow and View Report (Cobertura)

  1. Go to Dashboard and select the workflow created in the Add Cobertura Job to Workflow section.

  2. On the workflow Main page, click the Build button for the workflow.

  3. Once the workflow has completed, select the appropriate Build Life and click the Reports tab.

  4. Select the Cobertura link to view the Cobertura coverage report for this build.

  5. If the coverage.xml has been made available for report generation, go to the Reports page and select the Run Report icon to view the coverage report for all AnthillPro projects using Cobertura.

EMMA

Run EMMA and publish coverage reports with the EMMA integration. In addition, AnthillPro users can also fail a workflow based on percentage of code coverage. To use the integration, EMMA must first be added as part of the build, most commonly as an Ant task (see EMMA documentation). Once EMMA has been added, configure the report publisher as a step during job configuration.

EMMA steps:

  • EMMA Coverage Report. Retrieves the HTML reports generated by EMMA and publishes them on the Build Life. Additionally, AnthillPro can also retrieve the XML reports and store the results in the database for metrics and trending. See Configure EMMA Coverage Report Publisher.

  • Evaluate Script. Reads the information in the database and then fails a workflow if the percentage of test coverage is less than the minimum limit. See Configure Evaluate Script (EMMA).

Your jobs will vary, but the EMMA integration is added as a job step similar to what is described below. When using the integration, click the Create Step button (or select the Insert After/Before icon) to add steps to an existing job. Once the job is configured, it is then added to a workflow (under the Definition tab). Typically, the EMMA Coverage Report step is included after any unit testing suites, etc.

EMMA Prerequisites

  • You must have AnthillPro administrative privileges to configure the integration. See Manage Security.

  • EMMA must already be installed and running. See EMMA documentation.

  • The directory where the EMMA report file is located must be available.

  • To have AnthillPro generate a report of all the projects that use EMMA, an AnthillPro report must first be created.

Configure EMMA Coverage Report Publisher

Configure the EMMA Coverage Report publisher step, which is tasked with retrieving the HTML report generated by EMMA. Once EMMA is configured with the builder, the EMMA Coverage Report step is included after the Populate Workspace, Changelog, Stamp, Dependency, Build, and Run Unit Test steps of the typical Build job.

  1. Go to Administration, select the appropriate project, and click the Add Job icon. If adding EMMA to an existing job, select the appropriate job and proceed to Item Three below.

  2. Follow the steps for creating a build job.

    Before proceeding to Item Three, add EMMA to your build script, typically as an Ant task. See EMMA documentation.

  3. EMMA Coverage Report. Select the Insert After icon of the step prior to the point where the EMMA step is to be included (e.g., the run Unit Tests step). Go to Coverage > EMMA, select the EMMA Coverage Report step, and click Select.

    • Name the step (required).

    • Description. Provide a short description.

    • Report Name. Give the name for this report (default is same as step name).

    • Report Directory. Give the directory where the EMMA HTML report files will be retrieved from.

    • Include Patterns. Give the file name patterns that describe the files to be retrieved. Each include pattern must be entered on a separate line.

      You can also use the following wild cards to tell AnthillPro what to include:

      • ** Indicates include every directory within the base directory.

      • * Used to include every file. So, if you use *.zip, the files matching this pattern will be included.

      • **/* Tells AnthillPro to retrieve the entire file tree underneath the base directory.

    • Exclude Patterns. Provide the file name patterns identifying the files that will NOT be retrieved. This field is set in the same way as the Include Patterns field, only you are telling AnthillPro what NOT to include.

    • Store Data. Check the box to store the coverage.xml results in the AnthillPro database for metrics usage.

      • Data Directory. If the Store Data option is used, give the base directory where the EMMA coverage.xml files will be retrieved from -- if different than the report directory. Default is the same as Source Directory. All files matching the pattern **/coverage.xml in the directory will be used.

    • Show Additional Options (advanced). Select the Show Additional Options link to configure more options.

      • Is Active. Select No to temporarily deactivate the step without deleting it; otherwise select Yes.

      • Pre-Condition Script. From the drop down menu, select the condition which must be met for the step to continue. Before editing an existing script or creating a new one, see Step Pre-Condition Scripts.

      • Ignore Failures. Select Yes if this step should not effect the determination for step continuation or the status determination of the job.

      • PostProcessingScript. Select a script for determining when commands should count as fail or succeed. See Post Processing Scripts.

      • Timeout. Enter the time in minutes after the start of the step when AnthillPro will consider the step as timed out and abort it.

  4. Click Save.

  5. If configuring the Evaluate Script step to fail the workflow based on coverage percentage, see Configure Evaluate Script Step (EMMA). Otherwise, proceed to Add EMMA Job to Workflow.

Configure Evaluate Script (EMMA)

To have AnthillPro fail a workflow based on the EMMA report, add an Evaluate Script step to the Build job. The Evaluate Script step, added after the EMMA Coverage Report Publish step, will read the information in the database and then fail a workflow if the percentage of test coverage is less than the minimum limit. See Tools > Developer Tools > Scripting API > CoverageHelper.

Example Coverage Report Script:

import com.urbancode.anthill3.domain.coverage.CoverageReport;
import org.apache.log4j.Logger;

static private final Logger log = Logger.getLogger("Stuff");
CoverageReport[] reports = null;
try {
  reports = CoverageHelper.getForCurrentBuildLife();
}
catch (Exception e) {
  log.warn(e);
}

if (reports != null) {
  log.warn("Coverage getForCurrentBuildLife " + reports.length);
  log.warn("Coverage " + reports[0].getLinePercentage());
  log.warn("Coverage " + reports[0].getBranchPercentage());
  log.warn("Coverage " + reports[0].getCoverageType());
  log.warn("Coverage " + reports[0].getName());
}


CoverageReport[] reports = CoverageHelper.getForBuildLife(BuildLifeLookup.getCurrent());
if (reports != null) {
  log.warn("Coverage getForBuildLife " + reports.length);
  log.warn("Coverage " + reports[0].getLinePercentage());
  log.warn("Coverage " + reports[0].getBranchPercentage());
  log.warn("Coverage " + reports[0].getCoverageType());
  log.warn("Coverage " + reports[0].getName());
}

CoverageReport[] reports = CoverageHelper.getForCurrentJobTrace();
if (reports != null) {
  log.warn("Coverage getForCurrentJobTrace " + reports.length);
  log.warn("Coverage " + reports[0].getLinePercentage());
  log.warn("Coverage " + reports[0].getBranchPercentage());
  log.warn("Coverage " + reports[0].getCoverageType());
  log.warn("Coverage " + reports[0].getName());
}

CoverageReport[] reports = CoverageHelper.getForJobTrace(JobTraceLookup.getCurrent());
if (reports != null) {
  log.warn("Coverage getForJobTrace " + reports.length);
  log.warn("Coverage " + reports[0].getLinePercentage());
  log.warn("Coverage " + reports[0].getBranchPercentage());
  log.warn("Coverage " + reports[0].getCoverageType());
  log.warn("Coverage " + reports[0].getName());
}

CoverageReport[] reports = CoverageHelper.getRecentForCurrentWorkflow();
if (reports != null) {
  log.warn("Coverage getRecentForCurrentWorkflow " + reports.length);
  log.warn("Coverage " + reports[0].getLinePercentage());
  log.warn("Coverage " + reports[0].getBranchPercentage());
  log.warn("Coverage " + reports[0].getCoverageType());
  log.warn("Coverage " + reports[0].getName());
}

CoverageReport[] reports = CoverageHelper.getRecentForWorkflow(WorkflowLookup.getCurrent());
if (reports != null) {
  log.warn("Coverage getRecentForWorkflow " + reports.length);
  log.warn("Coverage " + reports[0].getLinePercentage());
  log.warn("Coverage " + reports[0].getBranchPercentage());
  log.warn("Coverage " + reports[0].getCoverageType());
  log.warn("Coverage " + reports[0].getName());
}

To configure the Evaluate Script step:

  1. Select the Insert After icon of the EMMA Coverage Report step. Expand the Miscellaneous folder, select the Evaluate Script step, and click Select.

  2. Name the step (required).

  3. Description. Provide a short description.

  4. Script. Give the BeanShell script to evaluate. See Scripting.

  5. Show Additional Options (advanced). Select the Show Additional Options link to configure more options.

    • Is Active. Select No to temporarily deactivate the step without deleting it; otherwise select Yes.

    • Pre-Condition Script. From the drop down menu, select the condition which must be met for the step to continue. Before editing an existing script or creating a new one, see Step Pre-Condition Scripts.

    • Ignore Failures. Select Yes if this step should not effect the determination for step continuation or the status determination of the job.

    • PostProcessingScript. Select a script for determining when commands should count as fail or succeed. See Post Processing Scripts.

    • Timeout. Enter the time in minutes after the start of the step when AnthillPro will consider the step as timed out and abort it.

  6. Click Save.

Add EMMA Job to Workflow

The Job with the EMMA step(s) must be executed as part of a workflow (see Configure EMMA Coverage Report Publisher). This section will assume that an originating workflow has already been configured, and will cover the process of adding the build job that includes EMMA to the appropriate workflow. Complete workflow configuration is beyond the scope of this tutorial. The topics covered in detail below are specific to using the EMMA integration.

  1. Go to Administration, select the project, and select the build workflow.

  2. On the workflow Main page, select the Definition tab.

  3. From the drop-down menu, choose Embedded Definition and click Select.

  4. Left-click the Start icon and select Insert Job After.

  5. Select the Build job created in the Configure EMMA Coverage Report Publisher section, choose a job pre-condition script, and click Insert Job.

Run Workflow and View Report (EMMA)

  1. Go to Dashboard and select the workflow created in the Add EMMA Job to Workflow section.

  2. On the workflow Main page, click the Build button for the workflow.

  3. Once the workflow has completed, select the appropriate Build Life and click the Reports tab.

  4. Select the EMMA link to view the EMMA coverage report for this build.

  5. If the coverage.xml has been made available for report generation (see Store Data in the Configure EMMA Coverage Report Publisher Step section), go to the Reports page and select the Run Report icon to view the coverage report for all AnthillPro projects using EMMA.