Use ThreadLocal Webdriver in kotest for parallel execution

211 Views Asked by At

How does one use ThreadLocal Webdriver for parallel browser execution in kotest? Somehow I believe kotlin coroutines messes this up.

1

There are 1 best solutions below

0
Emil Kantis On

As you say, ThreadLocal doesn't always play nice with coroutines. A coroutine may resume on any thread that is owned by the CoroutineDispatcher.

I think the proper way about it would be to add your Webdriver as a Coroutine context element. Either create your own context element or you can have a look at this, perhaps you can use that in conjunction with a listener ?