-
Notifications
You must be signed in to change notification settings - Fork 0
Configuration
The behavior of SpecFlow can be extensively configured through .NET configuration files. SpecFlow processes the configuration file of the acceptance test projects (the projects that contain the feature files). The configuration has to be placed in a file called “App.config” (the standard configuration file convention for .NET).
Unlike other runtime-only tools, SpecFlow processes the configuration file also while it generates the unit-tests from the feature files (this happens usually when you save the feature file). This means that after you have changed the configuration file, you might need to force re-generation of the unit test (if the configuration change affects the generated tests). The Visual Studio 2010 Integration can detect the change of the configuration file and offers re-generation.
In SpecFlow all configuration option has a default setting, so in an extreme case you don’t need to specify any configuration file. Commonly the most important thing to configure is the unit test provider. Therefore simple SpecFlow projects configure only this aspect. The following example shows such a simple configuration.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="specFlow"
type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow"/>
</configSections>
<specFlow>
<unitTestProvider name="MsTest" />
</specFlow>
</configuration>The following example shows all possible configuration option with their default values (the config section definition has been omitted for better readability).
<specFlow>
<language feature="en-US" tool="{not-specified}" />
<bindingCulture name="{not-specified}" />
<unitTestProvider name="NUnit" />
<generator
allowDebugGeneratedFiles="false"
allowRowTests="true" />
<runtime
detectAmbiguousMatches="true"
stopAtFirstError="false"
missingOrPendingStepsOutcome="Inconclusive" />
<trace
traceSuccessfulSteps="true"
traceTimings="false"
minTracedDuration="0:0:0.1"
listener="TechTalk.SpecFlow.Tracing.DefaultListener, TechTalk.SpecFlow" />
<stepAssemblies>
<!-- <stepAssembly assembly="{name-of-assembly-containing-bindgins}" /> -->
</stepAssemblies>
</specFlow>This section can be used to define the default language for the feature files and other language-related settings. Read more about the language settings in the Feature Language page.
| Attribute | Value | Description |
|---|---|---|
| Feature | culture name (“en-US”) | The default language of the feature files added to the project. It is recommended to use specific culture names (e.g.: “en- US”) and not generic (neutral) cultures (e.g.: “en”). Default: en-US |
| Tool | empty or culture name | Specifies the language that SpecFlow uses for messages and tracing. Uses the default feature language if empty. (Currently only English is used for messages.) Default: empty |