Generate .cs files from command prompt

1,234 views
Skip to first unread message

psn

unread,
Mar 3, 2011, 5:50:49 AM3/3/11
to SpecFlow
Hi All,

I was abe to generate Feature.cs files from command prompt using
"generateall" command.

But for this I created a project from Visual Studio IDE
added the features file from VS IDE and noticed that .feature.cs files
get created
Later I deleted the features files and .feature.cs file from the
project
Then I copied the feature files manually to the desired project folder
from command prompt
Then I used generateall from command prompt to generate the feature.cs
files.

My question is.

I create a project file from VS IDE and then close VS IDE.
Now I try to add feature files from command prompt
When I use generateall from command prompt the feature.cs file does
not get created.
Please let me know what is that I am missing

Thanks,psn

psn

unread,
Mar 4, 2011, 9:22:07 AM3/4/11
to SpecFlow
After editing the project file I was able to generate the .feature.cs
file.
Is this the only way of accomplishing the task.

If anyone has some ideas please let me know

Gáspár Nagy

unread,
Mar 5, 2011, 3:27:48 PM3/5/11
to SpecFlow
I don't understand your problem fully, but you can have a look at the
tool code and compile a small tool for yourself that generates
individual file. The generator API is public, so you should be able to
call this easily from anywhere.

Br,
Gaspar

Jonas Bandi

unread,
Mar 8, 2011, 3:07:40 AM3/8/11
to spec...@googlegroups.com
Currently the generator only generates code-behind for features that
are referenced from the project file you are pointing the generator
to.

Currently there is no way to generate code behind only for a "plain
standalone" feature file which is not included into a project.
One reason for this is, that the generation process needs some
configuration data (i.e. for language [C#,VB] and which execution
runtime [NUnit, MSTest ...] the generated code should target).
Currently this configuration is in the App.config of the containing
project.

For the workflow this is not optimal, since you cannot "just copy" a
new feature file into a directory and have it executed automatically.
Someone has to add the feature file to the project.
Although I doubt that this is such a big problem, since I argue that
adding feature files should be a "controlled process" where a
developer should be involved (at least running the features first
locally on a dev machine ...)

--
mail: jonas...@gmail.com
web: www.jonasbandi.net
blog: blog.jonasbandi.net
twitter: twitter.com/jbandi

Annie Costa

unread,
Sep 15, 2017, 6:00:55 AM9/15/17
to SpecFlow
Hi there, 

Is there no news about that?
I have a test that generate a new "Feature File" by concataining different other Feature files.
but how can I generate the .feature.cs to be able to launch its test through command line?


My project is:
- I have a list of objects that has their own configuration scenarios in their own feature files
- I have a list of scenarios that are common to all of those object but are in their own feature file.
- I have a main test that say that for an environment  want to
   - launch the configuration scenarios
   - select some "common scenarios" to execute them usig the element configuration.

So for that I have create method that will pick the element configuration feature files then add the "common scenearios" I need to create a new Feature files with a specific tag.
Then I would like to build this file to generate the .feature.cs then be able to launch it thanks to the command line with the specific tag 

SpecRun.exe run SpecRunProfile.srprofile "/baseFolder:<baseFolderPath>" "/outputfolder:<outputFolderPath>"  /log:specrun.log /filter:<mySpeficiTag>

Is this the good way?
If yes How can i do?
If not, what is the best way to do it?

Thanks
Reply all
Reply to author
Forward
0 new messages