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


Solution 1:[1]

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

Solution 2:[2]

It is possible to include and exclude test cases by tag names with the --include (-i) and --exclude (-e) options, respectively.

--include example
--exclude not_ready
--include regression --exclude long_lasting

https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#by-tag-names

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Iman