从Jenkins Pipeline发布多个机器人测试结果

6

我有一个Jenkins 2.0 Pipeline脚本,运行两个不同的Robot测试套件。脚本尝试发布两个测试套件的结果,但是发布者会用最后一个发布覆盖第一个发布。

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

从用户界面上看,我们看到有两个已发布的结果,但两个集合都是用于回归测试用例。最后一次发布胜出。

enter image description here

有没有办法可以发布两组机器人测试结果。

2个回答

4
这不是直接回答您的问题,但它是解决您想要实现的问题的可能方案。
您可以使用rebot将两组Robot结果合并为一组。然后只需发布合并后的报告。rebot有很多选项可用于合并报告。

谢谢。你有关于如何做这个的文档吗?这确实是一个备选项。最好分别呈现两个测试套件的结果。 - timmy
2
文档可以在这里找到:http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#using-robot-and-rebot-scripts,“rebot --help”将提供许多选项的列表。通常我会使用类似于rebot -o combined.xml -r combinedreport.html -l combinedlog.html -x combined.xunit **/*.xml的命令,然后将结果带入Jenkins。 - Kenneth E. Bellock

2

我使用了一种解决方法,即仅在执行所有测试集后才发布结果。

输出文件和报告参数设置为** /.ext。

虽然不完美,但似乎它可以工作-我有一个“机器人表格”,报告、日志等都可以在子文件夹中访问。

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",
            ]
          )
        }
  }
}

作为更复杂管道的改进,结果应该在每个阶段的末尾“存储”,并在发布阶段的开始“取消存储”。我的管道在单个节点上运行了几分钟,因此我还没有解决它。 - BuckTheBug

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接