0

我目前想返回场景大纲示例的行并获取行的大小,但是我无法执行此操作,因为当 SpecRun 读取功能文件时,它会自动将场景大纲示例转换为自定义报告的单个场景想要创建需要此信息的内容。

ScenarioContext.Current.ScenarioInfo 没有给我这个能力。

当在 JAVA 中遇到同样的问题时,我们将 gherkin.formatter 实现到一个自定义类中,并在 RunCukesTest 类中使用 plugins = {"my.package.customreport"} 调用它

但是,我不确定在导入 gherkin.dll 后如何在 .Net SpecRun 中完成相同的操作。

有人可以对此有所了解或提供替代解决方案吗?

谢谢!

4

1 回答 1

1

正如您所写:我需要它适用于所有步骤,这也没有给我示例的数量和迭代次数。

方案大纲:方案大纲示例

Given I have RestAPI '<iterationNumber>'

When I read '<iterationNumber>' and '<api_key>' 

Then the '<iterationNumber>' and results table
| links list |
| aaa        |
| bbb        |

Examples:
| iterationNumber | api_key                      |
| 0               | @@app.config=api_key_full    |
| 1               | @@app.config=api_key_limited |

调试这个

    [Given(@"I have RestAPI '(.*)'")]
    public void GivenIHaveRestAPI(int iterationNumber)
    {
        Console.WriteLine(iterationNumber);
    }

    [When(@"I read '(.*)' and '(.*)'")]
    public void WhenIReadAnd(int iterationNumber, string p1)
    {

        Console.WriteLine(iterationNumber);
    }

    [Then(@"the '(.*)' and results table")]
    public void ThenTheAndResultsTable(int iterationNumber, Table table)
    {
        Console.WriteLine(iterationNumber);
    } 
于 2015-10-04T16:35:36.517 回答