Multiple Feature files launching multiple browser instances

248 views
Skip to first unread message

ALISTER ERNEST

unread,
Aug 10, 2020, 11:28:31 AM8/10/20
to SpecFlow
We have multiple feature files with their own step definitions as well as pulling from a common step definition class. When each feature file is run individually, the tests run great, but when all 3 feature files are run, they launch 3 instances of the browser and the tests end up randomly failing and passing. 

How to have just one instance of the browser launched and have these tests run sequentially. Also, if they run in parallel, how to ensure that there is no threading issue within the run causing the tests to randomly fail?

Thanks in advance!

-Alister

praveenreddy narala

unread,
Aug 10, 2020, 12:54:00 PM8/10/20
to spec...@googlegroups.com
Hi,

Kindly use Hooks. 
1. BeforeTestRun - get the instance of the driver
2. BeforeFeature/BefoeScenario - register the instance using IObjectContainer
3. Call driver instance in Feature Test Step binding class constructor
4. NOTE: do not call instance of driver in common Step binding class
5. PARALLEL EXECUTION. use default.srprofile (Spec Runner) and add testThreadCount=1/2/3

I hope it helps.

Regards,
Praveen 

--
You received this message because you are subscribed to the Google Groups "SpecFlow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to specflow+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/specflow/c582be87-ce7a-40d7-8067-17fd7be35cc7o%40googlegroups.com.

ALISTER ERNEST

unread,
Aug 10, 2020, 1:14:56 PM8/10/20
to SpecFlow
Hi Praveen, thank you very much for some of these pointers. I think the one thing I am missing is the srprofile. I will implement it and update you.

-Alister


On Monday, August 10, 2020 at 10:54:00 AM UTC-6, praveenreddy narala wrote:
Hi,

Kindly use Hooks. 
1. BeforeTestRun - get the instance of the driver
2. BeforeFeature/BefoeScenario - register the instance using IObjectContainer
3. Call driver instance in Feature Test Step binding class constructor
4. NOTE: do not call instance of driver in common Step binding class
5. PARALLEL EXECUTION. use default.srprofile (Spec Runner) and add testThreadCount=1/2/3

I hope it helps.

Regards,
Praveen 

On Mon, 10 Aug 2020, 16:28 ALISTER ERNEST, <aliste...@gmail.com> wrote:
We have multiple feature files with their own step definitions as well as pulling from a common step definition class. When each feature file is run individually, the tests run great, but when all 3 feature files are run, they launch 3 instances of the browser and the tests end up randomly failing and passing. 

How to have just one instance of the browser launched and have these tests run sequentially. Also, if they run in parallel, how to ensure that there is no threading issue within the run causing the tests to randomly fail?

Thanks in advance!

-Alister

--
You received this message because you are subscribed to the Google Groups "SpecFlow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spec...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages