Using navigators in Spock's where block?

24 views
Skip to first unread message

jc

unread,
Jul 30, 2019, 4:28:35 PM7/30/19
to Geb User Mailing List
Is it possible to use navigators in Spock's where block?  What I am trying to accomplish is to use one Unroll method to perform a test but the only thing that will change on the tests is the input field.  Whenever I try to run the test I get a NullPointerException.  Something like this. 


@Unroll
def "#field character limit"(){
given:
page = at ApplicantInformationPage

when:
input << text

then:
input.size() == limit

where:
field | text | limit | input
"first name" | exceeds256limit | 256 | page.firstNameField
"phone" | exceeds10limit | 10 | page.phoneNumberField
"zip" | exceeds5limit | 5 | page.zipcodeField

Error I am getting:
java.lang.NullPointerException: Cannot get property 'firstNameField' on null object

at geb.tests.ApplicantInformationPageTest.#field character limit(ApplicantInformationPageTest.groovy)
 

Can anyone enlighten me as to what I may be doing wrong? 

jc

unread,
Jul 30, 2019, 4:50:35 PM7/30/19
to Geb User Mailing List
Looks like erdi already answered this on StackOverflow which was exactly what I was looking for: https://stackoverflow.com/questions/46960922/using-spock-data-tables-to-test-geb-page-objects

Marcin Erdmann

unread,
Jul 31, 2019, 3:21:58 AM7/31/19
to geb-...@googlegroups.com
Good find, Jeremy. :)

--
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/ae7a2177-f085-4340-ae93-611b2e3ac967%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages