Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpecFlow bad parsing of feature file #181

Open
7 of 33 tasks
StefanZivkovic opened this issue Jan 20, 2020 · 1 comment
Open
7 of 33 tasks

SpecFlow bad parsing of feature file #181

StefanZivkovic opened this issue Jan 20, 2020 · 1 comment

Comments

@StefanZivkovic
Copy link

SpecFlow Version:

  • 3.1
  • 3.0
  • 2.4
  • 2.3
  • 2.2
  • 2.1
  • 2.0
  • 1.9

Used Test Runner

  • SpecFlow+Runner
  • MSTest
  • NUnit
  • Xunit

Version number: 2.6.2.12296

Project Format of the SpecFlow project

  • Classic project format using packages.config
  • Classic project format using <PackageReference> tags
  • Sdk-style project format

.feature.cs files are generated using

  • SpecFlow.Tools.MsBuild.Generation NuGet package
  • SpecFlowSingleFileGenerator custom tool

Visual Studio Version

  • VS 2019
  • VS 2017
  • VS 2015

Enable SpecFlowSingleFileGenerator Custom Tool option in Visual Studio extension settings

  • Enabled
  • Disabled

Are the latest Visual Studio updates installed?

  • Yes
  • No, I use Visual Studio version 14.0.25465

.NET Framework:

  • >= .NET 4.5
  • before .NET 4.5
  • .NET Core 2.0
  • .NET Core 2.1
  • .NET Core 2.2
  • .NET Core 3.0

Test Execution Method:

  • Visual Studio Test Explorer
  • TFS/VSTS/Azure DevOps – Task – PLEASE SPECIFY THE NAME OF THE TASK
  • Command line – PLEASE SPECIFY THE FULL COMMAND LINE

<SpecFlow> Section in app.config or content of specflow.json

<?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 -->
  </specFlow>
</configuration>

Repro Project

https://github.com/StefanZivkovic/SpecFlow

Issue Description

After implementing 3 step bindings with advanced regex, some steps in feature file start to be unrecognized (which beginnings And, When or Then are not recognized as keywords, but simple black text).
Regex:

[Given(@"Slave side is configured( with ""([0-9, ]*)"" byte block analyzer)?")]
[Then(@"Channel\s*(with "".+"")? is ""(Connected|Disconnected|Connecting|NoReply)""")]
[When(@"Channel( with "".+"")? is ""(Connected|Disconnected|Connecting|NoReply)""")]

We have different steps in feature files and we try to utilize one step binding so regex for that step binding ends with a bit advance pattern. We have capturing groups inside, but what i noticed that makes this problem is optional space before capturing group. I tried to match optional space with different patterns - \s*, \s{0,1}, {0,1}, i also tried to put space inside capturing group with removing space matching pattern before capturing group.
Also, there are errors showing in output window when tracer for specflow is enabled. But tricky thing is that when i comment any of step bindings there are 4 or less errors and parser seems to behave nice when, at least that is what i noticed. When there are 6 errors (3 step bindings), then this problem occurs.

ProjectFeatureFilesTracker: Cannot detect generated test version for file: SpecFlowFeature1.feature, error: Version string portion was too short or too long.

Same thing happens in Visual Studio 2019 and SpecFlow for Visual Studio 2019

Steps to Reproduce

Details in Issue Description

@StefanZivkovic StefanZivkovic changed the title SpecFlow parses wrong feature file SpecFlow bad parsing of feature file Jan 20, 2020
@EmilyRocks
Copy link

Hi! I am running into this issue too. Is there a workaround for this? Since it began I cannot run any tests.

@SabotageAndi SabotageAndi transferred this issue from SpecFlowOSS/SpecFlow Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants