Before Feature of SpecRun runs on all thread

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

Upvotes: 0

Views: 633

Answers (1)

Andreas Willich
Andreas Willich

Reputation: 5835

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?

Upvotes: 0

Related Questions