Settings
A setting in robot.toml is a command line option of Robot Framework, written with its long name in words separated by hyphens: --outputdir is output-dir, --pythonpath is python-path, --loglevel is log-level. Many options that can be given several times take a plural name, such as includes for --include and variable-files for --variablefile; the table below and the reference give the exact names.
Values
Section titled “Values”The value of a setting takes the form that fits the option.
Text, for an option with one value:
output-dir = "results"log-level = "DEBUG"console = "dotted"Numbers, for the few options that count something:
console-width = 120max-error-lines = 20Lists, for an option that can be given several times:
python-path = ["libraries", "resources"]includes = ["smoke", "api"]variable-files = ["config/common.py", "config/staging.yaml"]Tables, for an option whose values have a name and a value, such as variables and metadata:
[variables]BROWSER = "chromium"RETRIES = "3"
[metadata]Version = "1.2"Team = "Shop"The values of variables and metadata are text, numbers too: RETRIES = "3" sets ${RETRIES} as --variable RETRIES:3 does, and Robot Framework converts it where a number is needed. Listeners, pre-run modifiers and parsers take a table, too, with the name or path as key and a list of arguments as value:
[listeners]"listeners/Timing.py" = ["slow=5"]AnotherListener = []Switches, for an option without a value, take true or false:
dry-run = trueexit-on-failure = truefalse passes the opposite option to Robot Framework, dry-run = false for example --nodryrun. So a profile can switch off what the settings outside of it switch on.
From the command line to robot.toml
Section titled “From the command line to robot.toml”| On the command line | In robot.toml |
|---|---|
--outputdir results |
output-dir = "results" |
--loglevel DEBUG |
log-level = "DEBUG" |
--pythonpath libs --pythonpath resources |
python-path = ["libs", "resources"] |
--include smoke --include api |
includes = ["smoke", "api"] |
--exclude wip |
excludes = ["wip"] |
--test "Login*" |
tests = ["Login*"] |
--suite Orders |
suites = ["Orders"] |
--variable BROWSER:chromium |
BROWSER = "chromium" in the table [variables] |
--variablefile vars.py:staging |
variable-files = ["vars.py:staging"] |
--metadata Version:1.2 |
Version = "1.2" in the table [metadata] |
--listener Timing.py:slow=5 |
"Timing.py" = ["slow=5"] in the table [listeners] |
--language de |
languages = ["de"] |
--dryrun |
dry-run = true |
--exitonfailure |
exit-on-failure = true |
| The paths of the tests | paths = ["tests"] |
To find a setting:
robotcode config info listlists all settings, androbotcode config info desc <setting>describes one, for examplerobotcode config info desc output-dir.- In VS Code, completion in
robot.tomloffers the settings and their values; see In the editors. - The
robot.tomlreference lists every setting with its type and examples.
Settings that only RobotCode has
Section titled “Settings that only RobotCode has”| Setting | What it does |
|---|---|
paths |
The files and folders with the tests, which Robot Framework takes as arguments. Paths on the command line replace them. |
env |
Environment variables that are set before Robot Framework starts. |
args |
Further arguments that are passed to Robot Framework as they are. |
wrapper |
A command that the run goes through, see Running Tests Through a Wrapper. |
profiles, extend-profiles, default-profiles |
Profiles, see Profiles. |
[rebot], [libdoc], [testdoc], and [extend-rebot], [extend-libdoc], [extend-testdoc] |
The options of other commands, and changes to them, see below. |
[tool.robotcode-analyze] |
The settings of RobotCode's analysis, see below. |
Paths, variables and environment variables
Section titled “Paths, variables and environment variables”paths = ["tests"]python-path = ["libraries", "resources"]variable-files = ["config/staging.py"]
[variables]BROWSER = "chromium"
[env]SHOP_USER = "tester"pathslists the files and folders with the tests. A run without paths on the command line runs them.python-pathadds folders in which Robot Framework looks for libraries, and for resource and variable files that it does not find next to the file that imports them.variablesandvariable-filesset variables, as--variableand--variablefiledo.envsets environment variables before Robot Framework starts, here for%{SHOP_USER}in the tests. The language server sets them when it starts, too, so that the editor knows them.
Relative paths count from the project root, wherever you start a command.
Passwords and other secrets do not belong in a committed robot.toml. Keep them in your .robot.toml, or let the CI server set them as environment variables and read them in the tests with %{NAME}.
Expressions
Section titled “Expressions”A setting whose type in the reference includes StringExpression also takes a table with expr, which computes the value with a Python expression when RobotCode uses the configuration:
# A results folder for each dayoutput-dir = { expr = "f'results/{date.today():%Y-%m-%d}'" }
[variables]# The browser from the environment variable BROWSER, Chromium without itBROWSER = { expr = "environ.get('BROWSER', 'chromium')" }Besides basic built-in functions of Python such as str, int and len, an expression can use these names:
| Name | What it is |
|---|---|
environ |
The environment variables, as os.environ |
platform |
Python's module platform, for example platform.system() |
re |
Python's module re for regular expressions |
datetime, date, time, timedelta, timezone |
The classes of Python's module datetime |
Path |
pathlib.Path |
The conditions in enabled and hidden of a profile use the same kind of expression, in a table with if; see Enabling profiles. robotcode profiles show -n shows the expressions without computing them.
Settings of other commands
Section titled “Settings of other commands”-
[rebot],[libdoc]and[testdoc]hold the options ofrobotcode rebot,robotcode libdocandrobotcode testdoc. A setting in the table wins over the same setting outside of it, and anextend-setting in the table adds to it. Of the settings outside of the tables, each command takes only some:rebottakes the ones that Robot Framework itself passes fromrobottorebotafter a run, such asoutput-dir,python-path,log-titleandreport-title. It does not takeincludes,excludes,tests,suites,parse-include,name,doc,metadata,set-tag,output,log-level,timestamp-outputs,consoleandquiet; put them into[rebot]whenrebotneeds them. As in Robot Framework,run-empty-suitebecomesprocess-empty-suiteforrebot.libdoctakes onlypython-path. Outside of the table,nameandquietare options ofrobot.testdoctakes the settings it shares withrobot:name,doc,metadata,set-tag,tests,suites,includesandexcludes.
robot.toml output-dir = "results"[rebot]merge = trueoutput-dir = "merged"report-title = "Nightly run"Here the runs write their results to
results, androbotcode rebotwrites the merged results tomerged.A
[rebot]in a profile or in a later file, such as.robot.toml, replaces the whole[rebot]before it.[extend-rebot]changes it instead: a setting in it replaces the one of[rebot], and anextend-setting adds to it.[extend-libdoc]and[extend-testdoc]do the same for their tables:.robot.toml [extend-rebot]report-title = "My nightly run"With the
robot.tomlabove,robotcode rebotstill merges the results intomerged, with your own report title. -
[tool.robotcode-analyze]configures the analysis in the editors and inrobotcode analyze code, for example the severity of diagnostics and the cache; see Analyzing Code and Configuration viarobot.toml.
Moving over from argument files
Section titled “Moving over from argument files”A project that runs its tests with an argument file and a script per environment:
--outputdir results--pythonpath libraries--pythonpath resources--variable BROWSER:chromium--variable BASE_URL:http://localhost:8080--exclude wiptestsrobot --argumentfile arguments.txt --variable BASE_URL:https://staging.shop.example "$@"The same as robot.toml, with the script as a profile:
paths = ["tests"]output-dir = "results"python-path = ["libraries", "resources"]excludes = ["wip"]
[variables]BROWSER = "chromium"BASE_URL = "http://localhost:8080"
[profiles.staging.extend-variables]BASE_URL = "https://staging.shop.example"robotcode run replaces robot --argumentfile arguments.txt, and robotcode -p staging run replaces the script. Until all options have moved, args can pass the argument file on:
args = ["--argumentfile", "arguments.txt"]Released under the Apache-2.0. Copyright © 2022-present Daniel Biehl