How to run specific test cases from a test suite using Robot Framework

五迷三道 提交于 2019-12-02 22:22:07
Bryan Oakley

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

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)

The user guide has a section titled Selecting test cases which covers this subject.

Logan M

If you want to run single test case in Robot Framework, use the below example.

Syntax: robot -t "Test Case Name" Test Suite Name
Example: robot - t "PON Type Test Case" Aquarium_Project.robot

If you want to run all the test cases in Robot Framework, use the below example

Syntax: robot Test Suite Name
Example: robot Aquarium_Project.robot

If you are using __init__.robot files that have setups and teardowns, you cannot directly call a test from a test file if you have nested directory structures like the following:

|-- foo
    |-- bar.robot

And the bar.robot file has a test case named baz, in this case, you can do the following:

robot --test 'foo.bar.baz' foo

With deeper nesting:

|-- foo
    |-- bar
        |-- baz.robot

robot --test 'foo.bar.baz.*' foo

You can use * (asterisk) to run all test cases in the foo.bar.baz suite.

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