From 986351665e304db25b1a77e60384624e21ea943d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pekka=20Kl=C3=A4rck?=
- TRY Branch Should Be Empty ${tc[0, 1]} EXCEPT
- TRY Branch Should Be Empty ${tc[0, 2]} EXCEPT
- TRY Branch Should Be Empty ${tc[0, 3]} ELSE
- TRY Branch Should Be Empty ${tc[0, 4]} FINALLY
+ Length Should Be ${tc.body} 1
+ Length Should Be ${tc[0].body} 5
+ TRY Branch Should Be Empty ${tc[0, 0]} TRY Ooops!
+ TRY Branch Should Be Empty ${tc[0, 1]} EXCEPT
+ TRY Branch Should Be Empty ${tc[0, 2]} EXCEPT
+ TRY Branch Should Be Empty ${tc[0, 3]} ELSE
+ TRY Branch Should Be Empty ${tc[0, 4]} FINALLY
WHILE and VAR in All mode
${tc} = Check Test Case WHILE loop executed multiple times
- Length Should Be ${tc.body} 2
- Should Be Equal ${tc.body[1].type} WHILE
- Should Be Empty ${tc.body[1].body}
- Should Be Equal ${tc.body[1].message} *HTML* ${DATA REMOVED}
+ Length Should Be ${tc.body} 2
+ Should Be Equal ${tc[1].type} WHILE
+ Should Be Empty ${tc[1].body}
+ Should Be Equal ${tc[1].message} *HTML* ${DATA REMOVED}
VAR in All mode
- ${tc} = Check Test Case IF structure
- Should Be Equal ${tc.body[0].type} VAR
- Should Be Empty ${tc.body[0].body}
- Should Be Equal ${tc.body[0].message} *HTML* ${DATA REMOVED}
- ${tc} = Check Test Case WHILE loop executed multiple times
- Should Be Equal ${tc.body[0].type} VAR
- Should Be Empty ${tc.body[0].body}
- Should Be Equal ${tc.body[0].message} *HTML* ${DATA REMOVED}
+ ${tc1} = Check Test Case IF structure
+ ${tc2} = Check Test Case WHILE loop executed multiple times
+ Should Be Equal ${tc1[0].type} VAR
+ Should Be Empty ${tc1[0].body}
+ Should Be Equal ${tc1[0].message} *HTML* ${DATA REMOVED}
+ Should Be Equal ${tc2[0].type} VAR
+ Should Be Empty ${tc2[0].body}
+ Should Be Equal ${tc2[0].message} *HTML* ${DATA REMOVED}
Passed Mode
[Setup] Run Rebot and set My Suite --removekeywords passed 0
- Keyword Should Not Be Empty ${MY SUITE.setup} My Keyword Suite Setup
${tc1} = Check Test Case Pass
${tc2} = Check Test Case Fail
- Length Should Be ${tc1.body} 3
- Keyword Should Be Empty ${tc1.body[0]} My Keyword Pass
- Keyword Should Contain Removal Message ${tc1.body[0]}
- Length Should Be ${tc2.body} 2
- Keyword Should Not Be Empty ${tc2.body[0]} My Keyword Fail
- Keyword Should Not Be Empty ${tc2.body[1]} BuiltIn.Fail Expected failure
${tc3} = Check Test Case Test with setup and teardown
- Keyword Should Be Empty ${tc3.setup} Test Setup
- Keyword Should Contain Removal Message ${tc3.setup}
- Keyword Should Be Empty ${tc3.teardown} Test Teardown
- Keyword Should Contain Removal Message ${tc3.teardown}
+ Keyword Should Not Be Empty ${MY SUITE.setup} My Keyword Suite Setup
+ Length Should Be ${tc1.body} 3
+ Keyword Should Be Empty ${tc1[0]} My Keyword Pass
+ Keyword Should Contain Removal Message ${tc1[0]}
+ Length Should Be ${tc2.body} 4
+ Check Log message ${tc2[0]} Hello 'Fail', says listener!
+ Keyword Should Not Be Empty ${tc2[1]} My Keyword Fail
+ Keyword Should Not Be Empty ${tc2[2]} BuiltIn.Fail Expected failure
+ Check Log message ${tc2[3]} Bye 'Fail', says listener!
+ Keyword Should Be Empty ${tc3.setup} Test Setup
+ Keyword Should Contain Removal Message ${tc3.setup}
+ Keyword Should Be Empty ${tc3.teardown} Test Teardown
+ Keyword Should Contain Removal Message ${tc3.teardown}
Warnings Are Not Removed In Passed Mode
[Setup] Verify previous test and set My Suite Passed Mode 1
- Keyword Should Not Be Empty ${MY SUITE.setup} Warning in suite setup
- Keyword Should Not Be Empty ${MY SUITE.teardown} Warning in suite teardown
${tc1} ${tc2}= Set Variable ${MY SUITE.tests[:2]}
- Length Should Be ${tc1.body} 1
- Keyword Should Not Be Empty ${tc1.body[0]} Warning in test case
- Keyword Should Not Be Empty ${tc1[0, 0, 0, 0]} BuiltIn.Log Warning in \${where} WARN
- Length Should Be ${tc2.body} 1
- Keyword Should Be Empty ${tc2.body[0]} No warning
+ Keyword Should Not Be Empty ${MY SUITE.setup} Warning in suite setup
+ Keyword Should Not Be Empty ${MY SUITE.teardown} Warning in suite teardown
+ Length Should Be ${tc1.body} 3
+ Check Log message ${tc1[0]} Hello 'Warning in test case', says listener!
+ Keyword Should Not Be Empty ${tc1[1]} Warning in test case
+ Check Log message ${tc1[2]} Bye 'Warning in test case', says listener!
+ Keyword Should Not Be Empty ${tc1[1, 0, 0, 0]} BuiltIn.Log Warning in \${where} WARN
+ Length Should Be ${tc2.body} 1
+ Keyword Should Be Empty ${tc2[0]} No warning
Logged Warnings Are Preserved In Execution Errors
Errors Are Not Removed In Passed Mode
[Setup] Previous test should have passed Warnings Are Not Removed In Passed Mode
${tc} = Check Test Case Error in test case
- Check Log Message ${tc[0, 0, 0]} Logged errors supported since 2.9 ERROR
+ Length Should Be ${tc.body} 3
+ Check Log message ${tc[0]} Hello 'Error in test case', says listener!
+ Check Log Message ${tc[1, 0, 0]} Logged errors supported since 2.9 ERROR
+ Check Log message ${tc[2]} Bye 'Error in test case', says listener!
Logged Errors Are Preserved In Execution Errors
Name Mode
[Setup] Run Rebot and set My Suite
... --removekeywords name:BuiltIn.Fail --RemoveK NAME:??_KEYWORD --RemoveK NaMe:*WARN*IN* --removek name:errorin* 0
- Keyword Should Be Empty ${MY SUITE.setup} My Keyword Suite Setup
- Keyword Should Contain Removal Message ${MY SUITE.setup}
${tc1} = Check Test Case Pass
${tc2} = Check Test Case Fail
- Length Should Be ${tc1.body} 3
- Keyword Should Be Empty ${tc1.body[0]} My Keyword Pass
- Keyword Should Contain Removal Message ${tc1.body[0]}
- Length Should Be ${tc2.body} 2
- Keyword Should Be Empty ${tc2.body[0]} My Keyword Fail
- Keyword Should Contain Removal Message ${tc2.body[0]}
- Keyword Should Be Empty ${tc2.body[1]} BuiltIn.Fail Expected failure
- Keyword Should Contain Removal Message ${tc2.body[0]}
+ Keyword Should Be Empty ${MY SUITE.setup} My Keyword Suite Setup
+ Keyword Should Contain Removal Message ${MY SUITE.setup}
+ Length Should Be ${tc1.body} 5
+ Keyword Should Be Empty ${tc1[1]} My Keyword Pass
+ Keyword Should Contain Removal Message ${tc1[1]}
+ Length Should Be ${tc2.body} 4
+ Keyword Should Be Empty ${tc2[1]} My Keyword Fail
+ Keyword Should Contain Removal Message ${tc2[1]}
+ Keyword Should Be Empty ${tc2[2]} BuiltIn.Fail Expected failure
Warnings Are Not Removed In Name Mode
[Setup] Verify previous test and set My Suite Name Mode 1
- Keyword Should Not Be Empty ${MY SUITE.setup} Warning in suite setup
- Keyword Should Not Be Empty ${MY SUITE.teardown} Warning in suite teardown
${tc1} ${tc2}= Set Variable ${MY SUITE.tests[:2]}
- Length Should Be ${tc1.body} 1
- Length Should Be ${tc2.body} 1
- Keyword Should Not Be Empty ${tc1.body[0]} Warning in test case
- Keyword Should Not Be Empty ${tc1[0, 0, 0, 0]} BuiltIn.Log Warning in \${where} WARN
- Keyword Should Be Empty ${tc2.body[0]} No warning
+ Keyword Should Not Be Empty ${MY SUITE.setup} Warning in suite setup
+ Keyword Should Not Be Empty ${MY SUITE.teardown} Warning in suite teardown
+ Length Should Be ${tc1.body} 3
+ Length Should Be ${tc2.body} 3
+ Keyword Should Not Be Empty ${tc1[1]} Warning in test case
+ Keyword Should Not Be Empty ${tc1[1, 0, 0, 0]} BuiltIn.Log Warning in \${where} WARN
+ Keyword Should Be Empty ${tc2[1]} No warning
Logged Warnings Are Preserved In Execution Errors
Errors Are Not Removed In Name Mode
[Setup] Previous test should have passed Warnings Are Not Removed In Name Mode
${tc} = Check Test Case Error in test case
- Check Log Message ${tc[0, 0, 0]} Logged errors supported since 2.9 ERROR
+ Check Log Message ${tc[1, 0, 0]} Logged errors supported since 2.9 ERROR
Logged Errors Are Preserved In Execution Errors
Tag Mode
[Setup] Run Rebot and set My Suite --removekeywords tag:force --RemoveK TAG:warn 0
- Keyword Should Be Empty ${MY SUITE.setup} My Keyword Suite Setup
- Keyword Should Contain Removal Message ${MY SUITE.setup}
${tc1} = Check Test Case Pass
${tc2} = Check Test Case Fail
- Length Should Be ${tc1.body} 3
- Keyword Should Be Empty ${tc1.body[0]} My Keyword Pass
- Keyword Should Contain Removal Message ${tc1.body[0]}
- Length Should Be ${tc2.body} 2
- Keyword Should Be Empty ${tc2.body[0]} My Keyword Fail
- Keyword Should Contain Removal Message ${tc2.body[0]}
- Keyword Should Not Be Empty ${tc2.body[1]} BuiltIn.Fail Expected failure
+ Keyword Should Be Empty ${MY SUITE.setup} My Keyword Suite Setup
+ Keyword Should Contain Removal Message ${MY SUITE.setup}
+ Length Should Be ${tc1.body} 5
+ Keyword Should Be Empty ${tc1[1]} My Keyword Pass
+ Keyword Should Contain Removal Message ${tc1[1]}
+ Length Should Be ${tc2.body} 4
+ Keyword Should Be Empty ${tc2[1]} My Keyword Fail
+ Keyword Should Contain Removal Message ${tc2[1]}
+ Keyword Should Not Be Empty ${tc2[2]} BuiltIn.Fail Expected failure
Warnings Are Not Removed In Tag Mode
[Setup] Verify previous test and set My Suite Tag Mode 1
- Keyword Should Not Be Empty ${MY SUITE.setup} Warning in suite setup
- Keyword Should Not Be Empty ${MY SUITE.teardown} Warning in suite teardown
${tc1} ${tc2}= Set Variable ${MY SUITE.tests[:2]}
- Length Should Be ${tc1.body} 1
- Length Should Be ${tc2.body} 1
- Keyword Should Not Be Empty ${tc1.body[0]} Warning in test case
- Keyword Should Not Be Empty ${tc1[0, 0, 0, 0]} BuiltIn.Log Warning in \${where} WARN
- Keyword Should Be Empty ${tc2.body[0]} No warning
+ Keyword Should Not Be Empty ${MY SUITE.setup} Warning in suite setup
+ Keyword Should Not Be Empty ${MY SUITE.teardown} Warning in suite teardown
+ Length Should Be ${tc1.body} 3
+ Keyword Should Not Be Empty ${tc1[1]} Warning in test case
+ Keyword Should Not Be Empty ${tc1[1, 0, 0, 0]} BuiltIn.Log Warning in \${where} WARN
+ Length Should Be ${tc2.body} 3
+ Keyword Should Be Empty ${tc2[1]} No warning
Logged Warnings Are Preserved In Execution Errors
Errors Are Not Removed In Tag Mode
[Setup] Previous test should have passed Warnings Are Not Removed In Tag Mode
${tc} = Check Test Case Error in test case
- Check Log Message ${tc[0, 0, 0]} Logged errors supported since 2.9 ERROR
+ Check Log Message ${tc[1, 0, 0]} Logged errors supported since 2.9 ERROR
Logged Errors Are Preserved In Execution Errors
*** Keywords ***
Run Some Tests
- ${suites} = Catenate
+ VAR ${options}
+ ... --listener AddMessagesToTestBody
+ VAR ${suites}
... misc/pass_and_fail.robot
... misc/warnings_and_errors.robot
... misc/if_else.robot
@@ -192,7 +200,7 @@ Run Some Tests
... misc/try_except.robot
... misc/while.robot
... misc/setups_and_teardowns.robot
- Create Output With Robot ${INPUTFILE} ${EMPTY} ${suites}
+ Create Output With Robot ${INPUTFILE} ${options} ${suites}
Run Rebot And Set My Suite
[Arguments] ${rebot params} ${suite index}
diff --git a/atest/robot/cli/runner/remove_keywords.robot b/atest/robot/cli/runner/remove_keywords.robot
index 1b418edc7ac..05d1dca3f6a 100644
--- a/atest/robot/cli/runner/remove_keywords.robot
+++ b/atest/robot/cli/runner/remove_keywords.robot
@@ -3,27 +3,29 @@ Suite Setup Run Tests And Remove Keywords
Resource atest_resource.robot
*** Variables ***
-${PASS MESSAGE} -PASSED -ALL
-${FAIL MESSAGE} -ALL +PASSED
-${REMOVED FOR MESSAGE} -FOR -ALL
-${KEPT FOR MESSAGE} +FOR -ALL
-${REMOVED WHILE MESSAGE} -WHILE -ALL
-${KEPT WHILE MESSAGE} +WHILE -ALL
-${REMOVED WUKS MESSAGE} -WUKS -ALL
-${KEPT WUKS MESSAGE} +WUKS -ALL
-${REMOVED BY NAME MESSAGE} -BYNAME -ALL
-${KEPT BY NAME MESSAGE} +BYNAME -ALL
+${PASS MESSAGE} -PASSED -ALL
+${FAIL MESSAGE} -ALL +PASSED
+${REMOVED FOR MESSAGE} -FOR -ALL
+${KEPT FOR MESSAGE} +FOR -ALL
+${REMOVED WHILE MESSAGE} -WHILE -ALL
+${KEPT WHILE MESSAGE} +WHILE -ALL
+${REMOVED WUKS MESSAGE} -WUKS -ALL
+${KEPT WUKS MESSAGE} +WUKS -ALL
+${REMOVED BY NAME MESSAGE} -BYNAME -ALL
+${KEPT BY NAME MESSAGE} +BYNAME -ALL
${REMOVED BY PATTERN MESSAGE} -BYPATTERN -ALL
-${KEPT BY PATTERN MESSAGE} +BYPATTERN -ALL
+${KEPT BY PATTERN MESSAGE} +BYPATTERN -ALL
*** Test Cases ***
PASSED option when test passes
Log should not contain ${PASS MESSAGE}
Output should contain pass message
+ Messages from body are removed Passing
PASSED option when test fails
Log should contain ${FAIL MESSAGE}
Output should contain fail message
+ Messages from body are not removed Failing
FOR option
Log should not contain ${REMOVED FOR MESSAGE}
@@ -70,6 +72,7 @@ Run tests and remove keywords
... --removekeywords name:Thisshouldbe*
... --removekeywords name:Remove???
... --removekeywords tag:removeANDkitty
+ ... --listener AddMessagesToTestBody
... --log log.html
Run tests ${opts} cli/remove_keywords/all_combinations.robot
${log} = Get file ${OUTDIR}/log.html
@@ -83,13 +86,23 @@ Log should contain
[Arguments] ${msg}
Should contain ${LOG} ${msg}
+Messages from body are removed
+ [Arguments] ${name}
+ Log should not contain Hello '${name}', says listener!
+ Log should not contain Bye '${name}', says listener!
+
+Messages from body are not removed
+ [Arguments] ${name}
+ Log should contain Hello '${name}', says listener!
+ Log should contain Bye '${name}', says listener!
+
Output should contain pass message
${tc} = Check test case Passing
- Check Log Message ${tc[0, 0]} ${PASS MESSAGE}
+ Check Log Message ${tc[1, 0]} ${PASS MESSAGE}
Output should contain fail message
${tc} = Check test case Failing
- Check Log Message ${tc[0, 0]} ${FAIL MESSAGE}
+ Check Log Message ${tc[1, 0]} ${FAIL MESSAGE}
Output should contain for messages
Test should contain for messages FOR when test passes
@@ -98,10 +111,10 @@ Output should contain for messages
Test should contain for messages
[Arguments] ${name}
${tc} = Check test case ${name}
- Check log message ${tc[0, 0, 0, 0, 1, 0, 0]} ${REMOVED FOR MESSAGE} one
- Check log message ${tc[0, 0, 1, 0, 1, 0, 0]} ${REMOVED FOR MESSAGE} two
- Check log message ${tc[0, 0, 2, 0, 1, 0, 0]} ${REMOVED FOR MESSAGE} three
- Check log message ${tc[0, 0, 3, 0, 0, 0, 0]} ${KEPT FOR MESSAGE} LAST
+ Check log message ${tc[1, 0, 0, 0, 1, 0, 0]} ${REMOVED FOR MESSAGE} one
+ Check log message ${tc[1, 0, 1, 0, 1, 0, 0]} ${REMOVED FOR MESSAGE} two
+ Check log message ${tc[1, 0, 2, 0, 1, 0, 0]} ${REMOVED FOR MESSAGE} three
+ Check log message ${tc[1, 0, 3, 0, 0, 0, 0]} ${KEPT FOR MESSAGE} LAST
Output should contain while messages
Test should contain while messages WHILE when test passes
@@ -110,10 +123,10 @@ Output should contain while messages
Test should contain while messages
[Arguments] ${name}
${tc} = Check test case ${name}
- Check log message ${tc[0, 1, 0, 0, 1, 0, 0]} ${REMOVED WHILE MESSAGE} 1
- Check log message ${tc[0, 1, 1, 0, 1, 0, 0]} ${REMOVED WHILE MESSAGE} 2
- Check log message ${tc[0, 1, 2, 0, 1, 0, 0]} ${REMOVED WHILE MESSAGE} 3
- Check log message ${tc[0, 1, 3, 0, 0, 0, 0]} ${KEPT WHILE MESSAGE} 4
+ Check log message ${tc[1, 1, 0, 0, 1, 0, 0]} ${REMOVED WHILE MESSAGE} 1
+ Check log message ${tc[1, 1, 1, 0, 1, 0, 0]} ${REMOVED WHILE MESSAGE} 2
+ Check log message ${tc[1, 1, 2, 0, 1, 0, 0]} ${REMOVED WHILE MESSAGE} 3
+ Check log message ${tc[1, 1, 3, 0, 0, 0, 0]} ${KEPT WHILE MESSAGE} 4
Output should contain WUKS messages
Test should contain WUKS messages WUKS when test passes
@@ -122,9 +135,9 @@ Output should contain WUKS messages
Test should contain WUKS messages
[Arguments] ${name}
${tc} = Check test case ${name}
- Check log message ${tc[0, 0, 1, 0, 0]} ${REMOVED WUKS MESSAGE} FAIL
- Check log message ${tc[0, 8, 1, 0, 0]} ${REMOVED WUKS MESSAGE} FAIL
- Check log message ${tc[0, 9, 2, 0, 0]} ${KEPT WUKS MESSAGE} FAIL
+ Check log message ${tc[1, 0, 1, 0, 0]} ${REMOVED WUKS MESSAGE} FAIL
+ Check log message ${tc[1, 8, 1, 0, 0]} ${REMOVED WUKS MESSAGE} FAIL
+ Check log message ${tc[1, 9, 2, 0, 0]} ${KEPT WUKS MESSAGE} FAIL
Output should contain NAME messages
Test should contain NAME messages NAME when test passes
@@ -133,10 +146,10 @@ Output should contain NAME messages
Test should contain NAME messages
[Arguments] ${name}
${tc}= Check test case ${name}
- Check log message ${tc[0, 0, 0]} ${REMOVED BY NAME MESSAGE}
Check log message ${tc[1, 0, 0]} ${REMOVED BY NAME MESSAGE}
- Check log message ${tc[2, 0, 0, 0]} ${REMOVED BY NAME MESSAGE}
- Check log message ${tc[2, 1, 0]} ${KEPT BY NAME MESSAGE}
+ Check log message ${tc[2, 0, 0]} ${REMOVED BY NAME MESSAGE}
+ Check log message ${tc[3, 0, 0, 0]} ${REMOVED BY NAME MESSAGE}
+ Check log message ${tc[3, 1, 0]} ${KEPT BY NAME MESSAGE}
Output should contain NAME messages with patterns
Test should contain NAME messages with * pattern NAME with * pattern when test passes
@@ -147,20 +160,20 @@ Output should contain NAME messages with patterns
Test should contain NAME messages with * pattern
[Arguments] ${name}
${tc}= Check test case ${name}
- Check log message ${tc[0, 0, 0]} ${REMOVED BY PATTERN MESSAGE}
Check log message ${tc[1, 0, 0]} ${REMOVED BY PATTERN MESSAGE}
Check log message ${tc[2, 0, 0]} ${REMOVED BY PATTERN MESSAGE}
- Check log message ${tc[3, 0, 0, 0]} ${REMOVED BY PATTERN MESSAGE}
- Check log message ${tc[3, 1, 0]} ${KEPT BY PATTERN MESSAGE}
+ Check log message ${tc[3, 0, 0]} ${REMOVED BY PATTERN MESSAGE}
+ Check log message ${tc[4, 0, 0, 0]} ${REMOVED BY PATTERN MESSAGE}
+ Check log message ${tc[4, 1, 0]} ${KEPT BY PATTERN MESSAGE}
Test should contain NAME messages with ? pattern
[Arguments] ${name}
${tc}= Check test case ${name}
- Check log message ${tc[0, 0, 0]} ${REMOVED BY PATTERN MESSAGE}
- Check log message ${tc[1, 0, 0, 0]} ${REMOVED BY PATTERN MESSAGE}
- Check log message ${tc[1, 1, 0]} ${KEPT BY PATTERN MESSAGE}
+ Check log message ${tc[1, 0, 0]} ${REMOVED BY PATTERN MESSAGE}
+ Check log message ${tc[2, 0, 0, 0]} ${REMOVED BY PATTERN MESSAGE}
+ Check log message ${tc[2, 1, 0]} ${KEPT BY PATTERN MESSAGE}
Output should contain warning and error
${tc} = Check Test Case ${TEST NAME}
- Check Log Message ${tc[0, 0, 0, 0]} Keywords with warnings are not removed WARN
- Check Log Message ${tc[1, 0, 0]} Keywords with errors are not removed ERROR
+ Check Log Message ${tc[1, 0, 0, 0]} Keywords with warnings are not removed WARN
+ Check Log Message ${tc[2, 0, 0]} Keywords with errors are not removed ERROR
diff --git a/atest/testdata/cli/remove_keywords/all_combinations.robot b/atest/testdata/cli/remove_keywords/all_combinations.robot
index 96b34a44403..88808eaae07 100644
--- a/atest/testdata/cli/remove_keywords/all_combinations.robot
+++ b/atest/testdata/cli/remove_keywords/all_combinations.robot
@@ -1,17 +1,17 @@
*** Variables ***
-${COUNTER} ${0}
-${PASS MESSAGE} -PASSED -ALL
-${FAIL MESSAGE} -ALL +PASSED
-${REMOVED FOR MESSAGE} -FOR -ALL
-${KEPT FOR MESSAGE} +FOR -ALL
-${REMOVED WHILE MESSAGE} -WHILE -ALL
-${KEPT WHILE MESSAGE} +WHILE -ALL
-${REMOVED WUKS MESSAGE} -WUKS -ALL
-${KEPT WUKS MESSAGE} +WUKS -ALL
-${REMOVED BY NAME MESSAGE} -BYNAME -ALL
-${KEPT BY NAME MESSAGE} +BYNAME -ALL
+${COUNTER} ${0}
+${PASS MESSAGE} -PASSED -ALL
+${FAIL MESSAGE} -ALL +PASSED
+${REMOVED FOR MESSAGE} -FOR -ALL
+${KEPT FOR MESSAGE} +FOR -ALL
+${REMOVED WHILE MESSAGE} -WHILE -ALL
+${KEPT WHILE MESSAGE} +WHILE -ALL
+${REMOVED WUKS MESSAGE} -WUKS -ALL
+${KEPT WUKS MESSAGE} +WUKS -ALL
+${REMOVED BY NAME MESSAGE} -BYNAME -ALL
+${KEPT BY NAME MESSAGE} +BYNAME -ALL
${REMOVED BY PATTERN MESSAGE} -BYPATTERN -ALL
-${KEPT BY PATTERN MESSAGE} +BYPATTERN -ALL
+${KEPT BY PATTERN MESSAGE} +BYPATTERN -ALL
*** Test Cases ***
Passing
diff --git a/src/robot/result/keywordremover.py b/src/robot/result/keywordremover.py
index 7f4495cdd13..c771c565133 100644
--- a/src/robot/result/keywordremover.py
+++ b/src/robot/result/keywordremover.py
@@ -59,6 +59,9 @@ def _warning_or_error(self, item):
class AllKeywordsRemover(KeywordRemover):
+ def start_test(self, test):
+ test.body = test.body.filter(messages=False)
+
def start_body_item(self, item):
self._clear_content(item)
@@ -78,11 +81,12 @@ def start_try_branch(self, item):
class PassedKeywordRemover(KeywordRemover):
def start_suite(self, suite):
- if not suite.statistics.failed:
+ if not suite.failed:
self._remove_setup_and_teardown(suite)
def visit_test(self, test):
if not self._failed_or_warning_or_error(test):
+ test.body = test.body.filter(messages=False)
for item in test.body:
self._clear_content(item)
self._remove_setup_and_teardown(test)
@@ -158,7 +162,7 @@ def start_keyword(self, kw):
self.removal_message.set_to_if_removed(kw, before)
def _remove_keywords(self, body):
- keywords = body.filter(messages=False)
+ keywords = body.filter(keywords=True)
if keywords:
include_from_end = 2 if keywords[-1].passed else 1
for kw in keywords[:-include_from_end]:
From dfad2f6c0ea27a4cba55c6175c8f6c7d8104a079 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 28 Jan 2025 13:51:01 +0200
Subject: [PATCH 008/228] Bump actions/setup-python from 5.3.0 to 5.4.0 (#5327)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5.3.0 to 5.4.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v5.3.0...v5.4.0)
---
updated-dependencies:
- dependency-name: actions/setup-python
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] {{t "usages"}}
{{generated}}.
${HTML DOC}
HTML --format jSoN --specdocformat hTML DocFormat.py${HTML DOC}
HTML --format jSoN DocFormat.py${HTML DOC}
HTML --docfor RoBoT -f JSON -s HTML DocFormatHtml.py @@ -68,6 +70,7 @@ Format from XML spec Format from JSON RAW spec [Template] NONE + [Tags] require-jsonschema Test Format In JSON ${RAW DOC} ROBOT -F Robot -s RAW lib=DocFormat.py Copy File ${OUTJSON} ${OUTBASE}-2.json Test Format In JSON${HTML DOC}
HTML lib=${OUTBASE}-2.json @@ -80,6 +83,7 @@ Format from LIBSPEC spec Format from JSON spec [Template] NONE + [Tags] require-jsonschema Test Format In JSON${HTML DOC}
HTML -F Robot lib=DocFormat.py Copy File ${OUTJSON} ${OUTBASE}-2.json Test Format In JSON${HTML DOC}
HTML lib=${OUTBASE}-2.json diff --git a/atest/robot/libdoc/json_output.robot b/atest/robot/libdoc/json_output.robot index 22abce410f6..deec2eb1cf4 100644 --- a/atest/robot/libdoc/json_output.robot +++ b/atest/robot/libdoc/json_output.robot @@ -2,6 +2,7 @@ Resource libdoc_resource.robot Suite Setup Run Libdoc And Parse Model From JSON ${TESTDATADIR}/module.py Test Template Should Be Equal Multiline +Test Tags require-jsonschema *** Test Cases *** Name diff --git a/atest/robot/libdoc/return_type_json.robot b/atest/robot/libdoc/return_type_json.robot index 9a2851643ee..2a2de45eff5 100644 --- a/atest/robot/libdoc/return_type_json.robot +++ b/atest/robot/libdoc/return_type_json.robot @@ -2,6 +2,7 @@ Suite Setup Run Libdoc And Parse Model From JSON ${TESTDATADIR}/ReturnType.py Test Template Return type should be Resource libdoc_resource.robot +Test Tags require-jsonschema *** Test Cases *** No return diff --git a/atest/robot/output/json_output.robot b/atest/robot/output/json_output.robot index c80ccb5603d..d703bf2b8ec 100644 --- a/atest/robot/output/json_output.robot +++ b/atest/robot/output/json_output.robot @@ -15,7 +15,7 @@ JSON output contains same suite information as XML output JSON output structure [Documentation] Full JSON schema validation would be good, but it's too slow with big output files. - ... The following test validates a smaller suite. + ... The test after this one validates a smaller suite against a schema. ${data} = Evaluate json.load(open($JSON, encoding='UTF-8')) Lists Should Be Equal ${data} ${{['generator', 'generated', 'rpa', 'suite', 'statistics', 'errors']}} Should Match ${data}[generator] Robot ?.* (* on *) @@ -29,6 +29,7 @@ JSON output structure Should Be Equal ${data}[errors][0][level] ERROR JSON output matches schema + [Tags] require-jsonschema Run Tests Without Processing Output -o OUT.JSON misc/everything.robot Validate JSON Output ${OUTDIR}/OUT.JSON diff --git a/atest/robot/rebot/json_output_and_input.robot b/atest/robot/rebot/json_output_and_input.robot index 1f288e1f2db..8fc26e2124f 100644 --- a/atest/robot/rebot/json_output_and_input.robot +++ b/atest/robot/rebot/json_output_and_input.robot @@ -12,7 +12,7 @@ JSON output contains same suite information as XML output JSON output structure [Documentation] JSON schema validation would be good, but it's too slow with big output files. - ... The following test validates a smaller suite and unit tests do schema validation as well. + ... The test after this one validates a smaller suite against a schema. ${data} = Evaluate json.load(open($JSON, encoding='UTF-8')) Lists Should Be Equal ${data} ${{['generator', 'generated', 'rpa', 'suite', 'statistics', 'errors']}} Should Match ${data}[generator] Rebot ?.* (* on *) @@ -26,6 +26,7 @@ JSON output structure Should Be Equal ${data}[errors][0][level] ERROR JSON output schema validation + [Tags] require-jsonschema Run Rebot Without Processing Output --suite Everything --output %{TEMPDIR}/everything.json ${JSON} Validate JSON Output %{TEMPDIR}/everything.json diff --git a/utest/libdoc/test_libdoc.py b/utest/libdoc/test_libdoc.py index 158416807f6..f05ffffee61 100644 --- a/utest/libdoc/test_libdoc.py +++ b/utest/libdoc/test_libdoc.py @@ -4,8 +4,6 @@ import unittest from pathlib import Path -from jsonschema import Draft202012Validator - from robot.utils import PY_VERSION from robot.utils.asserts import assert_equal from robot.libdocpkg import LibraryDocumentation @@ -18,10 +16,15 @@ CURDIR = Path(__file__).resolve().parent DATADIR = (CURDIR / '../../atest/testdata/libdoc/').resolve() TEMPDIR = Path(os.getenv('TEMPDIR') or tempfile.gettempdir()) -VALIDATOR = Draft202012Validator( - json.loads((CURDIR / '../../doc/schema/libdoc.json').read_text(encoding='UTF-8')) -) +try: + from jsonschema import Draft202012Validator +except ImportError: + VALIDATOR = None +else: + VALIDATOR = Draft202012Validator( + json.loads((CURDIR / '../../doc/schema/libdoc.json').read_text(encoding='UTF-8')) + ) try: from typing_extensions import TypedDict except ImportError: @@ -42,6 +45,8 @@ def verify_keyword_short_doc(doc_format, doc_input, expected): def run_libdoc_and_validate_json(filename): + if not VALIDATOR: + raise unittest.SkipTest('jsonschema module is not available') library = DATADIR / filename json_spec = LibraryDocumentation(library).to_json() VALIDATOR.validate(instance=json.loads(json_spec)) diff --git a/utest/model/test_statistics.py b/utest/model/test_statistics.py index 99c34685753..6f17b8cf489 100644 --- a/utest/model/test_statistics.py +++ b/utest/model/test_statistics.py @@ -3,7 +3,11 @@ from datetime import timedelta from pathlib import Path -from jsonschema import Draft202012Validator +try: + from jsonschema import Draft202012Validator as JSONValidator +except ImportError: + def JSONValidator(*a, **k): + raise unittest.SkipTest('jsonschema module is not available') from robot.utils.asserts import assert_equal from robot.model.statistics import Statistics @@ -54,7 +58,7 @@ def generate_suite(): def validate_schema(statistics): with open(Path(__file__).parent / '../../doc/schema/result.json', encoding='UTF-8') as file: schema = json.load(file) - validator = Draft202012Validator(schema=schema) + validator = JSONValidator(schema=schema) data = {'generator': 'unit tests', 'generated': '2024-09-23T14:55:00.123456', 'rpa': False, diff --git a/utest/result/test_resultmodel.py b/utest/result/test_resultmodel.py index 964b3e08ccc..67bb3ffd626 100644 --- a/utest/result/test_resultmodel.py +++ b/utest/result/test_resultmodel.py @@ -10,7 +10,11 @@ from pathlib import Path from xml.etree import ElementTree as ET -from jsonschema import Draft202012Validator +try: + from jsonschema import Draft202012Validator as JSONValidator +except ImportError: + def JSONValidator(*a, **k): + raise unittest.SkipTest('jsonschema module is not available') from robot.model import Tags, BodyItem from robot.result import (Break, Continue, Error, ExecutionResult, For, If, IfBranch, @@ -616,7 +620,7 @@ class TestToFromDictAndJson(unittest.TestCase): def setUpClass(cls): with open(CURDIR / '../../doc/schema/result_suite.json', encoding='UTF-8') as file: schema = json.load(file) - cls.validator = Draft202012Validator(schema=schema) + cls.validator = JSONValidator(schema=schema) cls.maxDiff = 2000 def test_keyword(self): @@ -980,7 +984,7 @@ def setUpClass(cls): cls.path.write_text(cls.data, encoding='UTF-8') with open(CURDIR / '../../doc/schema/result.json', encoding='UTF-8') as file: schema = json.load(file) - cls.validator = Draft202012Validator(schema=schema) + cls.validator = JSONValidator(schema=schema) def test_json_string(self): self._verify(self.data) diff --git a/utest/running/test_run_model.py b/utest/running/test_run_model.py index 67f475e6bdc..c60ef9bac37 100644 --- a/utest/running/test_run_model.py +++ b/utest/running/test_run_model.py @@ -7,7 +7,11 @@ from inspect import getattr_static from pathlib import Path -from jsonschema import Draft202012Validator +try: + from jsonschema import Draft202012Validator as JSONValidator +except ImportError: + def JSONValidator(*a, **k): + raise unittest.SkipTest('jsonschema module is not available') from robot import api, model from robot.model.modelobject import ModelObject @@ -264,7 +268,7 @@ class TestToFromDictAndJson(unittest.TestCase): def setUpClass(cls): with open(CURDIR / '../../doc/schema/running_suite.json', encoding='UTF-8') as file: schema = json.load(file) - cls.validator = Draft202012Validator(schema=schema) + cls.validator = JSONValidator(schema=schema) def test_keyword(self): self._verify(Keyword(), name='') From e13ed40f0e8b02a54ff08779de584937b1c8f805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pekka=20Kl=C3=A4rck?=or
. This should not be shown!!
+ Execute Manual Step Verify the taskbar icon.\n\nPress PASS if it is ok. Invalid taskbar icon.
+ Execute Manual Step Press or
Execute Manual Step Failing
[Documentation] FAIL Predefined error message
@@ -53,7 +52,7 @@ Get Hidden Value From User
Get Value From User Cancelled
[Documentation] FAIL No value provided by user.
Get Value From User
- ... Press Cancel.\n\nAlso verify that the default value below is not hidded.
+ ... Press Cancel.\n\nAlso verify that the default value below is not hidden.
... Default value. hidden=no
Get Value From User Exited
@@ -150,11 +149,12 @@ Get Selections From User Exited
Multiple dialogs in a row
[Documentation] FAIL No value provided by user.
- Pause Execution Verify that dialog is closed immediately.\n\nAfter pressing OK or {{t "allowedValues"}}
{{else}}
- {{# if items}}
+ {{#if items}}
{{t "dictStructure"}}
{{t "dictStructure"}}
{{else}}
class="td-item"
{{/if}}
- >'${key}':
- <${type}>
+ >'{{key}}':
+ <{{type}}>
{{/each}}
}
Opening library documentation failed
-
+
@@ -346,7 +346,7 @@ {{t "allowedValues"}}
{{t "dictStructure"}}
{{t "dictStructure"}}
{{else}}
class="td-item"
{{/if}}
- >'${key}':
- <${type}>
+ >'{{key}}':
+ <{{type}}>
{{/each}}
}
{{t "usages"}}
{{generated}}.
-
+ data-v-2754030d="" fill="var(--text-color)">`,t.classList.add("modal-close-button");let r=document.createElement("div");r.classList.add("modal-close-button-container"),r.appendChild(t),t.addEventListener("click",()=>{rd()}),e.appendChild(r),r.addEventListener("click",()=>{rd()});let n=document.createElement("div");n.id="modal",n.classList.add("modal"),n.addEventListener("click",({target:e})=>{"A"===e.tagName.toUpperCase()&&rd()});let o=document.createElement("div");o.id="modal-content",o.classList.add("modal-content"),n.appendChild(o),e.appendChild(n),document.body.appendChild(e),document.addEventListener("keydown",({key:e})=>{"Escape"===e&&rd()})}()}renderTemplates(){this.renderLibdocTemplate("base",this.libdoc,"#root"),this.renderImporting(),this.renderShortcuts(),this.renderKeywords(),this.renderLibdocTemplate("data-types"),this.renderLibdocTemplate("footer")}initHashEvents(){window.addEventListener("hashchange",function(){document.getElementsByClassName("hamburger-menu")[0].checked=!1},!1),window.addEventListener("hashchange",function(){if(0==window.location.hash.indexOf("#type-")){let e="#type-modal-"+decodeURI(window.location.hash.slice(6)),t=document.querySelector(".data-types").querySelector(e);t&&rp(t)}},!1),this.scrollToHash()}initTagSearch(){let e=new URLSearchParams(window.location.search),t="";e.has("tag")&&(t=e.get("tag"),this.tagSearch(t,window.location.hash)),this.libdoc.tags.length&&(this.libdoc.selectedTag=t,this.renderLibdocTemplate("tags-shortcuts"),document.getElementById("tags-shortcuts-container").onchange=e=>{let t=e.target.selectedOptions[0].value;""!=t?this.tagSearch(t):this.clearTagSearch()})}initLanguageMenu(){this.renderTemplate("language",{languages:this.translations.getLanguageCodes()}),document.querySelectorAll("#language-container ul a").forEach(e=>{e.innerHTML===this.translations.currentLanguage()&&e.classList.toggle("selected"),e.addEventListener("click",()=>{this.translations.setLanguage(e.innerHTML)&&this.render()})}),document.querySelector("#language-container button").addEventListener("click",()=>{document.querySelector("#language-container ul").classList.toggle("hidden")})}renderImporting(){this.renderLibdocTemplate("importing"),this.registerTypeDocHandlers("#importing-container")}renderShortcuts(){this.renderLibdocTemplate("shortcuts"),document.getElementById("toggle-keyword-shortcuts").addEventListener("click",()=>this.toggleShortcuts()),document.querySelector(".clear-search").addEventListener("click",()=>this.clearSearch()),document.querySelector(".search-input").addEventListener("keydown",()=>rf(()=>this.searching(),150)),this.renderLibdocTemplate("keyword-shortcuts"),document.querySelectorAll("a.match").forEach(e=>e.addEventListener("click",this.closeMenu))}registerTypeDocHandlers(e){document.querySelectorAll(`${e} a.type`).forEach(e=>e.addEventListener("click",e=>{let t=e.target.dataset.typedoc;rp(document.querySelector(`#type-modal-${t}`))}))}renderKeywords(e=null){null==e&&(e=this.libdoc),this.renderLibdocTemplate("keywords",e),document.querySelectorAll(".kw-tags span").forEach(e=>{e.addEventListener("click",e=>{this.tagSearch(e.target.innerText)})}),this.registerTypeDocHandlers("#keywords-container"),document.getElementById("keyword-statistics-header").innerText=""+this.libdoc.keywords.length}setTheme(){document.documentElement.setAttribute("data-theme",this.getTheme())}getTheme(){return null!=this.libdoc.theme?this.libdoc.theme:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}scrollToHash(){if(window.location.hash){let e=window.location.hash.substring(1),t=document.getElementById(decodeURIComponent(e));null!=t&&t.scrollIntoView()}}tagSearch(e,t){document.getElementsByClassName("search-input")[0].value="";let r={tags:!0,tagsExact:!0},n=window.location.pathname+"?tag="+e+(t||"");this.markMatches(e,r),this.highlightMatches(e,r),history.replaceState&&history.replaceState(null,"",n),document.getElementById("keyword-shortcuts-container").scrollTop=0}clearTagSearch(){document.getElementsByClassName("search-input")[0].value="",history.replaceState&&history.replaceState(null,"",window.location.pathname),this.resetKeywords()}searching(){this.searchTime=Date.now();let e=document.getElementsByClassName("search-input")[0].value,t={name:!0,args:!0,doc:!0,tags:!0};e?requestAnimationFrame(()=>{this.markMatches(e,t,this.searchTime,()=>{this.highlightMatches(e,t,this.searchTime),document.getElementById("keyword-shortcuts-container").scrollTop=0})}):this.resetKeywords()}highlightMatches(e,t,n){if(n&&n!==this.searchTime)return;let o=document.querySelectorAll("#shortcuts-container .match"),i=document.querySelectorAll("#keywords-container .match");if(t.name&&(new(r(eb))(o).mark(e),new(r(eb))(i).mark(e)),t.args&&new(r(eb))(document.querySelectorAll("#keywords-container .match .args")).mark(e),t.doc&&new(r(eb))(document.querySelectorAll("#keywords-container .match .doc")).mark(e),t.tags){let n=document.querySelectorAll("#keywords-container .match .tags a, #tags-shortcuts-container .match .tags a");if(t.tagsExact){let t=[];n.forEach(r=>{r.textContent?.toUpperCase()==e.toUpperCase()&&t.push(r)}),new(r(eb))(t).mark(e)}else new(r(eb))(n).mark(e)}}markMatches(e,t,r,n){if(r&&r!==this.searchTime)return;let o=e.replace(/[-[\]{}()+?*.,\\^$|#]/g,"\\$&");t.tagsExact&&(o="^"+o+"$");let i=RegExp(o,"i"),a=i.test.bind(i),s={},l=0;s.keywords=this.libdoc.keywords.map(e=>{let r={...e};return r.hidden=!(t.name&&a(r.name))&&!(t.args&&a(r.args))&&!(t.doc&&a(r.doc))&&!(t.tags&&r.tags.some(a)),!r.hidden&&l++,r}),this.renderLibdocTemplate("keyword-shortcuts",s),this.renderKeywords(s),this.libdoc.tags.length&&(this.libdoc.selectedTag=t.tagsExact?e:"",this.renderLibdocTemplate("tags-shortcuts")),document.getElementById("keyword-statistics-header").innerText=l+" / "+s.keywords.length,0===l&&(document.querySelector("#keywords-container table").innerHTML=""),n&&requestAnimationFrame(n)}closeMenu(){document.getElementById("hamburger-menu-input").checked=!1}openKeywordWall(){document.getElementsByClassName("shortcuts")[0].classList.add("keyword-wall"),this.storage.set("keyword-wall","open"),document.getElementById("toggle-keyword-shortcuts").innerText="-"}closeKeywordWall(){document.getElementsByClassName("shortcuts")[0].classList.remove("keyword-wall"),this.storage.set("keyword-wall","close"),document.getElementById("toggle-keyword-shortcuts").innerText="+"}toggleShortcuts(){document.getElementsByClassName("shortcuts")[0].classList.contains("keyword-wall")?this.closeKeywordWall():this.openKeywordWall()}resetKeywords(){this.renderLibdocTemplate("keyword-shortcuts"),this.renderKeywords(),this.libdoc.tags.length&&(this.libdoc.selectedTag="",this.renderLibdocTemplate("tags-shortcuts")),history.replaceState&&history.replaceState(null,"",location.pathname)}clearSearch(){document.getElementsByClassName("search-input")[0].value="";let e=document.getElementById("tags-shortcuts-container");e&&(e.selectedIndex=0),this.resetKeywords()}renderLibdocTemplate(e,t=null,r=""){null==t&&(t=this.libdoc),this.renderTemplate(e,t,r)}renderTemplate(e,t,n=""){let o=document.getElementById(`${e}-template`)?.innerHTML,i=r(ew).compile(o);""===n&&(n=`#${e}-container`),document.body.querySelector(n).innerHTML=i(t)}};!function(e){let t=new ek("libdoc"),r=eS.getInstance(e.lang);new rg(e,t,r).render()}(libdoc);