Configuration parameters / appsettings
Configuration parameters from appsettings could be overridden for scenarios without any modification in the appsettings file.
Override with the reqnroll step
Feature: Overriding service settings from command line
For some tests, it is very usefull to override a configuration parameter defined in specific appsettting file without having to use a dedicated file
or environment variable.
With appsettings.json containing:
{
"specificSection": {
"rootFolder": "folders/root"
}
}
Scenario: Override configuration parameters by passing value as command line argument
Given the command line arguments
| Field | Value |
| specificSection:rootFolder | my-root-folder |
And the service initialized
When I start the service
Then the configuration property "rootFolder" of the section "specificSection" is equal to "my-root-folder"
Scenario: No override of the configuration parameter
Given the service initialized
When I start the service
Then the configuration property "rootFolder" of the section "specificSection" is equal to "folders/root"
Override with tags
@arg:specificSection:rootFolder=my-root-folder
Feature: Using tags to setup command line arguments
Scenario: Tag set on feature
Given the service initialized
When I start the service
Then the configuration property "rootFolder" of the section "specificSection" is equal to "my-root-folder"
@arg:specificSection:rootFolder=my-local-folder @arg:custom:data=123=kt
Scenario: Tag set on scenario
Given the service initialized
When I start the service
Then the configuration property "rootFolder" of the section "specificSection" is equal to "my-local-folder"
And the configuration property "data" of the section "custom" is equal to "123=kt"