I recently upgraded SpecFlow from version 1.9.0 to version 2.3.0 in order to use SpecFlow.Tools.MsBuild.Generation. Most of our .feature files end like this:
Scenario:
...
Background:
...
But when I build the .feature files have this specific error:
expected: #EOF, #TableRow, #DocStringSeparator, #StepLine, #TagLine, #ScenarioLine, #ScenarioOutlineLine, #Comment, #Empty, got 'Background:'
Was there a specific change in a future version that caused this error? On version 1.9.0 this was never an issue.
Creator of specflow, Gaspar Nagy, points out http://gasparnagy.com/2016/02/specflow-tips-feature-file-backgrounds-like-them-or-not/ that background should be used once in a feature file placed before first scenario.
Also, take a look at cucumber documentation - https://cucumber.io/docs/gherkin/reference/#background
Personally, i have never used Background after scenario or at the end of feature file.