|
1 | 1 | *** Test Cases ***
|
2 |
| -Inline if passing |
| 2 | +IF passing |
3 | 3 | IF True Log reached this
|
4 | 4 |
|
5 |
| -Inline if failing |
6 |
| - [Documentation] FAIL failing inside if |
7 |
| - IF '1' == '1' Fail failing inside if |
8 |
| - |
9 |
| -Inline if not executed |
10 |
| - IF False Fail should not go here |
11 |
| - |
12 |
| -Inline if not executed failing |
13 |
| - [Documentation] FAIL after not passing |
14 |
| - IF 'a' == 'b' Pass Execution should not go here |
15 |
| - Fail after not passing |
16 |
| - |
17 |
| -Inline if else - if executed |
18 |
| - IF 1 > 0 Log does go through here ELSE Fail should not go here |
19 |
| - |
20 |
| -Inline if else - else executed |
21 |
| - IF 0 > 1 Fail should not go here ELSE Log does go through here |
22 |
| - |
23 |
| -Inline if else - if executed - failing |
| 5 | +IF failing |
| 6 | + [Documentation] FAIL Inside IF |
| 7 | + IF '1' == '1' Fail Inside IF |
| 8 | + |
| 9 | +Not executed |
| 10 | + [Documentation] FAIL After IF |
| 11 | + IF False Not run |
| 12 | + Fail After IF |
| 13 | + |
| 14 | +Not executed after failure |
| 15 | + [Documentation] FAIL Before IF |
| 16 | + Fail Before IF |
| 17 | + IF True Not run ELSE IF True Not run ELSE Not run |
| 18 | + |
| 19 | +ELSE IF not executed |
| 20 | + [Documentation] FAIL Expected failure |
| 21 | + IF False Not run ELSE IF False Not run ELSE Executed |
| 22 | + IF 1 > 0 Failure ELSE IF True Not run ELSE IF True Not run |
| 23 | + |
| 24 | +ELSE IF executed |
| 25 | + [Documentation] FAIL Expected failure |
| 26 | + IF False Not run ELSE IF True Executed ELSE Not run |
| 27 | + IF False Not run |
| 28 | + ... ELSE IF False Not run |
| 29 | + ... ELSE IF True Failure |
| 30 | + ... ELSE IF False Not run |
| 31 | + ... ELSE Not run |
| 32 | + |
| 33 | +ELSE not executed |
24 | 34 | [Documentation] FAIL expected
|
25 |
| - IF 1 > 0 Fail expected ELSE Log unexpected |
| 35 | + IF 1 > 0 Executed ELSE Not run |
| 36 | + IF 1 > 0 Fail expected ELSE Not run |
26 | 37 |
|
27 |
| -Inline if else - else executed - failing |
| 38 | +ELSE executed |
28 | 39 | [Documentation] FAIL expected
|
29 |
| - IF 0 > 1 Log unexpected ELSE Fail expected |
30 |
| - |
31 |
| -Inline if inside for loop |
| 40 | + IF 0 > 1 Not run ELSE Log does go through here |
| 41 | + IF 0 > 1 Not run ELSE Fail expected |
| 42 | + |
| 43 | +Assign |
| 44 | + ${x} = IF 1 Convert to integer 1 ELSE IF 2 Convert to integer 2 ELSE Convert to integer 3 |
| 45 | + ${y} = IF 0 Convert to integer 1 ELSE IF 2 Convert to integer 2 ELSE Convert to integer 3 |
| 46 | + ${z} = IF 0 Convert to integer 1 ELSE IF 0 Convert to integer 2 ELSE Convert to integer 3 |
| 47 | + Should Be Equal ${x} ${1} |
| 48 | + Should Be Equal ${y} ${2} |
| 49 | + Should Be Equal ${z} ${3} |
| 50 | + |
| 51 | +Multi assign |
| 52 | + ${x} ${y} ${z} = IF True Create list a b c ELSE Not run |
| 53 | + Should Be Equal ${x} a |
| 54 | + Should Be Equal ${y} b |
| 55 | + Should Be Equal ${z} c |
| 56 | + |
| 57 | +List assign |
| 58 | + @{x} = IF True Create list a b c ELSE Not run |
| 59 | + Should Be True ${x} == ['a', 'b', 'c'] |
| 60 | + ${x} @{y} ${z} = IF False Not run ELSE Create list a b c |
| 61 | + Should Be Equal ${x} a |
| 62 | + Should Be True ${y} == ['b'] |
| 63 | + Should Be Equal ${z} c |
| 64 | + |
| 65 | +Dict assign |
| 66 | + &{x} = IF False Not run ELSE Create dictionary a=1 b=2 |
| 67 | + Should Be True ${x} == {'a': '1', 'b': '2'} |
| 68 | + |
| 69 | +Inside FOR |
32 | 70 | [Documentation] FAIL The end
|
33 | 71 | FOR ${i} IN 1 2 3
|
34 | 72 | IF ${i} == 3 Fail The end ELSE Log ${i}
|
35 | 73 | END
|
36 | 74 |
|
37 |
| -Inline if inside block if |
| 75 | +Inside normal IF |
38 | 76 | IF ${True}
|
39 | 77 | Log Hi
|
40 | 78 | IF 3==4 Fail Should not be executed ELSE Log Hello
|
41 | 79 | Log Goodbye
|
42 |
| - END |
43 |
| - |
44 |
| -Inline if inside nested loop |
45 |
| - [Documentation] FAIL The end |
46 |
| - IF ${False} |
47 |
| - Fail Should not go here |
48 | 80 | ELSE
|
49 |
| - FOR ${i} IN 1 2 3 |
50 |
| - IF ${i} == 3 Fail The end ELSE Log ${i} |
51 |
| - END |
| 81 | + IF True Not run ELSE Not run |
52 | 82 | END
|
53 | 83 |
|
54 |
| -Inline if passing in keyword |
55 |
| - Passing if keyword |
56 |
| - |
57 |
| -Inline if passing in else keyword |
58 |
| - Passing else keyword |
59 |
| - |
60 |
| -Inline if failing in keyword |
61 |
| - [Documentation] FAIL expected |
62 |
| - Failing if keyword |
63 |
| - |
64 |
| -Inline if failing in else keyword |
65 |
| - [Documentation] FAIL expected |
66 |
| - Failing else keyword |
| 84 | +In keyword |
| 85 | + [Documentation] FAIL Expected failure |
| 86 | + Keyword with inline IFs |
67 | 87 |
|
68 | 88 | Invalid END after inline header
|
69 | 89 | [Documentation] FAIL 'End' is a reserved keyword. It must be an upper case 'END' and follow an opening 'FOR' or 'IF' when used as a marker.
|
70 | 90 | IF True Log reached this
|
71 | 91 | Log this is a normal keyword call
|
72 | 92 | END
|
73 | 93 |
|
74 |
| - |
75 | 94 | *** Keywords ***
|
76 |
| -Passing if keyword |
77 |
| - IF ${1} Log expected ELSE IF 12 < 14 Fail should not go here ELSE Fail not here |
78 |
| - |
79 |
| -Passing else keyword |
80 |
| - IF ${False} Fail not here ELSE Log expected |
81 |
| - |
82 |
| -Failing if keyword |
83 |
| - IF ${1} Fail expected ELSE IF 12 < 14 Log should not go here ELSE Log not here |
84 |
| - |
85 |
| -Failing else keyword |
86 |
| - IF ${False} Log should not here ELSE Fail expected |
| 95 | +Keyword with inline IFs |
| 96 | + ${x} = IF True Convert to integer 42 |
| 97 | + IF ${x} == 0 Not run ELSE IF $x == 42 Executed ELSE Not run |
| 98 | + IF False Not run |
| 99 | + ... ELSE IF False Not run |
| 100 | + ... ELSE IF False Not run |
| 101 | + ... ELSE IF True Failure |
| 102 | + ... ELSE IF False Not run |
| 103 | + ... ELSE IF False Not run |
| 104 | + ... ELSE Not run |
| 105 | + |
| 106 | +Executed |
| 107 | + No operation |
| 108 | + |
| 109 | +Failure |
| 110 | + Fail Expected failure |
0 commit comments