Usage
Integration
To install the plug-in, perform the following steps:
- 1. In HCL DevOps Velocity, click Settings > Integrations > Available.
- 2. In the Action column for the Cucumber plug-in, click Install.
Integrating the plug-in by using user interface
To integrate the plug-in using the user interface, perform the following steps:
- 1. In HCL DevOps Velocity, click Settings > Integrations > Installed.
- 2. In the Action column for the Cucumber plug-in, click Add Integration.
- 3. On the Add Integration dialog, enter the values for the fields to configure the integration and define communication.
- 4. Click Add.
Integration type
The Cucumber plug-in parses Cucumber data sent in a XML file. The plug-in parses the *.xml
file located in the target/surfire-reports
directory generated by a Cucumber project.
Invoking the plug-in
To gather data from the Cucumber server, send an HTTP Post request with the data to parse. Whenever 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 Jenkin’s DevOps Velocity plugin into your Jenkins server. In your freestyle job or pipeline use the Upload Metrics File to HCL DevOps Velocity step and provide the required fields. This step allows your build job to upload results files to HCL DevOps Velocity.
pipeline {
agent any
stages {
stage('cucumberMetrics') {
steps {
step([$class: 'UploadMetricsFile',
appName: 'My Cucumber Test',
dataFormat: 'cucumberXML',
filePath: '',
name: 'my-cucumber-test',
pluginType: 'cucumber',
tenantId: '',
testSetName: 'cucumber',
metricsRecordUrl: "${env.BUILD_URL}"
])
}
}
}
}
Invoke using REST CALL
When using a REST call to invoke the 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:
- Update the server location of HCL DevOps Velocity in the URL.
- The BODY of the call is a multipart/form data. It includes information about the payload.
METHOD: POST
URL: https://<URL of HCL DevOps Velocity Server>/reporting-consumer/metrics
BODY (multipart/form-data):
{
payload: <JSON Object>
testArtifact: <cucumber_xml_file>
}
Example:
Invoke using Curl
curl --request POST \
--url https://url_devopsvelocity_server>/reporting-consumer/metrics \
--form 'payload={
"tenant_id": "5ade13625558f2c6688d15ce",
"application": {
"name": "My Application"
},
"record": {
"pluginType": "cucumber",
"dataFormat": "cucumberXML"
}
}
' \
--form testArtifact=@test-result/cucumber.xml
Payload schema
The following shows the schema for the payload. Replace the angle brackets with your values for the parameters.
{
"tenant_id": "",
"metricName": "",
"application": {
"name": ""
},
"record": {
"recordName": "",
"executionDate": 1547983466015,
"pluginType": "cucumber",
"dataFormat": "cucumberXML",
"metricsRecordUrl": ""
},
"build": { // One of the following fields must be included
"buildId": "",
"jobExternalId": "",
"url": "",
},
"commitId": "", // optional
"pullRequestId": "", // optional
"environment": "" // optional
}
Name |
Description |
Required |
tenant_id |
The name of the tenant. |
Yes |
application_name |
The name of the application. |
Yes |
metric_name |
The name of the recurring test set. |
Yes |
commit_id |
|
No |
pull_request_id |
|
No |
environment_name |
|
No |
Record section |
|
|
record_name |
The name for this record |
No |
execution_date |
The date that the test ran, specified in UNIX Epoch time. |
No |
plugin_type |
This value must be cucumber. |
Yes |
dataFormat |
xml file |
Yes |
metricsRecordUrl |
To link the Jenkins build with test results |
No |
Build section |
|
|
build_id |
|
No |
external_job_id |
|
No |
build_url |
|
No |