1

I want to set up notifications in slack through Jenkins using pabot(parallel run of robot framework tests).

I have already configured Jenkins to output the pass/failure/skip notifications when using robot, but once I change it to pabot the notification no long appears in my slack channel.

This command runs successfully and my slack channel is notified of the tests that pass/fail/skip

robot -A Config/Config.args -d results -v REMOTE_URL:http://dummy:0000/wd/hub Tests enter image description here

On the other hand this command alerts my channel that the build has commenced but nothing after that

pabot -A Config/Config.args -d results -v REMOTE_URL:http://dummy:0000/wd/hub Tests

successful configuration In the directory the a pabot_results file is created which is different to the build with the robot command. But the output.xml, log.html and report.html files include the expected results.

I want the basic pass/fail/skip to appear in the slack channel for parallel run test. At the minute no test results are appearing in the slack channel.

enter image description here

KeithMc18
  • 112
  • 2
  • 10

1 Answers1

0

I am using Jenkins declarative pipeline and I have solved problem following way in post section after running robot tests using Token Macro plugin:

post {
    always {
        robot(
            outputPath: 'Reports/',
            outputFileName: 'output.xml',
            reportFileName: 'report.html',
            logFileName: 'log.html',
            disableArchiveOutput: false,
            passThreshold: 100.0,
            unstableThreshold: 95.0,
            otherFiles: '*.png,debug.log'
        )
        script {
            String robotReportSummary = tm('ROBOT_FAILEDCASES: ${ROBOT_FAILEDCASES}, ROBOT_PASSPERCENTAGE: ${ROBOT_PASSPERCENTAGE}, ROBOT_PASSRATIO: ${ROBOT_PASSRATIO}, ROBOT_REPORTLINK: ${ROBOT_REPORTLINK}')
            // Instead of echo step you can use whatever you want with variable robotReportSummary
            echo "${robotReportSummary}"
        }
    }
}

Further info:

From documentation of Robot Framework plugin is visible plugin exports following token macros:

  • ${ROBOT_FAILEDCASES}
  • ${ROBOT_PASSPERCENTAGE, onlyCritical}
  • ${ROBOT_PASSRATIO, onlyCritical}
  • ${ROBOT_REPORTLINK}

As well from source code of Robot Framework plugin it can be found other undocumented token macros:

  • ${ROBOT_FAILED}
  • ${ROBOT_PASSED}
  • ${ROBOT_TOTAL}

In order to access these macros in declarative pipeline you can use Token Macro plugin and it's pipeline step tm. From documentation it's not clear that it returns string with replaced variables. But usage can be found e.g. here in source code of Token Macro plugin.

David Navrkal
  • 464
  • 5
  • 8