Jenkins: Publish multiple framework Test Results from a single Pipeline job

This document is intended for the users who want to publish multiple Test Results of the different framework to QMetry using a single Jenkins Pipeline project. Below are the steps :

Follow this help guide to create a standard Pipeline job in Jenkins configured with QMetry pipeline script.

To configure the pipeline script for multiple framework you need to have separate a step/stage for each framework. Refer the code snippet below :

For 4.x Cloud:

node(""){ stage('Upload Result to QTM4J cloud V4'){ step([$class: 'TestReportDeployPublisherCloudV4', testToRun: 'CLOUD', apikey: '{api key}', format: 'testng/xml', file: '/target', testCycleToReuse: "", attachFile: true, environment: "", build: "",testCycleLabels: "", testCycleComponents: "", testCyclePriority: "High", testCycleStatus: "To Do", testCycleSprintId: "", testCycleFixVersionId: "", testCycleSummary: "Test Cycle Summary", testCaseLabels: "", testCaseComponents: "", testCasePriority: "High", testCaseStatus: "To Do", testCaseSprintId: "", testCaseFixVersionId: "" ]) } stage('Upload Result to QTM4J cloud V4'){ step([$class: 'TestReportDeployPublisherCloudV4', testToRun: 'CLOUD', apikey: '{api key}', format: 'cucumber/json', file: '/target', testCycleToReuse: "", attachFile: true, environment: "", build: "",testCycleLabels: "", testCycleComponents: "", testCyclePriority: "High", testCycleStatus: "To Do", testCycleSprintId: "", testCycleFixVersionId: "", testCycleSummary: "Test Cycle Summary", testCaseLabels: "", testCaseComponents: "", testCasePriority: "High", testCaseStatus: "To Do", testCaseSprintId: "", testCaseFixVersionId: "" ]) } }

Note: If you're not a Jenkins administrator, click the Use Groovy Sandbox option (read here to learn more about this option).

  1. Save your pipeline when you are done.

2. Click Build Now to run it.

3. Click ▾ and select Console Output to see the output:

Output for 4.x Cloud:

Note: Link for the created Test Run on 4.x cloud instance will be available on the response email you will receive after successful completion of the automation process as shown in the image below.

As mentioned in the above code snippet of a pipeline script, the 'Upload Result to QTM4J Cloud V4' step will publish test results in TestNG format and 'Upload Result to QTM4J Cloud V4' will publish test results in Cucumber format as shown in the console output. Using this functionality you can publish multiple Test Results of different formats to QMetry using a single Jenkins Pipeline job.

Note: To perform the same, you need to save the test result file of the selected framework in the associated project’s location. (Ex: /target/surefire-reports/'cucumber-json-report.json')