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

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


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)

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.

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*" .

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.


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.robotrobot --test 'foo.bar.baz.*' foo

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


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