如何使用 Robot Framework 从测试套件运行特定的测试用例 [英] How to run specific test cases from a test suite using Robot Framework
问题描述
我是 Robot 新手,正在学习编写逻辑和测试用例.
I am new to Robot and am learning to write logic and test cases.
我有一个测试套件mytestsuite.robot",里面有很多测试用例.我的一个测试用例中有几个错误.
I have a test suite, "mytestsuite.robot", which has a lot of test cases. I have a couple of errors in one of my test cases.
如果我不想再次运行整个测试套件,我该如何只运行那个特定的测试用例?
How do I run just that specific test case since I don't want to run the whole test suite again?
testcase1
....
....
testcase2
....
....
testcase3
....
....
testcase4
....
....
说测试用例 3 失败了,我只想重新运行测试用例 3.
Say test case 3 failed, and I want to just rerun test case 3.
我尝试使用:
pybot mytestsuite.robot -t testcase3
但我收到一个错误.
推荐答案
您想使用 -t
或 --test
选项,但选项变为 before 文件名而不是之后.这应该有效:
You want to use the option -t
or --test
, but the option goes before the name of the file rather than after. This should work:
robot -t testcase1 mytestsuite.robot
用户指南中标题为开始测试执行,也可以在命令行中使用 --help
选项(例如 pybot --help
)
The order of the command line arguments is covered in the user guide under a section titled Starting test execution, and is also available at the command line with the --help
option (e.g. pybot --help
)
请注意,特定文件名是可选的.您只能使用:机器人 -t testcase1 .
Be aware that the specific file name is optional. You could use only: robot -t testcase1 .
."在哪里表示查找包含指定测试的所有文件.机器人会努力寻找具体的测试.
Where "." means look for all files that contains the specified test. Robot will do the hard work of finding the specific test.
您也可以在测试名称的开头或结尾使用 willcard 作为 *,以轻松匹配一个测试或运行多个测试.
You can use also willcard as * in the begining or finish of the test name, to match easily a test or to run multiple tests.
robot -t "testcase1*" .
robot -t "testcase1*" .
将匹配当前文件夹中所有以testcase1"开头的测试.
Will match all tests that begin with "testcase1" in current folder.
用户指南有一个标题为选择测试用例的部分涵盖了这个主题.
The user guide has a section titled Selecting test cases which covers this subject.
这篇关于如何使用 Robot Framework 从测试套件运行特定的测试用例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!