Skip to content

fundacionjala/enforce-jenkins-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status license

EnForce Jenkins Plugin

This plugin allows you to capture code coverage information from EnForce gradle plugin.

The plugin will generate:

  • Code coverage percentage.

  • A pie chart with amount of test classes whose code coverage percentage is in the ranges defined as:

    • Danger (0% - 74%)
    • Risk (75% - 79%)
    • Acceptable (80% - 94%)
    • Safe(95% - 100%)

The EnForce jenkins plugin can be downloaded here.

Code Coverage chart

Displays the code coverage percent and also the coverage status categorized by type(Danger, Risk, Acceptable, Safe)

Coverage Percent

Prerequisites

This plugin depends of coverage.json file that is generated by runTest task of EnForce gradle plugin.

Why this plugin?

This plugin is a good fit for generating code coverage information of your Salesforce organization and also you can configure the minimum coverage percentage in your jenkins job.

Features

  • It generates code coverage percentage of your organization.
  • It generates a pie chart with amount of test classes whose code coverage percentage is in the ranges that were defined above.
  • It changes the build job status to fail according minimum code coverage percentage configured.

Installation

  • Install the plugin in Jenkins.
    • The plugin is hosted on the Bintray repository
    • Go to Jenkins -> Manage Plugins -> Advanced
    • Search section Upload Plugin
    • Choose enforce-jenkins-plugin.hpi file
    • And upload it
    • Ensure you restart Jenkins

Configuration

  • Configure the plugin in Jenkins.
    • Select your job.
    • Go to Configure -> Add post-build action
    • Search Publish EnForce Coverage Report option
    • Set Coverage JSON file name
    • Set Minimum coverage percentage
      If the code coverage percent is less than the defined Minimum coverage percentage value, the build is considered unstable.

Configure the plugin in Jenkins

Token Macros

The following macros are provided to be integrated to any other plugin(E.G. Email-ext plugin ) that consumes Token Macro Plugin infrastructure.

  • ENFORCE_COVERAGE_RESULT
  • ENFORCE_COVERAGE_STATUS
  • ENFORCE_TEST_RESULT

Usage

They are able to be used within a expression definition. E.G. It is a default email content for Email-ext plugin

$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:

$ENFORCE_COVERAGE_RESULT
$ENFORCE_COVERAGE_STATUS
$ENFORCE_TEST_RESULT

Check console output at $BUILD_URL to view the results.