Mysterio Man Mysterio Man - 3 months ago 22
Python Question

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

I am new to Robot and learning to write logic and test cases.

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 dont want to run the whole test suite again.

mytestsuite.robot

testcase1
....
....
testcase2
....
....
testcase3
....
....
testcase4
....
....


Say test case 3 failed and I want to just rerun test case 3

I tried to use pybot mytestsuite.robot -t testcase3
But I get an error

Answer

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.