0

I have been using SpecRun and found this behavior that it executes the BeforeFeature and AfterFeature steps in all the available threads. I was hoping it will only execute the said steps "once and on a single thread".

Ideal Scenario for 3 thread execution would be:

  1. BeforeFeature steps will be executed on Thread 1
  2. Scenario 1 will be executed on Thread 1, Scenario 2 will be executed on Thread 2, Scenario 3 will be executed on Thread 3
  3. After Feature steps will be executed on Thread 1

Actual Scenario happening for me right now:

  1. BeforeFeature steps are executed on Thread1, BeforeFeature steps are executed on Thread2, BeforeFeature steps are executed on Thread3
  2. Scenario 1 are executed on Thread 1, Scenario 2 are executed on Thread 2, Scenario 3 are executed on Thread 3
  3. AfterFeature steps are executed on Thread1, AfterFeature steps are executed on Thread2, AfterFeature steps are executed on Thread3

I am using Selenium WebDriver 2.47.0, SpecRun1.2 and Specflow 1.9

Ghasem
  • 14,455
  • 21
  • 138
  • 171

1 Answers1

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?

Andreas Willich
  • 5,665
  • 3
  • 15
  • 22
  • I have steps in the Before/After Feature that configures/pre-defines the data that will be used for all the scenarios in a given feature. And for the Before and After Test Run, different feature files have different configuration for their data so it will not work for this setup. Also, do you have any links on requiring specific scenarios to be run on a specific thread? Thanks for your help @Andreas – Neville Aaron Alcantara Jan 04 '16 at 06:21