File tree Expand file tree Collapse file tree 3 files changed +38
-2
lines changed Expand file tree Collapse file tree 3 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,15 @@ Skip Keyword
9
9
Skip with Library Keyword
10
10
Check Test Case ${TEST NAME }
11
11
12
+ Skip If Keyword with True Condition
13
+ Check Test Case ${TEST NAME }
14
+
15
+ Skip If Keyword with True Condition And Custom Message
16
+ Check Test Case ${TEST NAME }
17
+
18
+ Skip If Keyword with False Condition
19
+ Check Test Case ${TEST NAME }
20
+
12
21
Skip Keyword with Custom Message
13
22
Check Test Case ${TEST NAME }
14
23
Original file line number Diff line number Diff line change @@ -15,6 +15,19 @@ Skip with Library Keyword
15
15
Skip with Message Show must not got on
16
16
Fail Should not be executed!
17
17
18
+ Skip If Keyword with True Condition
19
+ [Documentation] SKIP 1 == 1
20
+ Skip If 1 == 1
21
+
22
+ Skip If Keyword with True Condition And Custom Message
23
+ [Documentation] SKIP Skipped with abandon.
24
+ Skip If 1 == 1 Skipped with abandon.
25
+
26
+ Skip If Keyword with False Condition
27
+ [Documentation] FAIL AssertionError
28
+ Skip If 1 == 2
29
+ Fail
30
+
18
31
Skip Keyword with Custom Message
19
32
[Documentation] SKIP Skipped due to reasons
20
33
Skip Skipped due to reasons
Original file line number Diff line number Diff line change @@ -2251,11 +2251,25 @@ def _get_suite_in_teardown(self, kwname):
2251
2251
class _Control (_BuiltInBase ):
2252
2252
2253
2253
def skip (self , msg = 'Skipped with Skip keyword.' ):
2254
- # TODO: docs
2255
- """Skip execution of the rest of the current test/task.
2254
+ """Skips the rest of the current test.
2255
+
2256
+ Skips the remaining keywords in the current test and sets the given
2257
+ message to the test. If the test has teardown, it will be executed.
2256
2258
"""
2257
2259
raise SkipExecution (msg )
2258
2260
2261
+ def skip_if (self , condition , msg = None ):
2262
+ """Skips the rest of the current test if the ``condition`` is True.
2263
+
2264
+ Skips the remaining keywords in the current test and sets the given
2265
+ message to the test. If ``msg`` is not given, the ``condition`` will
2266
+ be used as the message. If the test has teardown, it will be executed.
2267
+
2268
+ If the ``condition`` evaluates to False, does nothing.
2269
+ """
2270
+ if self ._is_true (condition ):
2271
+ raise SkipExecution (msg or condition )
2272
+
2259
2273
def continue_for_loop (self ):
2260
2274
"""Skips the current for loop iteration and continues from the next.
2261
2275
You can’t perform that action at this time.
0 commit comments