Tools

Besides executing your tests and verifying that acceptance criteria are met, SpecFlow provides a number of other tools to support the development process. These tools are accessed using the specflow.exe command line tool located in the /packages/SpecFlow.x.y.a/tools directory of your project.

A number of commands are available. If you start specflow.exe without any additional options, the available commands are listed.

help

Use the help command to display the detailed information on a specific command's syntax. For example, specflow.exe help generateall displays the options available for the generateall command.

generateall

Use the generateall command to re-generate outdated unit test classes based on your feature files. This can be useful when upgrading to a newer SpecFlow version, or if feature files are modified outside of Visual Studio.

The following arguments are available.

Attribute Notes Description

--ProjectFile

required

The path to the project file containing the feature files.

--force

optional

Forces the re-generation of the class files, even if the generated class is up-to-date based on the file modification time and the SpecFlow generator version.
Default: disabled (only outdated files are generated)

--verbose

optional

Displays detailed information about the generation process.
Default: disabled

The following command line regenerates unit tests for the BookShop sample application.

specflow.exe generateall --ProjectFile BookShop.AcceptanceTests.csproj

SpecFlow's generateall function can also be used with MSBuild, allowing you to update the files before compiling the solution. This can be particularly useful if feature files are regularly modified outside of Visual Studio. See Generate Tests from MsBuild for details on configuring MSBuild to use the generateall function.

stepdefinitionreport

Generates a report that includes information on the usage and binding status of the steps in the entire project. For more details, see Reporting.

nunitexecutionreport

Generates an execution report based on the output of the NUnit Console Runner. For more details, see Reporting.

mstestexecutionreport

Generates an execution report based on the TRX output generated by VSTest. For more details, see Reporting.