In case of setting Metadata for top-level test suites with the --metadata command line option (as described here) I don't see any working variants of accessing Metadata items (via &{SUITE METADATA} automatic variable, as mentioned here) within the Test Suite.
Namely, when running
pybot --metadata prettyMetaName:someMetaValue ...
trying to get key prettyMetaName in the test suite setup with &{SUITE METADATA}[prettyMetaName], I get this error:
Parent suite setup failed:
Dictionary variable '&{SUITE METADATA}' has no key 'prettyMetaName'.
More detailed part of the test:
*** Keywords ***
Custom Setup
Log &{SUITE METADATA}[prettyMetaName] level=WARN
*** Settings ***
Suite Setup Custom Setup
But if I try to get metadata via python library Listener API, I'm getting the valid result.
On the other hand, in case of explicit declaring Metadata in the Settings section, everything works as expected.
I'm using Robot 3.0.4.
I think you need an __init__.robot file in the root folder of your robot project with the following content.
*** Settings ***
Suite Setup Store Top Suite Metadata
*** Keywords ***
Store Top Suite Metadata
Set Suite Variable ${TOP SUITE METADATA} ${SUITE METADATA} children=True
Then you can use the ${TOP SUITE METADATA} variable everywhere else to get access to the metadata set by command line arguments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With