SpecFlowOSS / SpecFlow

#1 .NET BDD Framework. SpecFlow automates your testing & works with your existing code. Find Bugs before they happen. Behavior Driven Development helps developers, testers, and business representatives to get a better understanding of their collaboration
https://www.specflow.org/
Other
2.22k stars 752 forks source link

Add support for Rule Backgrounds. #2668

Closed clrudolphi closed 1 year ago

clrudolphi commented 1 year ago

This PR adds support for Rule Backgrounds.

Most of the additional logic has been added to the ScenarioPartHelper class:

Types of changes

Checklist:

clrudolphi commented 1 year ago

Open to suggestions for improvements. I will be adding tests to the Specs project. Considering adding a dedicated unit test project for this -- let me know whether you think that worthwhile.

clrudolphi commented 1 year ago

@gasparnagy Thank you so much for the review comments and suggestions! I've incorporated your suggestions, resulting in a greatly simplified implementation (largely isolated to the SPH). Would welcome any further suggestions you might have.

I am having a problem with adding a Feature file to the SpecFlow.Specs tests however. Pls see my latest commit to this PR (#565afff). When executed the test fails with a TechTalk.SpecFlow.BindingException "Ambiguous step definitions..." The exact error message related to the first scenario of the feature file is: Error Message: TechTalk.SpecFlow.BindingException : Ambiguous step definitions found for step 'Given something first as background': DefaultTestProject:RuleSteps1.GivenSomethingFirst(), DefaultTestProject:BindingsClass_76ec255a.StepBinding() Stack Trace: at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.GetStepMatch(StepInstance stepInstance)

Any suggestions?

clrudolphi commented 1 year ago

@gasparnagy never mind on the problem with ambiguous step definitions; I figured it out. My problem :).

This PR ready for final review/approval.

clrudolphi commented 1 year ago

Please remove that one scenario and then we are ready to go, i think.

Removed. This feature file now reverted to what is in Master.

clrudolphi commented 1 year ago

@gasparnagy @SabotageAndi - checking in with you on this. I believe all prior suggestions/concerns are addressed. Are there any other changes you would like to see?

gasparnagy commented 1 year ago

@clrudolphi Thx! It took a bit more time... sry

praticandobdd commented 1 year ago

@SabotageAndi great news! awesome feature! Congrats.

GondilOndro commented 1 year ago

Has this already been released? Can't see it working in latest SpecFlow for Visual Studio 2022 released Dec 20 2022

clrudolphi commented 1 year ago

Has this already been released? Can't see it working in latest SpecFlow for Visual Studio 2022 released Dec 20 2022

It was incorporated into the v4.0.31-beta build (built on 15 Dec 22).