The plugin adds a pipeline step to access code coverage results.
Currently supported coverage providers:
The method getCoverageResult can be used to access code coverage results.
- Parameter
element: the coverage element: e.g.'Line','Conditional'(depends on used coverage adapter) - Return: Integer value representing the coverage in percent (
-1if no coverage results were found)
If no parameter element is given it defaults to 'Line'.
These are examples for use with the code-coverage-api-plugin which provides 'Line' and 'Conditional' coverage elements for all adapters.
def lineCoverage = getCoverage('Line');def conditionCoverage = getCoverage('Conditional');