How to quit between parameterized tests

6 views
Skip to first unread message

Ben Frey

unread,
Dec 7, 2020, 2:07:01 PM12/7/20
to Geb User Mailing List
I'm using Spock as my testing framework. Everything works fine if I comment out all but one row of my where table, but if I try to run more than one test in sequence, the second one fails. Initially, it looked like the browser session was staying open, so I added a cleanup: block with browser.quit(), but now the second run fails immediately saying "Session ID is null. Using WebDriver after calling quit()?". I've also tried clearing cookies, but the user is still logged in. How can I properly close the browser or at least the window between tests so I know that I'll start from a fresh slate each test?

tho...@posteo.de

unread,
Dec 7, 2020, 2:19:27 PM12/7/20
to geb-...@googlegroups.com
Hello Ben,

this section in the manual explains how to do this:
https://gebish.org/manual/3.4.1/#driver-management

Cheers,
Thomas
> --
> 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/3579243f-c58f-4032-8d4d-4b34dc8a4e78n%40googlegroups.com
> [1].
>
>
> Links:
> ------
> [1]
> https://groups.google.com/d/msgid/geb-user/3579243f-c58f-4032-8d4d-4b34dc8a4e78n%40googlegroups.com?utm_medium=email&utm_source=footer

Ben Frey

unread,
Dec 7, 2020, 2:40:06 PM12/7/20
to Geb User Mailing List
Great, looks like clearWebStorage() does what I need. Thanks!

Marcin Erdmann

unread,
Dec 8, 2020, 3:44:19 AM12/8/20
to geb-...@googlegroups.com
You can also configure Geb to do clear web storage automatically for you between tests: https://gebish.org/manual/3.4.1/#auto-clearing-web-storage-configuration

Reply all
Reply to author
Forward
0 new messages