Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SpecFlow custom tool "SpecFlowSingleFileGenerator"

Tags:

specflow

I found that this custom tool is used for generation of .cs files from SpecFlow's .feature file. Is there a way to use this tool outside of VS? I would like to call this tool from console for specific .feature file when building my project with NAnt.

Regards,

Vajda Vladimir

like image 942
Vajda Avatar asked Dec 28 '22 01:12

Vajda


1 Answers

You sure can! That is if you mean: "Can I generate unit test code from my .feature-files without using Visual Studio"

I've written about that here: http://www.marcusoft.net/2010/12/specflowexe-and-mstest.html but in short you can use the SpecFlow.exe with the "generateAll" switch, and it will inspect your project settings and generate the appropiate unit tests for you (in my example it's MsTest but it can be any of the supported testing frameworks).

The SpecFlow.exe's help we get the following concise help:

Generate tests from all feature files in a project
usage: specflow generateall projectFile [/force] [/verbose]
    projectFile  Visual Studio Project File containing features

So for a project called Specs.csproj it would be:

"%ProgramFiles(x86)%\TechTalk\SpecFlow\SpecFlow.exe" generateAll Specs\Specs.csproj /force /verbose

You can read more in my blog post - but this is basically it.

like image 99
Marcus Hammarberg Avatar answered May 08 '23 07:05

Marcus Hammarberg