Skip to content

Commit c75b97b

Browse files
committed
Add if_else.robot test
else_if tests
1 parent b6f4ee6 commit c75b97b

File tree

6 files changed

+192
-0
lines changed

6 files changed

+192
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*** Settings ***
2+
Suite Setup Run Tests ${EMPTY} running/if/complex_if.robot
3+
Resource atest_resource.robot
4+
5+
*** Test Cases ***
6+
Multiple keywords in if
7+
Check Test Case ${TESTNAME}
8+
9+
Nested ifs
10+
Check Test Case ${TESTNAME}
11+

atest/robot/running/if/else_if.robot

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
*** Settings ***
2+
Suite Setup Run Tests ${EMPTY} running/if/else_if.robot
3+
Resource atest_resource.robot
4+
5+
*** Test Cases ***
6+
Else if condition 1 passes
7+
Check Test Case ${TESTNAME}
8+
9+
Else if condition 2 passes
10+
Check Test Case ${TESTNAME}
11+
12+
Else if else passes
13+
Check Test Case ${TESTNAME}
14+
15+
Else if condition 1 failing
16+
Check Test Case ${TESTNAME}
17+
18+
Else if condition 2 failing
19+
Check Test Case ${TESTNAME}
20+
21+
Else if else failing
22+
Check Test Case ${TESTNAME}

atest/robot/running/if/if_else.robot

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
*** Settings ***
2+
Suite Setup Run Tests ${EMPTY} running/if/if_else.robot
3+
Resource atest_resource.robot
4+
5+
*** Test Cases ***
6+
If passing
7+
Check Test Case ${TESTNAME}
8+
9+
If failing
10+
Check Test Case ${TESTNAME}
11+
12+
If not executed
13+
Check Test Case ${TESTNAME}
14+
15+
If not executed failing
16+
Check Test Case ${TESTNAME}
17+
18+
If else - if executed
19+
Check Test Case ${TESTNAME}
20+
21+
If else - else executed
22+
Check Test Case ${TESTNAME}
23+
24+
If else - if executed - failing
25+
Check Test Case ${TESTNAME}
26+
27+
If else - else executed - failing
28+
Check Test Case ${TESTNAME}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
*** Test Cases ***
2+
Multiple keywords in if
3+
${calculator}= Set Variable 1
4+
IF 'kuu on taivaalla'
5+
${calculator}= Evaluate 1+${calculator}
6+
${calculator}= Evaluate 1+${calculator}
7+
${calculator}= Evaluate 1+${calculator}
8+
END
9+
Should be equal ${calculator} ${4}
10+
11+
Nested ifs
12+
${calculator}= Set Variable 1
13+
IF 'kuu on taivaalla'
14+
${calculator}= Evaluate 1+${calculator}
15+
IF 'sininen on taivas'
16+
${calculator}= Evaluate 1+${calculator}
17+
END
18+
${calculator}= Evaluate 1+${calculator}
19+
END
20+
Should be equal ${calculator} ${4}
21+
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
*** Test Cases ***
2+
Else if condition 1 passes
3+
IF 123 > 23
4+
Log passing
5+
ELSE IF 7 > 3
6+
Fail should not be executed
7+
ELSE
8+
Fail should not be executed
9+
END
10+
11+
Else if condition 2 passes
12+
IF 3 > 23
13+
Fail should not be executed
14+
ELSE IF 7 > 3
15+
Log passing
16+
ELSE
17+
Fail should not be executed
18+
END
19+
20+
Else if else passes
21+
IF 1 > 23
22+
Fail should not be executed
23+
ELSE IF 0 > 3
24+
Fail should not be executed
25+
ELSE
26+
Log passing
27+
END
28+
29+
Else if condition 1 failing
30+
[Documentation] FAIL expected if fail
31+
IF 123 > 23
32+
Fail expected if fail
33+
ELSE IF 7 > 3
34+
Fail should not be executed
35+
ELSE
36+
Fail should not be executed
37+
END
38+
39+
Else if condition 2 failing
40+
[Documentation] FAIL expected else if fail
41+
IF 3 > 23
42+
Fail should not be executed
43+
ELSE IF 7 > 3
44+
Fail expected else if fail
45+
ELSE
46+
Fail should not be executed
47+
END
48+
49+
Else if else failing
50+
[Documentation] FAIL expected else fail
51+
IF 1 > 23
52+
Fail should not be executed
53+
ELSE IF 0 > 3
54+
Fail should not be executed
55+
ELSE
56+
Fail expected else fail
57+
END
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
*** Test Cases ***
2+
If passing
3+
IF True
4+
Log reached this
5+
END
6+
7+
If failing
8+
[Documentation] FAIL failing inside if
9+
IF '1' == '1'
10+
Fail failing inside if
11+
END
12+
13+
If not executed
14+
IF False
15+
Fail should not go here
16+
END
17+
18+
If not executed failing
19+
[Documentation] FAIL after not passing
20+
IF 'a' == 'b'
21+
Pass Execution should go here
22+
END
23+
Fail after not passing
24+
25+
If else - if executed
26+
IF 1 > 0
27+
Log does go through here
28+
ELSE
29+
Fail should not go here
30+
END
31+
32+
If else - else executed
33+
IF 0 > 1
34+
Fail should not go here
35+
ELSE
36+
Log does go through here
37+
END
38+
39+
If else - if executed - failing
40+
[Documentation] FAIL expected
41+
IF 1 > 0
42+
Fail expected
43+
ELSE
44+
Log unexpected
45+
END
46+
47+
If else - else executed - failing
48+
[Documentation] FAIL expected
49+
IF 0 > 1
50+
Log unexpected
51+
ELSE
52+
Fail expected
53+
END

0 commit comments

Comments
 (0)