Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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 :

...

Code Block
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:

Code Block
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).

...

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')

...