我使用Specflow和ReportPortal在C#中处理BDD基础结构。我正在使用方案大纲,以便通过几个参数自动执行相同的流程,但是我想在reportPortal中使用动态标题。一个例子:
Scenario Outline: Perform a Test on car <car model>
Given I have the car"<car>"
When I expect that "<car>" has 4 wheels
Then I expect that the car will be able to move
此方案不起作用,因为Gherkin不支持方案大纲动态标题。有没有一种方法可以让我以某种方式影响以下代码中的场景标题:
var currentFeature = FeatureContext.Current;
var currentScenario = ScenarioContext.Current;
var jsonRootElement = (JsonReportRootObject)currentFeature["JsonReport"];
var scenarioElement = new Element();
scenarioElement.keyword = "Scenario";
scenarioElement.line = 0;
scenarioElement.name = currentScenario.ScenarioInfo.Title;
scenarioElement.steps = new List<Step>();