In SpecFlow how can I share data between steps/features?

前端 未结 6 706
情深已故
情深已故 2020-12-05 01:54

I have 2 features that use a common \'When\' step but have different \'Then\' steps in different classes.

How do I access, for example, the ActionResult from my MVC

6条回答
  •  星月不相逢
    2020-12-05 02:33

    Use the ScenarioContext class which is a dictionary that is common to all the steps.

    ScenarioContext.Current.Add("ActionResult", actionResult);
    var actionResult = (ActionResult) ScenarioContext.Current["ActionResult"];
    

提交回复
热议问题