使用 Jenkins + Robot 框架进行测试自动化
Test automation with Jenkins + Robot framework
我们正在使用 Jenkins 进行持续集成。
我还为机器人框架测试用例创建了一个 Jenkins 作业。但是在使用 Jenkins 运行宁机器人框架测试用例时遇到问题。
说,如果我必须在机器人框架的 Jenkins 作业中包含大约 300 个测试用例,同时 运行 测试用例,如果任何测试用例失败,那么剩余的测试脚本将不会被处决。
例如:在运行测试用例中,如果第10个测试用例失败,那么剩下的290个测试用例将不会被执行!
在 Jenkins 中是否有更好的选择 运行 所有测试用例以并发方式进行? - 这样任何测试用例的失败都不会影响其他测试用例的执行!
My only requirement is - All the test cases listed in Jenkins job must be get executed even if any test cases got failed in between.
你能为这个问题提出一个解决方案吗?
我是否必须为此包含任何其他插件?
这是这个特定 Jenkins 作业的屏幕截图 -
https://wiki.jenkins-ci.org/display/JENKINS/Robot+Framework+Plugin 列出必要的配置步骤之一:
- Force your Robot script to return successfully from shell with "exit
0" to empower the plugin in deciding if the build is success/failure
(by default Robot exits with error code when there's any failed tests)
因此,如果您的测试脚本 return 0,则 jenkins 构建不会失败,您可以根据结果决定要显示的状态。
- Set thresholds and optionally disable thresholds for critical tests
only to count every test in the pass percentage.
这不是 运行 批量测试的好方法。对于初学者来说,RobotFramework 日志将只包含最后一次测试的结果,即使它们都通过了。
问题是,当构建中的 'Execute Shell' 步骤失败时,Jenkins 会停止构建。正如上面评论中指出的,您可以尝试使用 exit 0
.
更改 return 状态
但是,不是每个测试都是一个单独的构建步骤:
pybot /home/arun/test-cases/228.txt
pybot /home/arun/test-cases/117.txt
...etc
您应该一步执行它们:
pybot /home/arun/test-cases/
如果您需要控制执行哪些测试而不是该文件夹及其子文件夹中的所有有效测试文件,请使用 tags。
我们正在使用 Jenkins 进行持续集成。
我还为机器人框架测试用例创建了一个 Jenkins 作业。但是在使用 Jenkins 运行宁机器人框架测试用例时遇到问题。
说,如果我必须在机器人框架的 Jenkins 作业中包含大约 300 个测试用例,同时 运行 测试用例,如果任何测试用例失败,那么剩余的测试脚本将不会被处决。
例如:在运行测试用例中,如果第10个测试用例失败,那么剩下的290个测试用例将不会被执行!
在 Jenkins 中是否有更好的选择 运行 所有测试用例以并发方式进行? - 这样任何测试用例的失败都不会影响其他测试用例的执行!
My only requirement is - All the test cases listed in Jenkins job must be get executed even if any test cases got failed in between.
你能为这个问题提出一个解决方案吗?
我是否必须为此包含任何其他插件?
这是这个特定 Jenkins 作业的屏幕截图 -
https://wiki.jenkins-ci.org/display/JENKINS/Robot+Framework+Plugin 列出必要的配置步骤之一:
- Force your Robot script to return successfully from shell with "exit 0" to empower the plugin in deciding if the build is success/failure (by default Robot exits with error code when there's any failed tests)
因此,如果您的测试脚本 return 0,则 jenkins 构建不会失败,您可以根据结果决定要显示的状态。
- Set thresholds and optionally disable thresholds for critical tests only to count every test in the pass percentage.
这不是 运行 批量测试的好方法。对于初学者来说,RobotFramework 日志将只包含最后一次测试的结果,即使它们都通过了。
问题是,当构建中的 'Execute Shell' 步骤失败时,Jenkins 会停止构建。正如上面评论中指出的,您可以尝试使用 exit 0
.
但是,不是每个测试都是一个单独的构建步骤:
pybot /home/arun/test-cases/228.txt
pybot /home/arun/test-cases/117.txt
...etc
您应该一步执行它们:
pybot /home/arun/test-cases/
如果您需要控制执行哪些测试而不是该文件夹及其子文件夹中的所有有效测试文件,请使用 tags。