Jenkins pipeline and Robot Framework results

随声附和 提交于 2020-01-03 08:39:09

问题


I had to implement a Pipeline and trying to find a way, how to publish Robot Framework results in Jenkins Pipeline. I found multiple questions about implementation of Robot Framework plugin into Pipeline and also found this question which seems to be solution. However I have tried this approach and results are still missing.

Is there any workaround or functional example?


回答1:


[Edited to reflect successful workaround]

This comment on the issue tracker shows a workaround that seems to work:

step([
    $class : 'RobotPublisher',
    outputPath : outputDirectory,
    outputFileName : "*.xml",
    disableArchiveOutput : false,
    passThreshold : 100,
    unstableThreshold: 95.0,
    otherFiles : "*.png",
])

However, the Robot Framework Plugin currently does not seem to be fully compatible with Pipeline right now: https://issues.jenkins-ci.org/browse/JENKINS-34469

This is common with many plugins in the Jenkins ecosystem right now that have not been updated yet to be compatible with the new Jenkins Pipeline. You could potentially create the full compatibility yourself though, if you're motivated enough.




回答2:


I used the workaround mentioned in the other answer but it wouldn't display the results with the job like in non pipline jobs, so i made freestyle project that is triggered by the pipline job and just copies the results files across then runs the analysis. This is crufty and won't be portable across nodes, the job numbers might get confusing over time so the correlations might be tricky. At the point i will investigate using generic artifact storage or just getting rid of robot altogether.




回答3:


I had trouble using the answer given above, resulting in errors; but I was able to figure it out and add it to the Pipeline. Here is how I fixed it in case anyone else has come across the same issues:

stage('Tests') {

  steps {
    echo 'Testing...'
    script {
      step(
        [
          $class                    : 'RobotPublisher',
          outputPath                : '<insert/the/output/path>',
          outputFileName            : "*.xml",
          reportFileName            : "report.html",
          logFileName               : "log.html",
          disableArchiveOutput      : false,
          passThreshold             : 100,
          unstableThreshold         : 95.0,
          otherFiles                : "*.png"
        ]
      )
    }  
  }
}


来源:https://stackoverflow.com/questions/45547322/jenkins-pipeline-and-robot-framework-results

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!