Step Definition is not working
Used Visual Studio
Visual Studio 2022
Are the latest Visual Studio updates installed?
Yes
SpecFlow Section in app.config or content of specflow.json
No response
Issue Description
Steps to Reproduce
- Create a Unit Test Project
- Create a feature folder and add the specflow feature file
- Write the gherkin scenario for the created feature file
- Install following packages (Spec Flow, Spec Flow.NUnit, Spec Flow.Tools.MsBuild.Generation (3.9.74) and the related packages.
- Right Click the script and click Define Steps
- Return an error and mentioned that All Steps has been defined in the file already
Link to Repository Project
No response
@HingminSon7 .Net 8? Please use new version https://github.com/SpecFlowOSS/SpecFlow.VS/releases/tag/v2022.1.93-net8
@marcel-tatasteel Thanks for your recommendation. Unfortunately, it still not working
I have already using .Net8 but still the same
Latest release did help me.
Latest release did help me.
can you please confirm which release helped you to resolve the issue., because am still facing the same error for below combination Visual studio-2022 .Net version-8 [installed the new specflow version also [v2022.1.91] Specflow version-3.9.74 MSTest
I have the same issue with said configuration (Visual studio-2022 .Net version-8 [installed the new specflow version also [v2022.1.91] Specflow version-3.9.74 MSTest) Works fine on rider.
This is really a blocker that prevents my team from using BDD.
@markovcd and @divyadvs Just tested, and did not have issues.
What I did:
- Install specflow extension from link above (.net 8 version)
- Create new MsTest project
- Reference Specflow + Specflow.MsTest
- Add Feature file
- Add binding file (for steps)
Binding file:
using TechTalk.SpecFlow;
namespace TestProject1
{
[Binding]
public sealed class Feature1Steps
{
private static int _firstNumber = 0;
private static int _secondNumber = 0;
private static int _result = 0;
[Given(@"the first number is (.*)")]
public void GivenTheFirstNumberIs(int p0)
{
_firstNumber = p0;
}
[Given(@"the second number is (.*)")]
public void WhenTheSecondNumberIs(int p0)
{
_secondNumber = p0;
}
[When(@"when the numbers are added")]
public void WhenWhenTheNumbersAreAdded()
{
_result = _firstNumber + _secondNumber;
}
[Then(@"the result should be (.*)")]
public void ThenTheResultShouldBe(int p0)
{
Assert.AreEqual(p0, _result);
}
}
}
Project file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.4" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.4" />
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="SpecFlow" Version="3.9.74" />
<PackageReference Include="SpecFlow.MsTest" Version="3.9.74" />
</ItemGroup>
</Project>
I've been monitoring the .Net 8 changes and have successfully got the updated extension installed and working from the GitHub release linked above. I'm putting together instructions for the rest of my team and it would be my preference to install from the marketplace. Is this something that's likely to be updated soon? or is there something blocking this step?