Skip to content

Commit 0fc120a

Browse files
committed
Model: Better type constant names and values.
For example: - 'kw' -> 'KEYWORD' - 'foritem' -> 'FOR ITERATION' - 'elseif' -> 'ELSE IF' This is part of model refactoring (robotframework#3749). These enhanced type values are now also used with listeners. That fixes robotframework#3851. They are also used in output.xml. That needs to be documented in the schema (robotframework#3726).
1 parent bdca4df commit 0fc120a

45 files changed

Lines changed: 215 additions & 237 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎atest/resources/atest_resource.robot‎

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,13 @@ Check Test Tags
114114
[Return] ${tc}
115115

116116
Check Keyword Data
117-
[Arguments] ${kw} ${name} ${assign}= ${args}= ${status}=PASS ${tags}= ${type}=kw
118-
Should be equal ${kw.name} ${name}
119-
Should be equal ${kw.status} ${status}
120-
Should be equal ${kw.type} ${type}
121-
${kwassign}= Catenate SEPARATOR=,${SPACE} @{kw.assign}
122-
Should be equal ${kwassign} ${assign}
123-
${kwargs}= Catenate SEPARATOR=,${SPACE} @{kw.args}
124-
Should match ${kwargs} ${args}
125-
${kwtags}= Catenate SEPARATOR=,${SPACE} @{kw.tags}
126-
Should be equal ${kwtags} ${tags}
117+
[Arguments] ${kw} ${name} ${assign}= ${args}= ${status}=PASS ${tags}= ${type}=KEYWORD
118+
Should Be Equal ${kw.name} ${name}
119+
Should Be Equal ${{', '.join($kw.assign)}} ${assign}
120+
Should Be Equal ${{', '.join($kw.args)}} ${args}
121+
Should Be Equal ${kw.status} ${status}
122+
Should Be Equal ${{', '.join($kw.tags)}} ${tags}
123+
Should Be Equal ${kw.type} ${type}
127124

128125
Test And All Keywords Should Have Passed
129126
[Arguments] ${name}=${TESTNAME}

‎atest/robot/cli/dryrun/dryrun.robot‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ Setup/teardown with non-existing variable is ignored
6060

6161
Setup/teardown with existing variable is resolved and executed
6262
${tc} = Check Test Case ${TESTNAME}
63-
Check Keyword Data ${tc.setup} BuiltIn.No Operation status=NOT RUN type=setup
64-
Check Keyword Data ${tc.teardown} Teardown args=\${nonex arg} type=teardown
63+
Check Keyword Data ${tc.setup} BuiltIn.No Operation status=NOT RUN type=SETUP
64+
Check Keyword Data ${tc.teardown} Teardown args=\${nonex arg} type=TEARDOWN
6565
Check Keyword Data ${tc.teardown.body[0]} BuiltIn.Log args=\${arg} status=NOT RUN
6666

6767
User keyword return value
@@ -73,20 +73,20 @@ Non-existing variable in user keyword return value
7373
Test Setup and Teardown
7474
${tc}= Check Test Case ${TESTNAME}
7575
Length Should Be ${tc.kws} 2
76-
Check Keyword Data ${tc.setup} BuiltIn.Log args=Hello Setup status=NOT RUN type=setup
77-
Check Keyword Data ${tc.teardown} Does not exist status=FAIL type=teardown
76+
Check Keyword Data ${tc.setup} BuiltIn.Log args=Hello Setup status=NOT RUN type=SETUP
77+
Check Keyword Data ${tc.teardown} Does not exist status=FAIL type=TEARDOWN
7878

7979
Keyword Teardown
8080
${tc}= Check Test Case ${TESTNAME}
8181
Length Should Be ${tc.kws} 2
82-
Check Keyword Data ${tc.kws[0].teardown} Does not exist status=FAIL type=teardown
82+
Check Keyword Data ${tc.kws[0].teardown} Does not exist status=FAIL type=TEARDOWN
8383

8484
Keyword teardown with non-existing variable is ignored
8585
Check Test Case ${TESTNAME}
8686

8787
Keyword teardown with existing variable is resolved and executed
8888
${tc}= Check Test Case ${TESTNAME}
89-
Check Keyword Data ${tc.kws[0].teardown} Teardown args=\${I DO NOT EXIST} type=teardown
89+
Check Keyword Data ${tc.kws[0].teardown} Teardown args=\${I DO NOT EXIST} type=TEARDOWN
9090
Check Keyword Data ${tc.kws[0].teardown.kws[0]} BuiltIn.Log args=\${arg} status=NOT RUN
9191

9292
Non-existing keyword name

‎atest/robot/cli/dryrun/if.robot‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ Dryrun fail empty if in non executed branch
4444
Check Branch Statuses
4545
[Arguments] ${kw} ${name} ${status}
4646
Should Be Equal ${kw.name} ${name}
47-
Should Be Equal ${kw.body[0].body[0].type} if
47+
Should Be Equal ${kw.body[0].body[0].type} IF
4848
Should Be Equal ${kw.body[0].body[0].status} ${status}
49-
Should Be Equal ${kw.body[0].body[1].type} elseif
49+
Should Be Equal ${kw.body[0].body[1].type} ELSE IF
5050
Should Be Equal ${kw.body[0].body[1].status} ${status}
51-
Should Be Equal ${kw.body[0].body[2].type} else
51+
Should Be Equal ${kw.body[0].body[2].type} ELSE
5252
Should Be Equal ${kw.body[0].body[2].status} ${status}

‎atest/robot/cli/runner/debugfile.robot‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ Debugfile
1313
Debug file should contain ${content} + START SUITE: Normal
1414
Debug file should contain ${content} +- START TEST: First One
1515
Debug file should contain ${content}
16-
... ${TIMESTAMP} - INFO - +-- START KW: BuiltIn.Log ? Test 1 ?
16+
... ${TIMESTAMP} - INFO - +-- START KEYWORD: BuiltIn.Log ? Test 1 ?
1717
... ${TIMESTAMP} - INFO - Test 1
18-
... ${TIMESTAMP} - INFO - +-- END KW: BuiltIn.Log
18+
... ${TIMESTAMP} - INFO - +-- END KEYWORD: BuiltIn.Log
1919
Debug file should contain ${content}
20-
... ${TIMESTAMP} - INFO - +-- START KW: BuiltIn.Log ? Logging with debug level | DEBUG ?
20+
... ${TIMESTAMP} - INFO - +-- START KEYWORD: BuiltIn.Log ? Logging with debug level | DEBUG ?
2121
... ${TIMESTAMP} - DEBUG - Logging with debug level
22-
... ${TIMESTAMP} - INFO - +-- END KW: BuiltIn.Log
22+
... ${TIMESTAMP} - INFO - +-- END KEYWORD: BuiltIn.Log
2323
Debug file should contain ${content} + END SUITE: Normal
2424
Syslog Should Contain DebugFile: DeBug.TXT
2525
${path} = Set Variable [:.\\w /\\\\~+-]*DeBug\\.TXT
@@ -31,13 +31,13 @@ Debugfile Log Level Should Always Be Debug
3131
Run Tests Without Processing Output --outputdir ${CLI OUTDIR} -b debug.txt -o o.xml --loglevel WARN ${TESTFILE}
3232
${content}= Get File ${CLI OUTDIR}/debug.txt
3333
Debug file should contain ${content}
34-
... ${TIMESTAMP} - INFO - +-- START KW: BuiltIn.Log ? Test 1 ?
34+
... ${TIMESTAMP} - INFO - +-- START KEYWORD: BuiltIn.Log ? Test 1 ?
3535
... ${TIMESTAMP} - INFO - Test 1
36-
... ${TIMESTAMP} - INFO - +-- END KW: BuiltIn.Log
36+
... ${TIMESTAMP} - INFO - +-- END KEYWORD: BuiltIn.Log
3737
Debug file should contain ${content}
38-
... ${TIMESTAMP} - INFO - +-- START KW: BuiltIn.Log ? Logging with debug level | DEBUG ?
38+
... ${TIMESTAMP} - INFO - +-- START KEYWORD: BuiltIn.Log ? Logging with debug level | DEBUG ?
3939
... ${TIMESTAMP} - DEBUG - Logging with debug level
40-
... ${TIMESTAMP} - INFO - +-- END KW: BuiltIn.Log
40+
... ${TIMESTAMP} - INFO - +-- END KEYWORD: BuiltIn.Log
4141

4242
Debugfile timestamps are accurate
4343
Run Tests --outputdir ${CLI OUTDIR} -b debug.txt -t LibraryAddsTimestampAsInteger

‎atest/robot/output/flatten_keyword.robot‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Flattened in log after execution
5858
Flatten for loops
5959
Run Rebot --flatten For ${OUTFILE COPY}
6060
${tc} = Check Test Case For loop
61-
Should Be Equal ${tc.kws[0].type} for
61+
Should Be Equal ${tc.kws[0].type} FOR
6262
Should Be Equal ${tc.kws[0].doc} ${FLAT TEXT}
6363
Length Should Be ${tc.kws[0].kws} 0
6464
Length Should Be ${tc.kws[0].msgs} 60
@@ -71,15 +71,15 @@ Flatten for loops
7171
Check Log Message ${tc.kws[0].msgs[${index * 6 + 5}]} 1
7272
END
7373

74-
Flatten for loop items
74+
Flatten for loop iterations
7575
Run Rebot --flatten ForItem ${OUTFILE COPY}
7676
${tc} = Check Test Case For loop
77-
Should Be Equal ${tc.kws[0].type} for
77+
Should Be Equal ${tc.kws[0].type} FOR
7878
Should Be Empty ${tc.kws[0].doc}
7979
Length Should Be ${tc.kws[0].kws} 10
8080
Should Be Empty ${tc.kws[0].msgs}
8181
FOR ${index} IN RANGE 10
82-
Should Be Equal ${tc.kws[0].kws[${index}].type} foritem
82+
Should Be Equal ${tc.kws[0].kws[${index}].type} FOR ITERATION
8383
Should Be Equal ${tc.kws[0].kws[${index}].doc} ${FLAT TEXT}
8484
Should Be Empty ${tc.kws[0].kws[${index}].kws}
8585
Length Should Be ${tc.kws[0].kws[${index}].msgs} 6

‎atest/robot/output/listener_interface/listener_methods.robot‎

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ FOR and IF line numbers
7676
${output} = Get Listener File ${ALL FILE}
7777
FOR ${expected} IN
7878
... FOR START: \${pet} IN [ cat | dog | horse ] (line 3)
79-
... FOR ITEM START: \${pet} = cat (line 3)
80-
... KW START: BuiltIn.Log ['\${pet}'] (line 4)
81-
... FOR ITEM START: \${pet} = dog (line 3)
82-
... KW START: BuiltIn.Log ['\${pet}'] (line 4)
79+
... FOR ITERATION START: \${pet} = cat (line 3)
80+
... KEYWORD START: BuiltIn.Log ['\${pet}'] (line 4)
81+
... FOR ITERATION START: \${pet} = dog (line 3)
82+
... KEYWORD START: BuiltIn.Log ['\${pet}'] (line 4)
8383
... IF START: 'IF' == 'WRONG' (line 3)
8484
... IF END: NOT RUN
8585
... ELSE IF START: 'ELSE IF' == 'ELSE IF' (line 5)
86-
... KW START: BuiltIn.Log ['else if branch'] (line 6)
86+
... KEYWORD START: BuiltIn.Log ['else if branch'] (line 6)
8787
... ELSE IF END: PASS
8888
... ELSE START: (line 7)
8989
... ELSE END: NOT RUN
@@ -154,41 +154,41 @@ Check Listen All File
154154
@{expected}= Create List Got settings on level: INFO
155155
... SUITE START: Pass And Fail (s1) 'Some tests here' [ListenerMeta: Hello]
156156
... SETUP START: My Keyword ['Suite Setup'] (line 3)
157-
... KW START: BuiltIn.Log ['Hello says "\${who}"!', '\${LEVEL1}'] (line 27)
157+
... KEYWORD START: BuiltIn.Log ['Hello says "\${who}"!', '\${LEVEL1}'] (line 27)
158158
... LOG MESSAGE: [INFO] Hello says "Suite Setup"!
159-
... KW END: PASS
160-
... KW START: BuiltIn.Log ['Debug message', '\${LEVEL2}'] (line 28)
161-
... KW END: PASS
162-
... KW START: \${assign} = String.Convert To Upper Case ['Just testing...'] (line 29)
159+
... KEYWORD END: PASS
160+
... KEYWORD START: BuiltIn.Log ['Debug message', '\${LEVEL2}'] (line 28)
161+
... KEYWORD END: PASS
162+
... KEYWORD START: \${assign} = String.Convert To Upper Case ['Just testing...'] (line 29)
163163
... LOG MESSAGE: [INFO] \${assign} = JUST TESTING...
164-
... KW END: PASS
164+
... KEYWORD END: PASS
165165
... SETUP END: PASS
166166
... TEST START: Pass (s1-t1, line 12) '' ['force', 'pass']
167-
... KW START: My Keyword ['Pass'] (line 15)
168-
... KW START: BuiltIn.Log ['Hello says "\${who}"!', '\${LEVEL1}'] (line 27)
167+
... KEYWORD START: My Keyword ['Pass'] (line 15)
168+
... KEYWORD START: BuiltIn.Log ['Hello says "\${who}"!', '\${LEVEL1}'] (line 27)
169169
... LOG MESSAGE: [INFO] Hello says "Pass"!
170-
... KW END: PASS
171-
... KW START: BuiltIn.Log ['Debug message', '\${LEVEL2}'] (line 28)
172-
... KW END: PASS
173-
... KW START: \${assign} = String.Convert To Upper Case ['Just testing...'] (line 29)
170+
... KEYWORD END: PASS
171+
... KEYWORD START: BuiltIn.Log ['Debug message', '\${LEVEL2}'] (line 28)
172+
... KEYWORD END: PASS
173+
... KEYWORD START: \${assign} = String.Convert To Upper Case ['Just testing...'] (line 29)
174174
... LOG MESSAGE: [INFO] \${assign} = JUST TESTING...
175-
... KW END: PASS
176-
... KW END: PASS
175+
... KEYWORD END: PASS
176+
... KEYWORD END: PASS
177177
... TEST END: PASS
178178
... TEST START: Fail (s1-t2, line 17) 'FAIL Expected failure' ['fail', 'force']
179-
... KW START: My Keyword ['Fail'] (line 20)
180-
... KW START: BuiltIn.Log ['Hello says "\${who}"!', '\${LEVEL1}'] (line 27)
179+
... KEYWORD START: My Keyword ['Fail'] (line 20)
180+
... KEYWORD START: BuiltIn.Log ['Hello says "\${who}"!', '\${LEVEL1}'] (line 27)
181181
... LOG MESSAGE: [INFO] Hello says "Fail"!
182-
... KW END: PASS
183-
... KW START: BuiltIn.Log ['Debug message', '\${LEVEL2}'] (line 28)
184-
... KW END: PASS
185-
... KW START: \${assign} = String.Convert To Upper Case ['Just testing...'] (line 29)
182+
... KEYWORD END: PASS
183+
... KEYWORD START: BuiltIn.Log ['Debug message', '\${LEVEL2}'] (line 28)
184+
... KEYWORD END: PASS
185+
... KEYWORD START: \${assign} = String.Convert To Upper Case ['Just testing...'] (line 29)
186186
... LOG MESSAGE: [INFO] \${assign} = JUST TESTING...
187-
... KW END: PASS
188-
... KW END: PASS
189-
... KW START: BuiltIn.Fail ['Expected failure'] (line 21)
187+
... KEYWORD END: PASS
188+
... KEYWORD END: PASS
189+
... KEYWORD START: BuiltIn.Fail ['Expected failure'] (line 21)
190190
... LOG MESSAGE: [FAIL] Expected failure
191-
... KW END: FAIL
191+
... KEYWORD END: FAIL
192192
... TEST END: FAIL Expected failure
193193
... SUITE END: FAIL 2 tests, 1 passed, 1 failed
194194
... Output: output.xml Closing...

‎atest/robot/running/for_resource.robot‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Check test and failed loop
1414

1515
Should be FOR loop
1616
[Arguments] ${kw} ${iterations} ${status}=PASS
17-
Should Be Equal ${kw.type} for
17+
Should Be Equal ${kw.type} FOR
1818
Should Contain ${kw.name} IN
1919
Length Should Be ${kw.kws} ${iterations}
2020
Should Be Equal ${kw.status} ${status}
@@ -36,5 +36,5 @@ Should be IN ENUMERATE loop
3636

3737
Should be loop iteration
3838
[Arguments] ${kw} ${name}
39-
Should Be Equal ${kw.type} foritem
39+
Should Be Equal ${kw.type} FOR ITERATION
4040
Should Be Equal ${kw.name} ${name}

‎atest/robot/running/if/else_if.robot‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Check IF/ELSE Status
4444

4545
Check Branch Statuses
4646
[Arguments] ${branches} ${statuses}
47-
${types} = Evaluate ['if'] + ['elseif'] * (len($branches) - 2) + ['else']
47+
${types} = Evaluate ['IF'] + ['ELSE IF'] * (len($branches) - 2) + ['ELSE']
4848
Should Be Equal ${{len($branches)}} ${{len($statuses)}}
4949
Should Be Equal ${{len($branches)}} ${{len($types)}}
5050
FOR ${branch} ${type} ${status} IN ZIP ${branches} ${types} ${statuses}

‎atest/robot/running/test_template.robot‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,30 +60,30 @@ Invalid FOR
6060
Template With IF
6161
${tc} = Check Test Case ${TESTNAME}
6262
Should Be Equal ${tc.body[0].status} PASS
63-
Should Be Equal ${tc.body[0].body[0].type} if
63+
Should Be Equal ${tc.body[0].body[0].type} IF
6464
Should Be Equal ${tc.body[0].body[0].status} NOT RUN
65-
Should Be Equal ${tc.body[0].body[1].type} elseif
65+
Should Be Equal ${tc.body[0].body[1].type} ELSE IF
6666
Should Be Equal ${tc.body[0].body[1].status} NOT RUN
67-
Should Be Equal ${tc.body[0].body[2].type} else
67+
Should Be Equal ${tc.body[0].body[2].type} ELSE
6868
Should Be Equal ${tc.body[0].body[2].status} PASS
6969

7070
Template With IF Failing
7171
${tc} = Check Test Case ${TESTNAME}
7272
Should Be Equal ${tc.body[0].status} FAIL
73-
Should Be Equal ${tc.body[0].body[0].type} if
73+
Should Be Equal ${tc.body[0].body[0].type} IF
7474
Should Be Equal ${tc.body[0].body[0].status} FAIL
7575
Should Be Equal ${tc.body[1].status} FAIL
76-
Should Be Equal ${tc.body[1].body[0].type} if
76+
Should Be Equal ${tc.body[1].body[0].type} IF
7777
Should Be Equal ${tc.body[1].body[0].status} NOT RUN
78-
Should Be Equal ${tc.body[1].body[1].type} elseif
78+
Should Be Equal ${tc.body[1].body[1].type} ELSE IF
7979
Should Be Equal ${tc.body[1].body[1].status} FAIL
80-
Should Be Equal ${tc.body[1].body[2].type} else
80+
Should Be Equal ${tc.body[1].body[2].type} ELSE
8181
Should Be Equal ${tc.body[1].body[2].status} NOT RUN
8282

8383
Invalid IF
8484
${tc} = Check Test Case ${TESTNAME}
8585
Should Be Equal ${tc.body[0].status} FAIL
86-
Should Be Equal ${tc.body[0].body[0].type} if
86+
Should Be Equal ${tc.body[0].body[0].type} IF
8787
Should Be Equal ${tc.body[0].body[0].status} FAIL
8888

8989
FOR and IF

‎atest/robot/standard_libraries/builtin/run_keyword_if_test_passed_failed.robot‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,6 @@ Run Keyword If test Passed Can't Be Used In Suite Setup or Teardown
7777

7878
Variable Values Should Not Be Visible As Keyword's Arguments
7979
${tc} = Check Test Case Run Keyword If Test Failed Uses User Keyword
80-
Check Keyword Data ${tc.teardown} BuiltIn.Run Keyword If Test Failed args=Teardown UK, \${TEARDOWN MESSAGE} type=teardown
80+
Check Keyword Data ${tc.teardown} BuiltIn.Run Keyword If Test Failed args=Teardown UK, \${TEARDOWN MESSAGE} type=TEARDOWN
8181
Check Keyword Data ${tc.teardown.kws[0]} Teardown UK args=\${TEARDOWN MESSAGE}
8282
Check Keyword Data ${tc.teardown.kws[0].kws[0]} BuiltIn.Log args=\${message}

0 commit comments

Comments
 (0)