Is there a "best practice" configuration for running tests with Gradle in parallel?

272 views
Skip to first unread message

jc

unread,
Oct 28, 2019, 6:49:04 PM10/28/19
to Geb User Mailing List
I've been running tests in parallel with Gradle with no issues using the maxParallelForks option with Chrome on Jenkins. However today I started trying it with Firefox and I'm not getting great results. Towards the end of the execution the tests become extremely slow but they don't time out for a long time. Sometimes I'll get a WebDriverException with no message and the rest of the tests in the class fail.

I've been trying to troubleshoot and haven't really found a good solution yet. The grid is a network of Windows VMs and the RAM seems to be hitting 95+% so I'm not sure if Firefox has a memory leak. After reading through the Book of Geb, I tried setting cacheDriverPerThread to true but that did not seem to help.

I'm just wondering if anyone has experienced this or if there is a best practice for settings to use when running tests in parallel. I'd be interested to hear what others are doing or if Marcin has any advice.

Thanks!

Marcin Erdmann

unread,
Nov 1, 2019, 7:57:01 AM11/1/19
to geb-...@googlegroups.com
If you're observing memory leaks or memory pressure in your tests, a quick fix would be to restart the test JVM (and also the browser because the browser is shut down by Geb when the test JVM shuts down) every N test classes - see https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html#org.gradle.api.tasks.testing.Test:forkEvery. The only thing is figuring out what the value of N should be - too low and it will slow down the test execution due to constant JVM restarts and too high and you will be hitting the original problem you had.

--
You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/5fd658f8-5d2b-40d8-9085-2740e94aeafd%40googlegroups.com.

jc

unread,
Nov 1, 2019, 10:27:59 AM11/1/19
to Geb User Mailing List
Ah, so that's what forkEvery actually does.  For some reason I thought it defaulted to 1 but it actually defaults to 0.  Changing it to 1 seemed to help.  Thanks!
To unsubscribe from this group and stop receiving emails from it, send an email to geb-...@googlegroups.com.

GebUser

unread,
Dec 11, 2019, 10:19:43 AM12/11/19
to Geb User Mailing List
jc,
were you getting DriverCreationException?

jc

unread,
Dec 11, 2019, 10:21:35 AM12/11/19
to Geb User Mailing List
I think I was getting some, yes.

GebUser

unread,
Dec 13, 2019, 9:20:40 AM12/13/19
to Geb User Mailing List
jc,

You are no longer seeing DriverCreationException after you have updated forkEvery to 1?
I also wanted to try this out. When I am running 1000s of geb tests in firefox with 4 firefox browsers in parallel, I frequently get "DriverCreationException - connection refused" error. 

Marcin,
Curious if this forkEvery setting might help prevent DriverCreationException. 

Thanks,
Reply all
Reply to author
Forward
0 new messages