This document will help you learn about configuring NBomber tests, especially it covers the topic of dynamic configuration via config files. NBomber separate configuration on two types:
- Test configuration: defines all kinds of settings related only for tests. It could be settings for load simulation, settings to choose target scenarios to run, duration of the test, database connection strings, etc.
- Infrastructure configuration: defines all kinds of settings related only to infrastructure. It could be settings for the logger, plugins, etc.
NBomber provides a way to configure your test via JSON or YAML configuration files. Instead of hardcoding some values you can put them in the config and then load it. Take a look first on the configuration via NBomber API (F# or C#) and then choose your favorite format (JSON or YAML).
Injecting custom settings
So far you have seen how you can configure NBomber tests via configuration files. But what if you want to extend your test by custom configuration settings. For example, you want to pass the SQL connection string for a database, and depending on the environment you want to pass different values.
For such cases, NBomber provides dedicated configuration settings called Custom Settings where are you can put any object structure like this one:
And then fetch it into your test (make sure that your custom settings located within related scenario settings):