Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to skip a specific testcase in Robot framework?

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
....
....
like image 874
Siya Avatar asked Oct 14 '14 20:10

Siya


People also ask

How do you skip test case from execution?

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.

How do you run only fail test cases in Robot Framework?

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).

How do you call one test case from another test case in Robot Framework?

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.


1 Answers

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
like image 121
Bryan Oakley Avatar answered Nov 10 '22 15:11

Bryan Oakley