Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

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:

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

  2. 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.

  3. Now, click on your Pipeline and Configure it to edit its script. Here you can configure two different steps/stages in a single pipeline job that will publish test results of their respective formats. You will have to mention a separate 'stage' for each specific Test results file in your pipeline script, refer the code snippet shared 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 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).

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

  • No labels