Skip to the content.

Cucumber - Usage

To use the Cucumber plug-in, the plug-in must be loaded and an instance created. Load the plug-in into the DevOps Velocity container if necessary. From the user interface, click Settings > **Integrations** > Plugins. On the Plugins page, locate the plug-in and click Load Plugin. To create an instance, locate the plug- in and click Install. The plug-in is now listed below those plug-ins to be installed and available for invoking.

To invoke the plug-in, 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 DevOps Velocity.

Integration type

The Cucumber plug-in is a parser type plug-in. It parses Cucumber data sent in a XML file. The plug-in parses the *.xml file located in the target/surfire-reports directory generated by the Cucumber project.

Invoking the plug-in

You can invoke the plug-in manually using a REST Call or by using a Jenkins plug-in to integrate DevOps Velocity in a Jenkins environment.

Invoke using Jenkins plug-in

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


pipeline {
agent any

stages {
stage('cucumberMetrics') {
steps {
step([$class: 'UploadMetricsFile',
appName: 'My Cucumber Test', dataFormat: 'cucumberXML', filePath: '<location of the cucumber report>', name: 'my-
cucumber-test', pluginType: 'cucumber', tenantId: '<tenant Id>', testSetName: 'cucumber', metricsRecordUrl:
"``${env.BUILD_URL}``"])
}``
}``
}``
}``

Invoke the plug-in using a Rest call

When using a REST call to invoke the Cucumber plug-in, it must be a POST method and include the location of the 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:


METHOD: POST
URL:
https://<url_DevOpsvelocity_server>/reporting-consumer/metrics
BODY (multipart/form-data):
{
payload:
<payload_json_object_string>, // See below for schema format
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": "<*tenant\_id*>",
"metricName": "<*metric\_name*>",

"application": {
"name": "<*application\_name*>"
}``,
"record": {
"recordName": "<*record\_name*>",

"executionDate": 1547983466015,
"pluginType": "cucumber",
"dataFormat": "cucumberXML",

"metricsRecordUrl": "<*Jenkins\_build\_url*>"
}``,
"build": {  // 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
}``

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   No
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   No
build_id   No
external_job_id   No
build_url   No
Back to …   Latest Version Cucumber    
All Plugins Velocity Plugins 1.0.8 Readme Overview Downloads