SpecFlowOSS / SpecFlow.VisualStudio

Visual Studio extension of SpecFlow (extracted from the main SpecFlow repo)
Other
67 stars 73 forks source link

Visual Studio fails to bind when attributes use const string interpolation #194

Open kapros opened 3 years ago

kapros commented 3 years ago

SpecFlow Version

3

Which test runner are you using?

NUnit

Test Runner Version Number

N/A

.NET Implementation

.NET 5.0

Project Format of the SpecFlow project

Sdk-style project format

.feature.cs files are generated using

SpecFlow.Tools.MsBuild.Generation NuGet package

Test Execution Method

Visual Studio Test Explorer

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

No response

Issue Description

If your project uses the C#10 feature "constant interpolated strings" in your steps binding argument, the SpecFlow extension will no longer recognize the step as bound. The tests seem to run just fine even from the VS test explorer.

Steps to Reproduce

  1. Create a SpecFlow project.
  2. If reproducing before C#10 has been shipped, add this to your .csproj node preview
  3. In the StepDefinition attributes, add interpolation, for example create a const string with the whole text and insert that into the interpolated string.
  4. Open the feature file with the affected.

Link to Repro Project

https://github.com/kapros/SpecFlowInterpolatedStrings

SabotageAndi commented 3 years ago

In VS2017 and VS2019 this will never work. We are using another concept in the VS2022 extension and there this could work. @epresi & @gasparnagy What do you thing about this?

Also this is a VS issue, so I move it into the right repo

gasparnagy commented 3 years ago

@kapros @SabotageAndi Yes, this will work in the VS2022 extension, but not in the VS2019 extension. (I guess it would also work with Deveroom in VS2019 as it uses the same binding discovery mechanism as the VS2022 extension.)

As @kapros provided an repro, we should verify this with the VS2022 extension to make sure it works. I would keep the issue open until we did that.

kapros commented 3 years ago

@gasparnagy I have just switched over to Deveroom for VS2019 and it works just fine.