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.

Default Profile

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 default.srprofile.

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:

SpecFlow+ 3

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:

  1. Right-click your project and select Add | New Item
  2. Browse to Installed | Visual C# Items | SpecFlow.
  3. Select SpecFlow+ Runner Profile (.srprofile) from the list.
  4. Change the name of the new item to default.srprofile.
  5. 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 or bin/Debug/<Framework>) when using SpecRun.exe for test execution * Execution configuration element: * testThreadCount is 1 * stopAfterFailures is 3 * testSchedulingMode is Sequential

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:

  1. Locate default.srprofile in the content folder of the specrun package you added to your project.
  2. Add the file to your project.
  3. Make any changes you require (see below).

SpecFlow+ Runner Profile Elements and Attributes

The <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.