SpecFlow.VisualStudio icon indicating copy to clipboard operation
SpecFlow.VisualStudio copied to clipboard

Generate Step definitions generate code which uses ScenarioContext.Current

Open SabotageAndi opened this issue 5 years ago • 6 comments

Visual Studio Version

  • [x] VS 2019
  • [x] VS 2017
  • [x] VS 2015

Are the latest Visual Studio updates installed?

  • [x] Yes
  • [ ] No

Issue Description

The Visual Studio Integration creates code, that uses the obsolete ScenarioContext.Current property.

image

SabotageAndi avatar Apr 04 '19 08:04 SabotageAndi

Is there a replacement for Currrent.Pending();?

StarWars999123 avatar Apr 04 '19 11:04 StarWars999123

We could use the static one ScenarioContext.StepIsPending (https://github.com/techtalk/SpecFlow/blob/master/TechTalk.SpecFlow/ScenarioContext.cs#L85).

SabotageAndi avatar Apr 04 '19 12:04 SabotageAndi

The template is here: https://github.com/techtalk/SpecFlow/blob/master/TechTalk.SpecFlow/BindingSkeletons/DefaultSkeletonTemplates.sftemplate

But the be in effect, we have to upgrade the SpecFlow version in the Visual Studio extension.

SabotageAndi avatar Apr 04 '19 12:04 SabotageAndi

@SabotageAndi StepIsPending is not part of the latest 2.x version, right?

StarWars999123 avatar Apr 04 '19 13:04 StarWars999123

No idea tbh.

SabotageAndi avatar Apr 04 '19 13:04 SabotageAndi

The best is throw new PendingStepException(); is the best thing to generate IMHO.

gasparnagy avatar Apr 29 '19 07:04 gasparnagy