Configuration file support
Robot Framework should get support for configuration files. Configuration files should be loaded automatically (unless disabled) and allow specifying same settings that can be given from the command line. This would make it possible to, for example, to automatically enable the RPA mode, specify listeners that should always be used, and so on. This would be especially useful with features that require more complex configuration such as custom settings (#4409).
The main reason Robot currently doesn't support configuration files is that it has its own argument file concept that has many of the same benefits. Argument files aren't loaded automatically, though, and them being a Robot-only solution means that you cannot have all project configuration in one place.
Although the basic idea is clear, there are lot of design decisions to be made:
- What format? Python has pretty much standardized to TOML as configuration syntax and I rather strongly believe we should use that too. tomllib is only available starting from Python 3.11, but we can require people using older Python versions to install a backport if they want to use config files.
- Should we support the standard
pyproject.tomlor a customrobot.toml? I believe we should support both. Actual settings should also be exactly the same regardless the file, but the top level table structure is naturally different. - Where should we look for configuration files? My understanding is that
pyproject.tomlshould be only looked from the current directory, but with ourrobot.tomlit would probably make sense to support system wide, user wide, project wide, and custom configuration so that the latter ones have precedence over earlier ones. System wide and user wide configs would be loaded from an OS specific configuration file locations, project wide configuration from the current directory, and custom configs could be given using a command like option like--config path/to/custom.toml. There should also be a way to disable loading configuration files automatically. - How should each command line option be supported in a configuration file? It's probably best to return to this when implementation starts. This is an important topic, because making changes later causes backwards compatibility problems.
Source: robotframework/robotframework