0

I successfully installed Visual Studio 2019 for Mac (community edition, version 8.10.14) and managed to install few other required extensions/packages for my work. These are Specflow, Specflow.NUnit, Selenium WebDriver & Server.

I added one feature file and unable to create step def for that feature file as there is no option i can see to create step def. I try and added a separate file (template is called 'specflow step definition' from right click on folder then add>new file) and it's like added sample step def for calculator sample feature. When i right click on steps in feature file it doesn't show an option to generate step defs.

This issue is only on Mac OS. The same project works perfectly fine on windows machine.enter image description here

Alpesh Savani
  • 59
  • 1
  • 1
  • 5
  • I disagree with the down-vote and close vote. This is not a general computing question. It is a specific question about a software component that is not available on all systems. A linux guru cannot answer this question. – Greg Burghardt Mar 08 '22 at 17:35

1 Answers1

1

A cursory search for specflow visual studio mac seems to conclude that this is not yet available for MacOS versions of Visual Studio. On Windows, the SpecFlow extension for Visual Studio allows you to auto generate step definitions from a feature file. This does not appear to be supported on MacOs, but there is a feature request to add support.

In the meantime, stubbing out a step definition class isn't too bad. The basic shell is:

using TechTalk.SpecFlow;

[Binding]
public sealed class YourStepDefinitions
{
    [Given(@"...")]
    public void GivenX(...)
    {
        ScenarioContext.Current.Pending();
    }

    [When(@"...")]
    public void WhenX(...)
    {
        ScenarioContext.Current.Pending();
    }

    [Then(@"...")]
    public void ThenX(...)
    {
        ScenarioContext.Current.Pending();
    }
}

The challenge is getting the regular expression right. Unfortunately, that requires knowing the step before creating the step definition.

See Step Definitions for more information.

Greg Burghardt
  • 17,900
  • 9
  • 49
  • 92