How to store metadata of globals in TFML

Testfully 1.179.0 introduced the support for file-based workspaces using Testfully Markup Language. This article demonstrates how to persist metadata for globals in TFML.

Defining globals in TFML

To define one or more global variables in for a file-based workspace, you need to create a file called globals.toml in the root of the workspace folder, next to the workspace.toml file. Please make sure the file is named exactly globals.toml or it will not be recognized as the globals file.

The globals.toml file can contain the following fields:

FieldTypeDescription
variablesKey-Value PairsA list of global variables and their corresponding values.

variables field

The variables field is a key-value pair that defines the global variables for the workspace. Each variable must have a unique name.

Example below defines two global variables, api_key and base_url:

# globals.toml
[variables]
api_key = "your_api_key"
base_url = "https://httpbin.org"

Disabling a global variable

Say you want to temporarily disable the api_key global variable without removing it from the globals.toml file. You can prefix the variable with a - to disable it.

Example below disables the api_key global variable:

# globals.toml
[variables]
-api_key = "your_api_key"
base_url = "https://httpbin.org"

This will prevent the api_key variable from being used in requests, while still allowing it to be easily re-enabled later by removing the - prefix.