1

I am trying out BDD with Specflow in Visual Studio 2017. Previously I had created a new project and added Specflow and Nunit using NuGet Package Manager. From the Solution Explorer, I right click and select Add New Item. From the Add New Item window, I could see SpecFlow feature File and Feature.cs file

But I open the Feature.cs it's showing empty with the message

<#error Generation error: The element may only appear once in this section.>

Then I try to build the solution then I'm getting error on Output

Error CS1029

error: 'Generation error: The element may only appear once in this section.'

The references I can see from Solution Explorer are: SpecRun.SpecFlowPlugin TechTalk.SpecFlow TechTalk.SpecRun NUnit.VisualStudio.TestAdapter

Am I missing something?

Thanks, Mohammed

4
  • Could you post your app.config Commented Nov 15, 2017 at 12:28
  • Yeh sure Andreas Commented Nov 15, 2017 at 16:30
  • Hi, Andreas, i pasted below app.config file Commented Nov 16, 2017 at 9:36
  • Thanks. But there was no error. Could you post the feature file where you get this error? Please add it to your question and not in an answer! Thanks Commented Nov 16, 2017 at 9:47

2 Answers 2

1

If you have a scenario outline, but you for get to write the Examples-Keyword, you will get the following error during the build process:

CS1029 #error: 'Generation error: Sequence contains no elements' in Line 1 of MyFeature.feature

It took me some hours in my large created feature file to locate my error. I deleted the temp files, restarted visual studio several times, but it was difficult to figure out why it occurs.

Could you somehow improve the error messages e.g. with a better location, a simple syntax check before or something similar?

As far as I understand, the ScenarioOutline, followed by a will allways need at least an Examples keyword and a table with this varname, before an other Tag like Scenario, etc. is allowed again. I would appreciate to have such markup

Sign up to request clarification or add additional context in comments.

2 Comments

This error message will be improved in the next version of SpecFlow (github.com/techtalk/SpecFlow/pull/967)
Please advise me how to upload those file into current project
0
?xml version="1.0" encoding="utf-8"?> configuration> <configSections> <section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" /> </configSections> <specFlow> <!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config --> <!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config --><!-- use unit test provider SpecRun+NUnit or SpecRun+MsTest for being able to execute the tests with SpecRun and another provider --><unitTestProvider name="SpecRun" /><plugins> <add name="SpecRun" /> </plugins></specFlow> </configuration> 

2 Comments

Please post the config file into your question. It is no answer to your question.
Issue has been fixed now

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.