【问题标题】:Getting Scenario outline examples获取场景大纲示例
【发布时间】:2015-10-01 06:57:15
【问题描述】:

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

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

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

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

有人能解释一下这个问题或提供替代解决方案吗?

谢谢!

【问题讨论】:

    标签: c# .net cucumber specflow specrun


    【解决方案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);
        } 
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-10-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-04
    相关资源
    最近更新 更多