62

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?

cha0site
  • 10,517
  • 3
  • 33
  • 51
Kofi Sarfo
  • 3,310
  • 6
  • 23
  • 24

4 Answers4

84

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.

Good Night Nerd Pride
  • 8,245
  • 4
  • 49
  • 65
Marcus Hammarberg
  • 4,762
  • 1
  • 31
  • 37
  • 4
    When testing using the feature language, my goal is to define a feature language that is - as far as possible - self descriptive. With that in mind, there should only be less need for additional comments. Don't get me wrong, I use comments in the feature files myself, however, if I find myself writing a multiline comment in the feature, I ask myself: "How can I improve my feature language in order to avoid such comments?" – realtime Sep 17 '14 at 06:10
8

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.

Wasafa1
  • 785
  • 2
  • 10
  • 21
2

thank you for the wonderful idea. I just need to press ALT and select the entire lines (just the little space which holds only one character space in each line) and then enter # which result from xyz abc to

'# xyz'

'# abc'

Community
  • 1
  • 1
0

You can add comment lines to the feature files at any place starting the line with the # sign. Be careful however, as comments in the specification are often signs of wrongly specified acceptance criteria.

The comment lines are ignored by SpecFlow.

Nirav Mehta
  • 87
  • 1
  • 4