I've tried to set up JetBrains Rider with Specflow, following some of the guidance I found on the web:
- generating-specflow-files-in-rider
- using-specflow-3-0-with-rider
- specflow-steps-generation-and-general-rider-changes
... thank you for the documentation Ken.
However, I cannot get my scenario steps to link to any of my step files.
Setup
I believe that I have all the required NuGet packages installed for the latest version of SpecFlow
NuGet installed Specflow packages screenshot
I'm used to Cucumber with IntelliJ, and we have also got the SpecFlow C# Visual Studio working, but I just cannot get the scenario to connect to the steps in Rider.
NB - The project I am trying to use in Rider, is working in Visual Studio with Specflow.
Has anyone else been able to win this battle?
I'd love to hear how.
Thanks
Update @Ken Thank you for the suggestions.
I tried both of the following:
- Manually added include actions in .csproj file for feature.cs, but still unable to reach steps from feature after build.
- Included a Scope(Feature="") attribute
but unfortunately, no luck.
- Screenshot - feature and connected steps - Visual Studio
- Screenshot - feature and connected steps - Rider (including .csproj)
If this does not solve you problem, can you post the content of your .feature and .steps.cs files.
As suggested, below is the content of the feature and step.cs files, that do map correctly in VS.:
.feature
Feature: sampleFeature
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers
@mytag
Scenario: Add two numbers
Given I have entered 50 into the calculator
And I have entered 70 into the calculator
When I press add
Then the result should be 120 on the screen
.steps
using System;
using TechTalk.SpecFlow;
namespace SpecFlowPoc.features.sample
{
[Binding, Scope(Feature="sampleFeature")]
public class SampleFeatureSteps
{
[Given(@"I have entered (.*) into the calculator")]
public void GivenIHaveEnteredIntoTheCalculator(int p0)
{
ScenarioContext.Current.Pending();
}
[When(@"I press add")]
public void WhenIPressAdd()
{
ScenarioContext.Current.Pending();
}
[Then(@"the result should be (.*) on the screen")]
public void ThenTheResultShouldBeOnTheScreen(int p0)
{
ScenarioContext.Current.Pending();
}
}
}
Thank you
Update - solved
OK, firstly, thank you Ken for the help and guidance. After following the steps Ken provides, creating a new project, and throwing the exception, I can confirm that .feature to step.cs binding works.
Ken, you are a gentleman and a genius. Thank you.
Secondly, I wrongly assumed that Rider would provide a way for me to navigate from the .feature to my Steps.cs code (Cucumber JVM style). I understand now that this is not yet supported by Rider.
- this is why I thought the binding did not work !! Duh.
If anyone finds a plugin that maps the Rider gherkin to a gherkin library, I'd love to hear about it.