Test Metadata setting to set default metadata for tests

Author: febb0eCreated Aug 28, 2026Updated Aug 31, 2026
Labelspriority: mediumeffort: medium

Test/task level metadata was added in #4409 / #5685 but unlike other test related settings [Metadata] has no matching setting in the *** Settings *** section. As @pekkaklarck already mentioned in https://github.com/robotframework/robotframework/issues/4409#issuecomment-5327524558:

While reviewing the docs I realized that [Metadata] doesn't have a matching setting in the Settings section similarly as other settings have. We could introduce a separate Test Metadata (and Task Metadata) setting that would specify the default metadata and [Metadata] could then add new and modify values similarly as [Tags] can modify tags set with Test Tags. [...] The only design decision I see is agreeing on syntax how to remove metadata. Probably using -Name like you can use -tag with tags would be best.

This issue is about this enhancement.

Syntax proposal

robotframework
*** Settings ***
Test Metadata    Owner       QA Team
Test Metadata    Priority    Normal

*** Test Cases ***
Use Defaults
    [Documentation]    Metadata is `Owner: QA Team` and `Priority: Normal`.
    No Operation

Override Test Metadata
    [Documentation]    Metadata is `Owner: QA Team` and `Priority: Critical`.
    [Metadata]    Priority    Critical
    No Operation

Add New Test Metadata
    [Documentation]    Metadata is `Owner: QA Team`, `Priority: Normal` and `Issue: 4409`.
    [Metadata]    Issue    4409
    No Operation

Remove Test Metadata
    [Documentation]    Metadata is only `Priority: Normal`.
    [Metadata]    -Owner
    No Operation

Task Metadata is an alias for Test Metadata, mirroring the implementation of Test Tags/Task Tags, Test Setup/Task Setup and others.

Like the suite level Metadata setting, Test Metadata can be used multiple times, consists of name and value, and supports documentation formatting capabilities. It is allowed in suite files (.robot) and in suite initialization files (__init__.robot), but not in resource files(.resource).

Metadata names are compared case-insensitively and ignoring spaces and underscores, as robot.model.Metadata is a normalized dictionary. [Metadata] -owner therefor removes Owner.

Initialization files and precedence

Test Tags in an initialization file applies to all tests in all child suites, recursively, and merges them additive: with Test Tags init file tags in __init__.robot and Test Tags test file tags in tests.robot, tests get init file, tags and test file. The lower level does not replace the parent.

Test Metadata inherits the same way, in case of a name collision, the rule is to be additive across different names and have the following precedence for the same name:

[Metadata] in the test
  > Test Metadata in the suite file
    > Test Metadata in the nearest __init__.robot
      > Test Metadata in a parent __init__.robot

An initialization file is able to have both Metadata, which is metadata of that directory suite itself, and Test Metadata, which is default for tests inside that suite.

Scope

In scope:

  • New Test Metadata setting and its Task Metadata alias, in suite files and in init files.
  • Recursive inheritance through initialization files, with the precedence described above.
  • [Metadata] adding to, overriding, and removing from those defaults.
  • Parsing model support: new token type and statement class, exposed via robot.api.parsing.
  • TestDefaults support so the setting works with the parser API and with init files.
  • Documentation and acceptance/unit tests.

Out of scope:

  • Specifying metadata without the Metadata/[Metadata] setting, e.g. [Issue] 4409 (#5637).
  • Keyword level metadata (#5627).
  • A command line option for setting default test metadata, and any --settag/--removetags equivalent.
  • A Default Metadata counterpart to Default Tags, which is deprecated anyway.

Open design decisions

  1. Precedence on name collisions. Is the precedence rule described above what we want? It differs from Test Tags, which is purely additive, but a dictionary leaves no alternative.
  2. Value on a removal row. Should [Metadata] -Owner some value be an error, or should the extra value be ignored? I would make it an error, because ignoring it can hide typos.
  3. Escaping. Is \-Name the way to use a literal name starting with a hyphen, consistent with \-tag?
  4. Removing everything. Should a test be able to drop all inherited metadata, e.g. with [Metadata] NONE or [Metadata] -*? NONE as with [Setup], [Teardown] and [Timeout], but it is problematic with e.g. a metadata name that is NONE.
  5. Pattern removal. [Tags] removal goes through TagPatterns, so -tag* and -NOT a OR b work. Should [Metadata] -Priorit* work too? I would say no initially: metadata is a dictionary with a small, known set of names, and glob support can be added later without breaking anything.

I can start working on this issue immediately, so we can try to bring this into RF 7.5, when the plan above is approved.

Source: robotframework/robotframework