ttutisani / Xunit.Gherkin.Quick

BDD in .NET Core - using Xunit and Gherkin (compatible with both .NET Core and .NET)
MIT License
205 stars 29 forks source link

Accessing same step definition using multiple steps #50

Closed SDETRK closed 6 years ago

SDETRK commented 6 years ago

Hi, In specflow we can access the same step definition using multiple steps. For example: A "Given" step in a test scenario can be used as a "When" step in another scenario. So instead of duplicating the code we can use:

[Given(@"I search for '(.)'")] [When(@"I search for '(.)'")] public void ISearchFor(string searchTerm) { ... }

It would be very useful as well in the case of "And" step in Xunit.Gherkin.Quick for example:

[And(@"I search for '(.)'")] [When(@"I search for '(.)'")] public void ISearchFor(string searchTerm) { ... }

ttutisani commented 6 years ago

Agreed, that makes sense as an expectation. Will look into it.

SDETRK commented 6 years ago

great, thank you!

SDETRK commented 6 years ago

sorry I closed it by mistake. I reopened the issue

ttutisani commented 6 years ago

No worries!

christianh25 commented 6 years ago

We have the same issue in our project. This would be a nice added feature!! Any chance we have an ETA?

ttutisani commented 6 years ago

2 weeks max ETA and should be out. I will provide updates here along the way.

ttutisani commented 6 years ago

This work is in progress now. So far everything seems to be on track.

Branch diff: https://github.com/ttutisani/Xunit.Gherkin.Quick/compare/sharedStepMethod?expand=1

ttutisani commented 6 years ago

Version 3.2.0 is uploaded to Nuget. It will become available for download after validation and indexing (internal steps to Nuget) are complete. Expect to see new downloadable version in couple of hours.

Let me know if any issues noticed.

ttutisani commented 6 years ago

Oh, forgot to mention the most important part: Version 3.2.0 is for supporting shared step method to match multiple scenario steps in Gherkin feature file.

ttutisani commented 6 years ago

Link to the instructions: https://github.com/ttutisani/Xunit.Gherkin.Quick/blob/master/docs/shared-step-method.md (basically it works as it was asked here in this issue anyway)

ttutisani commented 6 years ago

Closing the issue since this functionality is already out. If any problems found with it, please open a new issue.

SDETRK commented 6 years ago

Thank you very much for the fix, we will try it!