问题描述
我们刚刚开始使用 Eclipse 和 Maven 使用 Robot Framework.我们只想运行某些测试套件(测试套件会有测试用例).有什么办法可以做到吗?
We just started using Robot Framework using Eclipse and Maven. We want to run only certain test suites(test suites will have testcases).Is there any way to do that?
推荐答案
没有 pybot 选项来排除套件,除了首先不将它们包含在命令行中.话虽如此,您有几种选择来完成同样的事情.
There are no pybot options to exclude suites, other than to not include them on the command line in the first place. That being said, you have a couple of options to accomplish the same thing.
第一个选项是提供所有测试标签,然后使用 --exclude
选项排除带有特定标签的测试.例如,在我的组织中,我们使用机器人进行自动化和手动测试.当我们以无人参与的方式运行时,我们将排除所有带有 manual
标记的测试用例.
The first option is to give all your tests tags, and then use the --exclude
option to exclude tests with particular tags. For example, in my organization we use robot for both automated and manual tests. When we run in an unattended fashion we will exclude all of the test cases with the manual
tag.
如果这不切实际,您的另一个选择是枚举您确实想要运行的套件.这很乏味,但如果使用参数文件会更容易.例如,您可以创建一个包含以下内容的文件:
If that is impractical, your other option is to enumerate the suites that you do want to run. This is tedious, but is made easier if you use an argument file. For example, you can create a file with the following contents:
--suite fullsuite.subsuite1
--suite fullsuite.subsuite3
--suite fullsuite.subsuite4
如果您将其保存到名为skip2.args"的文件中,则可以在命令行上使用 --argumentfile
选项引用它.例如:
If you save it to a file named "skip2.args" you can then reference this on the command line with the --argumentfile
option. For example:
pybot --argumentfile skip2.args ./fullsuite
您可以结合使用这两种技术.例如,要跳过subsuite2"并跳过所有标记为手动的测试,您只需将 --exclude
选项添加到 .args 文件:
You can combine these two techniques. For example, to skip "subsuite2" and also skip all tests tagged as manual, you can simply add the --exclude
option to the .args file:
--suite fullsuite.subsuite1
--suite fullsuite.subsuite3
--suite fullsuite.subsuite4
--exclude manual
有关命令行选项的更多信息,您可以在命令行输入 pybot --help
,或查看 机器人框架用户指南中的所有命令行参数.
For more information on command line options you can type pybot --help
at the command line, or see the section All command line arguments in the robot framework user guide.
这篇关于如何在 Robot Framework 中排除测试套件?我们正在使用 Maven的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!