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 :

Creating Pipeline:

To create a pipeline, perform the following steps:

...

Click New Item, pick a name for your job, select Pipeline, and click OK.

...

You will be taken to the configuration screen for the Pipeline. The Script text area is important as this is where your Pipeline script is defined.

...

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:

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 4.x Cloud:

code
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).

...

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

Output for 3.x server:

...

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 Server1' step will publish test results in TestNG format and 'Upload Result to QTM4J Server2' 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')

...