• Overview
  • Documentation
  • Version history

Description

The Code Coverage plug-in allows for the parsing of data from several code coverage tools. Included are LCOV, Cobertura, JaCoCo, and Clover data.

Quick Info

Product icon

Product

DevOps Velocity (HCL Accelerate)
Plugin type icon

Type

plugin
Compatibility icon

Compatibility

HCL DevOps Velocity 5.0.x, HCL Accelerate 4.0.x or earlier
created by icon

Created by

HCLSoftware
Website icon

Website

Published Date

Last Updated

Summary

The Code Coverage plug-in allows for parsing of data from several code coverage tools. It parses data from LCOV, Cobertura, JaCoCo, and Clover. Data is uploaded to the HCL DevOps Velocity server using an HTTP Post request.

Usage

To use the Code Coverage plug-in, the plug-in must be loaded, and an instance created. Load the plug-in into the HCL DevOps Velocity container if necessary.

Integration type

The Code Coverage plug-in is a parser type plug-in and it parses data from the following test tools:

  • LCOV
  • Cobertura
  • JaCoCo
  • Clover

Integration steps

1. In HCL DevOps Velocity, click Settings > Integrations > Available.

2. In the Action column for the Code Coverage plug-in, click Install.
The plug-in is now listed in the Installed tab and available for invoking.

Invoking the plug-in

To gather data from the Code Coverage server, send an HTTP Post request with the data to parse. Whenever a there is a hit to the endpoint, the data is parsed and displayed as metrics in HCL DevOps Velocity. You can use various methods such as Postman, REST calls, CURL, and CI/CD tools like Jenkins to invoke the plug-in endpoints.

Invoke using Jenkins plug-in

Install the Jenkins plug-in into your Jenkins server. In your freestyle job or pipeline use the UCV-Upload Metrics File to HCL DevOps Velocity step and provide the required fields. This step allows your build job to upload generated coverage results files to HCL DevOps Velocity.


pipeline {
   agent any
   stages {
      stage('codeCoverageMetrics') {
         steps {
            step([$class: 'UploadMetricsFile',  appName: 'My Code-Coverage Test', dataFormat: 'cobertura', filePath: '<location of the code coverage report>', name: 'my-code_coverage-test', pluginType: 'coverageData', tenantId: '<tenant Id>', testSetName: 'code_coverage', metricsRecordUrl: "${env.BUILD_URL}"])
         }
      }
   }
}

Invoke using a Rest call

When using a Rest call to invoke the Code Coverage plug-in, it must be a POST method and include the location of the HCL DevOps Velocity quality data endpoint.

The following request sample shows a REST call that you can copy and update as necessary. Key points about the snippet:

  • The URL points to the HCL DevOps Velocity quality data endpoint. Update with the server location for your installation of HCL DevOps Velocity.
  • The BODY of the call is a multipart/form data. It includes information about the payload.

METHOD: POST 
URL: https://<url_server>/reporting-consumer/metrics
BODY (multipart/form-data):
 {
  payload: <json_object_string> // See below for schema format
 testArtifact: <cobertura/etc_xml_file>
 }

Invoke using Curl


curl --request POST \
  --url https:///reporting-consumer/metrics \
  --form 'payload={
  "tenant_id": "tenant_id",
  "application": {
    "name": "My Application"
  },
  "record": {
    "pluginType": "coverageData",
    "dataFormat": "cobertura"
  }
}
' \
  --form testArtifact=@test-result/junit.xml

Payload Schema

The following shows the schema for the payload. Replace the angle brackets with your values for the parameters.


{
  "tenant_id": "<tenant_id>",    // required Tenant ID
  "metricName": "<metric_name>", // optional: name for recurring test set
  "application": {
    "name": "<application_name>"  //Name of application
  },
  "record": {
    "recordName": "<record_name>", // optional: Name for this record
    "executionDate": 1547983466015, // optional: UNIX Epoch
    "pluginType": "coverageData",
    "dataFormat": "cobertura",       // cobertura, lcov, jacoco
    "metricsRecordUrl": "<Jenkins_build_url>" // optional: To link the Jenkins build with test results
  },
  "build": {  // Optional: One of the following fields must be included 
    "buildId": "<build_id>",
    "jobExternalId": "<external_job_id>",
    "url": "<build_url>",
  },
  "commitId": "<commit_id>",  // optional
  "pullRequestId": "<pullrequest_id>", // optional
  "environment": "<environment_name>" // optional
}

ucv-ext-coverage-core:1.0.44.tar

Uploaded: 25-Nov-2024 1:20

Pull Command

docker pull hclcr.io/accelerate/ucv-ext-coverage-core:1.0.44

Release Notes

  • Bug Fix: Fixed issues with parsing data from the Clover XML format.

ucv-ext-coverage-core:1.0.42.tar

Uploaded: 09-May-2024 12:16

Pull Command

docker pull hclcr.io/accelerate/ucv-ext-coverage-core:1.0.42
 

Release Notes

  • Feature enhancement: Now core coverage plugin accepts user defined record name and dataset name in payload while hitting post call/curl command. If values are not provided by user it will accept default values given by the plugin.

ucv-ext-coverage-core:1.0.38.tar

Uploaded: 06-Jun-2022 16:13

Pull Command

docker pull hclcr.io/accelerate/ucv-ext-coverage-core:1.0.38
 

Release Notes

  • Minor fix

ucv-ext-coverage-core:1.0.30.tar

Uploaded: 08-Feb-2021 07:33

Pull Command

docker pull hclcr.io/accelerate/ucv-ext-coverage-core:1.0.30
 

Release Notes

  • Plugin name update

Related Plugins