In my robot script total 10 testcase are preset under TEST Cases section. Test1 is independent and does not need to run all the time; one time execution is enough.
Please suggest if there is a keyword that would skip only testcase1
.
However if user is interested to run the script including testcase1
, then user has to specify in command like something like pybot <scriptname> "add testcase1"
.
testcase1
....
....
testcase2
....
....
testcase3
....
....
testcase10
....
....
In TestNG, @Test(enabled=false) annotation is used to skip a test case if it is not ready to test. We don't need to import any additional statements. And We can Skip a test by using TestNG Skip Exception if we want to Skip a particular Test.
This can be accomplished by selecting test cases by names (--test and --suite options), tags (--include and --exclude), or by previous status (--rerunfailed or --rerunfailedsuites).
You can create your logic inside the keyword section, and then pass the Name of the Custom Created keyword (Equal String) to the Test script. Example of Keywords. Save this answer.
There is no keyword for skipping a test. If you need to determine at run time whether to run a test or not, your only choice is to immediately fail it or cause it to pass without doing any other work. Robot simply doesn't support skipping tests once the tests start running
However, there is a command line option to let you skip tests by tag. This is a very powerful feature of robot. For more information see Selecting test cases in the robot framework users guide.
For example, consider the following test suite:
*** Test Cases ***
| Test case 1
| | [Tags] | run-once
| | log | this is test case 1
| Test case 2
| | log | this is test case 2
To run all the tests you would do this:
$ pybot example.robot
If you wanted to skip the first test you can use the --exclude
option:
$ pybot --exclude run-once example.robot
If you wanted to run only the first test you could explicitly include it, which will run only the tests that have this tag:
$ pybot --include run-once
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With