【问题标题】:specflow: feed data from a file and run scenarios async in c#specflow:从文件中提供数据并在 c# 中异步运行场景
【发布时间】:2017-08-04 19:06:55
【问题描述】:

有这个feature:

Feature: ServiceAdd
    Check if addition works well

@someTest
Scenario: Add two numbers
    Given I connected to the api
    And I check the result
    | a | b | ExpectedResult |
    | 1 | 2 | 3              |
    | 4 | 2 | 6              |
    | -1| 2 | 1              |
    | 1 | 2 | 3              |
    | 1 | 2 | 3              |
    | 1 | 2 | 3              |

c# 代码:

    [Given(@"I check the result")]
    public void GivenICheckTheResult(Table table)
    {
     ......
    }

我有一些问题:

  1. 如何对表async中的所有值运行测试(我不想等待结果开始新的测试)?
  2. 如何从文件或数据库中输入这些值,以便测试自动读取这些值?

【问题讨论】:

    标签: c# unit-testing specflow


    【解决方案1】:
    1. 您需要使用支持并行运行测试的测试运行器。目前我相信是 NUnit3、XUnit2、SpecRun 或 NCrunch。

    2. 您或许可以为此使用Specflow+ excel extension,虽然我没有使用过它,所以不能确定它是否适合这个用例,而且它是一个付费扩展。

    【讨论】:

      猜你喜欢
      • 2018-10-08
      • 1970-01-01
      • 1970-01-01
      • 2019-04-06
      • 1970-01-01
      • 2019-03-01
      • 1970-01-01
      • 2016-02-04
      • 2013-07-28
      相关资源
      最近更新 更多