Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I write comments in a SpecFlow Feature?

Tags:

specflow

I'd like to include some comments in a SpecFlow feature.

I get the the following error:

Custom tool error: Parsing error near '/*' 

I've tried the following:

// comment /* comment */ -- comment ' comment 

How do I do this?

like image 906
Kofi Sarfo Avatar asked Jan 27 '12 11:01

Kofi Sarfo


People also ask

How do you comment multiple lines in a SpecFlow feature file?

If you use the SpecFlow Visual Studio extension (v1. 9.2) you can simply select the lines and toggle them into comments and back. The default shortcuts are Ctrl+K,C to comment and Ctrl+K,U to uncomment.

How do you comment on a feature?

Feature file only supports comments with a # sign. We put # at the beginning of our Comment. You want to do a single line or multiple line comments; you need to put # before all lines.

How do you comment a scenario in a feature file?

To put comments, we just need to start the statement with “#” sign. Feature file only support comments with # sign. You need to put # at beginning of your comment. You want to do single line or multiple comment you need to put # before all lines.

How do I add comments in cucumber feature file?

Cucumber feature files can have comments at any place. To put comments, we just need to start the statement with “#” sign. Different programming languages have got different norms for defining the comments.

How to create a feature file in SpecFlow?

Once the folder for feature file is created, we are good to go to create a feature file. On the Feature folder Right-click and navigate to Add -> New Item... Select SpecFlow Feature File in the middle and give it a logical name, for the sake of this tutorial, please use the same name ' LogIn_Feature ' referred in the below screenshot.

What output file names should I use for SpecFlow tests?

If you use the default output file names shown above, you only need to specify information about the C# test project containing the *.feature files. Specflow uses the default TestResult.xml and TestResult.txt files to produce TestResult.html.

How do I use the Edit menu in SpecFlow?

Most of the items in the Edit menu work well with SpecFlow feature files, for example: You can comment and uncomment selected lines (‘#’ character) with the default shortcut for comments (Ctrl+K Ctrl+C/Ctrl+K Ctrl+U) or from the menu

How do I generate a SpecFlow report in NUnit?

The report generation step is the same for both versions of NUnit. The two generated files can be used to invoke the SpecFlow report generation. If you use the default output file names shown above, you only need to specify information about the C# test project containing the *.feature files.


2 Answers

As stated by sarfest above - its simply #-sign for comments.

There are no multiline comments but that's easily solved if you can do a vertical selection (hold down ALT-key and select in Visual Studio). Vertical select and the enter a #-sign.

Additional information: the line has to start with a #, and optionally any whitespace. This means you cannot combine comments with actual code on the same line.

like image 198
Marcus Hammarberg Avatar answered Oct 05 '22 04:10

Marcus Hammarberg


also, if you want to perform multiline comments in an easy way (on visual studio),

you can select the lines to be commented, and hit CTRL+K+C to comment, CTRL+K+U to Uncomment.

like image 37
Wasafa1 Avatar answered Oct 05 '22 03:10

Wasafa1