feat: added &{TEST METADATA} variable and Set Test Metadata - #5745
Open
febb0e wants to merge 3 commits into
Open
feat: added &{TEST METADATA} variable and Set Test Metadata#5745febb0e wants to merge 3 commits into
febb0e wants to merge 3 commits into
Conversation
Merged
There was a problem hiding this comment.
Pull request overview
This PR introduces support for test/task metadata as a first-class, dynamically updatable concept during execution by adding a new built-in variable and BuiltIn keywords, and by extending acceptance tests and user guide documentation accordingly.
Changes:
- Add
${TEST METADATA}/&{TEST METADATA}automatic variable populated at test start and refreshed when metadata is modified. - Add
Set Test MetadataandSet Task Metadatakeywords to update current test/task metadata (with optional append + custom separator). - Extend user guide and acceptance tests to cover the new variable and keywords.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/robot/running/context.py | Initializes the per-test metadata variable at test start. |
| src/robot/libraries/BuiltIn.py | Adds Set Test Metadata + Set Task Metadata keywords and cross-links from suite metadata docs. |
| doc/userguide/src/CreatingTestData/Variables.rst | Documents the new automatic variable in the built-in variables table. |
| atest/testdata/variables/automatic_variables/resource.robot | Adds helper keyword and teardown coverage for the new automatic variable. |
| atest/testdata/variables/automatic_variables/auto1.robot | Adds test cases validating ${TEST METADATA} / &{TEST METADATA} behavior and isolation from real metadata when mutated. |
| atest/testdata/standard_libraries/builtin/set_test_metadata.robot | Adds new test data file for Set Test Metadata / Set Task Metadata keyword behavior. |
| atest/robot/variables/automatic_variables.robot | Verifies metadata appears in execution results and is not affected by mutating the variable. |
| atest/robot/standard_libraries/builtin/set_test_metadata.robot | Adds acceptance tests validating keyword behavior and log messages. |
| atest/robot/standard_libraries/builtin/log_variables.robot | Updates variable logging expectations to include &{TEST_METADATA} and adjusts message counts. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.
Suppressed comments (2)
doc/userguide/src/CreatingTestData/Variables.rst:1599
- The automatic variables table lists this as
&{TEST METADATA}, but the BuiltIn keyword docs (and the establishedSUITE METADATAdocs) present metadata variables in scalar form (${...}holding a dictionary). Using different forms across docs is inconsistent and may confuse readers about how the variable is accessed.
| &{TEST METADATA} | The free metadata of the current test case. Can be | Test case |
| | set using :name:`Set Test Metadata` keyword. | |
| | New in Robot Framework 7.5. | |
src/robot/libraries/BuiltIn.py:4804
set_task_metadatadelegates toset_test_metadatausing positional arguments for the optional parameters, which is easy to misread (append vs separator) and becomes brittle if the callee signature changes. Using explicit keyword arguments here improves clarity.
self.set_test_metadata(name, value, append, separator)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds the built-in variable
${TEST_METADATA}and the keywordsSet Test MetadataandSet Task Metadatato Robot Framework. These changes allow users to set and access test-specific metadata dynamically during test execution.The most important changes are:
New Features
${TEST_METADATA}variable, which exposes the current test's metadata as a dictionary and is updated at test start and when metadata changes.Set Test MetadataandSet Task Metadatakeywords inBuiltIn.pyto allow setting and appending metadata for the current test/task, with options for case/space/underscore-insensitive names and custom separators.Documentation
${TEST_METADATA}variable and its usage in the user guide, including its availability and the new keywords.