4

i'm trying to skip a specific test case using keyword, is there are any keyword to do that ? what i'm trying to do is to check if file name have "skip" word then i want to skip it. is there are any keyword like : Skip Test , Skip Execution If ...

@{regex}=  Get Regexp Matches  ${TEST NAME}  Skip
${lenght}=  Get Length  ${regex}
Skip Execution If  '${lenght}'>'0'  
Roni
  • 604
  • 2
  • 6
  • 12

3 Answers3

4

Nowadays, there are the following keywords added, in Robot Framework: Skip and Skip if

2

Ideally, tests that should not be run should be excluded from the run using tags or other means. Another option is to still run the tests, but simply check for your skip condition at the start of the test and pass the test without executing anything. There are two keywords, Builtin.Pass Execution and Builtin.Pass Execution If, useful for that.

http://robotframework.org/robotframework/latest/libraries/BuiltIn.html#Pass%20Execution%20If

ombre42
  • 2,344
  • 15
  • 21
  • is there are any way to do it without using tags ? – Roni Dec 29 '15 at 15:33
  • By file location, file name, and by test suite and test case names: http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#selecting-test-cases – ombre42 Dec 29 '15 at 16:16
  • i success to skip the test but i didn't got "Skip" status , how can i get it ? – Roni Dec 30 '15 at 08:50
  • 1
    There is no skipped test status yet in Robot Framework. Check out https://github.com/robotframework/robotframework/issues/2087 – ombre42 Dec 30 '15 at 14:57
  • 2
    If you used Pass Execution to skip your tests, you can pass an optional SKIP tag at the end so that the case will be tagged as SKIP in the log/report. Eg: Pass Execution Skipping this test SKIP. Here SKIP is the tag that will be added to this test case and it will show up in your log/report as a tag. Source: http://robotframework.org/robotframework/latest/libraries/BuiltIn.html#Pass%20Execution – ash9209 Jan 08 '16 at 17:32
0
Get request
    Create Session    mysession    ${base_url}    disable_warnings=True
    ${end_point}=    Set Variable    /api/users/2
    ${body}=    Create Dictionary    name=xyz    job=Engineer
    **Skip**
    ${response}=    DELETE On Session    mysession    ${end_point}
    Log To Console    ${response.status_code}
  • Thank you for contributing to the Stack Overflow community. This may be a correct answer, but it’d be really useful to provide additional explanation of your code so developers can understand your reasoning. This is especially useful for new developers who aren’t as familiar with the syntax or struggling to understand the concepts. **Would you kindly [edit] your answer to include additional details for the benefit of the community?** – Jeremy Caney Aug 30 '23 at 00:46