SpecFlow+ Runner Profiles
SpecFlow+ Runner profiles (
.srprofile file extension) are XML files that determine how SpecFlow+ Runner executes your tests. This includes the behaviour when tests fail (e.g. repeat the test, abort after X failed tests), defining various target environments for your tests (e.g. different web browsers or x64/x86), enabling multi-threading, configuring folder and file paths and applying transformations to your default configuration file in order to change the transform the configuration file for different target environments.
This section only affects SpecFlow+ Runner until version 3.0.284. For default values used in later SpecFlow+ Runner versions, see section Default values used by SpecFlow+ Runner after version 3.0.284
The default profile is relatively basic, and includes your project name, ID and various default settings. It also includes a commented out section that you can use to transform the database connection string in your configuration file in order to access a different database instance.
The name of the profile file used by your project is defined using the
<Profile> tag in your
.runsettings file. By default, SpecFlow+ Runner expects a file called
You either need to add this file to your project manually, or it is added manually, depending on the version of SpecFlow+ you are using:
When you are using a higher version of SpecFlow+ Runner than 3.0.284, you do not have to manually add a default.srprofile to the project. This affects all project formats and target framework versions.
Until SpecFlow+ Runner version 3.0.284, you need to manually add a profile to your project. To do so:
- Right-click your project and select Add | New Item
- Browse to Installed | Visual C# Items | SpecFlow.
- Select SpecFlow+ Runner Profile (.srprofile) from the list.
- Change the name of the new item to
- Click on Add.
Earlier versions of SpecFlow+
Prior to SpecFlow 3, a
Default.srprofile is automatically added to your Visual Studio project when you add the NuGet package to your solution.
Default values used by SpecFlow+ Runner after version 3.0.284
The following behaviors are used by default if no default.srprofile could be found:
* Search for tests in the base folder (i.e.
bin/Debug/<Framework>) when using
SpecRun.exe for test execution
Execution configuration element:
If you intend to use other values, you have to add a
.srprofile file to the project.
Adding a Profile to Your Project (.NET Core)
The following section affects only SpecFlow+ Runner versions until 3.0.284.
When working with .NET Core projects, the default profile (default.srprofile) is not automatically added to new SpecFlow+ projects. You need to add the file manually:
contentfolder of the specrun package you added to your project.
- Add the file to your project.
- Make any changes you require (see below).
SpecFlow+ Runner Profile Elements and Attributes
<TestProfile> element is a container for the remaining elements.
The following XML elements and attributes are available:
You can also use a number of Placeholders in your profile.