0

我一直在使用 SpecRun 并发现它在所有可用线程中执行 BeforeFeature 和 AfterFeature 步骤的这种行为。我希望它只会“一次在一个线程上”执行上述步骤。

3个线程执行的理想方案是:

  1. BeforeFeature 步骤将在线程 1 上执行
  2. 场景1会在线程1上执行,场景2会在线程2上执行,场景3会在线程3上执行
  3. After Feature 步骤将在线程 1 上执行

现在发生在我身上的实际情况:

  1. BeforeFeature 步骤在 Thread1 上执行,BeforeFeature 步骤在 Thread2 上执行,BeforeFeature 步骤在 Thread3 上执行
  2. 场景1在线程1上执行,场景2在线程2上执行,场景3在线程3上执行
  3. AfterFeature 步骤在 Thread1 上执行,AfterFeature 步骤在 Thread2 上执行,AfterFeature 步骤在 Thread3 上执行

我正在使用Selenium WebDriver 2.47.0SpecRun1.2并且Specflow 1.9

4

1 回答 1

0

SpecRun has this behavior, because Before/After- Feature are for all Scenarios and Examples of Scenario Outlines in the Feature- File.

Dependent on your configuration, SpecRun schedules the different Scenarios on different threads or different processes. As you can have some thread- specific stuff in your other step bindings, the after/before steps has to be executed for every thread.

What are you doing in the Before/After Feature Steps? Does Before/After Testrun not work for your use case?

于 2015-12-30T21:13:40.557 回答