reqnroll / Reqnroll

Open-source Cucumber-style BDD test automation framework for .NET.
https://reqnroll.net
BSD 3-Clause "New" or "Revised" License
356 stars 38 forks source link

Cucumber expression errors after Specflow project migration #69

Closed orifn1 closed 7 months ago

orifn1 commented 7 months ago

Reqnroll Version

1.0.1

Which test runner are you using?

MSTest

Test Runner Version Number

3.0.2

.NET Implementation

.NET 7.0

Test Execution Method

Visual Studio Test Explorer

Content of reqnroll.json configuration file

{ "$schema": "https://schemas.reqnroll.net/reqnroll-config-latest.json",

"trace": { "stepDefinitionSkeletonStyle": "RegexAttribute" } }

Issue Description

I am trying to migrate the existing Specflow project to Reqnroll The project has a lot of steps in regex style but does not have specflow.json configuration file I added reqnroll.json to the project

dotnet new install Reqnroll.Templates.DotNet
dotnet new reqnroll-config

but it does not solve the problem image could you help me, I do not want to replace regex in all steps manually

Steps to Reproduce

just migration from Specflow to Reqnroll

Link to Repro Project

No response

gasparnagy commented 7 months ago

The trace/stepDefinitionSkeletonStyle setting is only used to provide step definition snippets (skeletons) for new steps it does not change the processing or the behavior of the existing step definitions.

I think in your case the problem is that Reqnroll (actually SpecFlow v4-beta) is detecting your step definition expressions wrongly as "cucumber expressions" although they should be treated as regular expressions.

You can always force these expressions to be handled as regex by wrapping them with ^ and $ as described here.

Could you please list a few of these expressions to help us better understanding why it detects them as cucumber expression?

gasparnagy commented 7 months ago

I have extended the migration guide with an example how you can force all step definitions to be regex with a single Visual Studio Find & Replace in Files command.

I hope that helps.

orifn1 commented 7 months ago

Thanks, it works