Back to QMetry All Products Help Page
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 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 3.x Server:
node("") {
stage('Upload Result to QTM4J Server1'){
step([$class: 'TestReportDeployPublisher',testToRun: 'SERVER',jiraurlserver: '{Base URL}',username: '{Username}',password: hudson.util.Secret.fromString('{Password}'),apikeyserver: '{API Key}', formatserver: 'testng/xml', fileserver: 'target/', testassethierarchyserver: 'TestCase-TestStep', labelsserver: 'testng master', versionserver: 'version 1.11', testrunnameserver: 'Demo Testng testrun', platformserver: 'platform 1', componentserver: 'pipeline project', sprintserver: 'JEN Sprint 1', commnetserver: 'testng comment'])
}
stage('Upload Result to QTM4J Server2'){
step([$class: 'TestReportDeployPublisher',testToRun: 'SERVER',jiraurlserver: '{Base URL}',username: '{Username}',password: hudson.util.Secret.fromString('{Password}'),apikeyserver: '{API Key}', formatserver: 'junit/xml', fileserver: 'target/', testassethierarchyserver: 'TestCase-TestStep', labelsserver: 'junit master', versionserver: 'version 1.11', testrunnameserver: 'Demo JUnit testrun', platformserver: 'platform 1', componentserver: 'pipeline project', sprintserver: 'JEN Sprint 1', commnetserver: 'junit comment'])
}
}
For 3.x Cloud:
node("") {
stage('Upload Result to QTM4J Cloud'){
step([$class: 'QTM4JResultPublisher',testToRun: 'CLOUD', apikey: '48aa2954b8380cc2c50bb6b58d394fa0b808e99be177b1a94eec4b91d0ee9fc4', format: 'junit/xml', file: '/target/surefire-reports/JUnit1.xml', testassethierarchy: 'TestCase-TestStep', testrunname: '', testrunkey: '', platform: '', sprint: '', comment: 'junit demo pipeline comment', component: '', testCaseUpdateLevel:'', jirafields: '', attachFile: false])
}
stage('Upload Result to QTM4J Cloud'){
step([$class: 'QTM4JResultPublisher',testToRun: 'CLOUD', apikey: '48aa2954b8380cc2c50bb6b58d394fa0b808e99be177b1a94eec4b91d0ee9fc4', format: 'testng/xml', file: '/target/surefire-reports/testng-results1.xml', testassethierarchy: 'TestCase-TestStep', testrunname: '', testrunkey: '', platform: '', sprint: '', comment: 'junit demo pipeline comment', component: '', testCaseUpdateLevel:'', jirafields: '', attachFile: false])
}
}
Note: If you're not a Jenkins administrator, click the Use Groovy Sandbox option (read here to learn more about this option).
4. Save your pipeline when you are done.
5. Click Build Now to run it.
6. Click â–¾ and select Console Output to see the output:
Output for 3.x server:
Output for 3.x Cloud:
Â
As mentioned in the above code snippet of a pipeline script, the 'Upload Result to QTM4J Server1/Cloud' step will publish test results in TestNG format and 'Upload Result to QTM4J Server2/Cloud' will publish test results in JUnit 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')
Â
Back to QMetry All Products Help Page