Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Publish Multiple Robot Test Results From Jenkins Pipeline

I have a Jenkins 2.0 Pipeline script that runs a two separate suite of Robot tests. The script tries to publish both test suite results, however the publisher over-writes the first publish, with the last one.

node('robot') {
    ...
    publishTestResults('journey')
    publishTestResults('regression')
}

void publishTestResults(String type) {
step([
        $class           : 'hudson.plugins.robot.RobotPublisher',
        outputPath       : 'portfolio-app\\target\\robot-output\\' + type,
        passThreshold    : 100,
        unstableThreshold: 100,
        otherFiles       : '',
        reportFileName   : '*\\report*.html',
        logFileName      : '*\\log*.html',
        outputFileName   : '*\\output*.xml'
])

}

From the UI, we see two published results, but both sets are for the regression test cases. The last publish wins.

enter image description here

Is there any way that we can publish two sets of Robot results.

like image 788
timmy Avatar asked Feb 13 '17 18:02

timmy


People also ask

How do I customize my Robot Framework test report?

One solution is to create your own report from scratch. The XML output is very easy to parse. You can turn off the generation of reports with command line options (eg: --log NONE and --report NONE ). Then, create a script that generates any type of report that you want.


2 Answers

This will not answer your question directly, but it is a possible solution to what you are trying to accomplish.

You can use rebot to combine your two sets of Robot results into one. And then just publish the merged report. There are lots of options with rebot on how to merge reports.

like image 179
Kenneth E. Bellock Avatar answered Oct 11 '22 10:10

Kenneth E. Bellock


I used a workaround that I publish results only once after all test sets are executed.

Output file and report parameters are set as **/.ext.

Not perfect but it seems it works - I have one 'Robot table' and reports, logs, ... are accessible in subfolders.

stage('Smoke tests'){
    steps {        
        bat('pybot --nostatusrc --outputdir ./robot_reports/smoke <other parameters>')
     }
}

stage('E2E tests'){
    steps {
        bat('pybot --nostatusrc --outputdir ./robot_reports/e2e <other parameters>')
      }
}

stage('Publish Robot results') {
    steps {
        script {
          step(
            [
              $class              : 'RobotPublisher',
              outputPath          : 'robot_reports',
              outputFileName      : "**/output.xml",
              reportFileName      : '**/report.html',
              logFileName         : '**/log.html',
              disableArchiveOutput: false,
              passThreshold       : "${env.ROBOT_PASS_THRESHOLD}" as double,
              unstableThreshold   : "${env.ROBOT_UNSTABLE_THRESHOLD}" as double,
              otherFiles          : "**/*.png,**/*.jpg",
            ]
          )
        }
  }
}
like image 1
BuckTheBug Avatar answered Oct 11 '22 11:10

BuckTheBug