Today we are going to learn how to use Geb in Cucumber functional automated testing? If you are new to Cucumber than please go through my blog.
Cucumber Basic concept

Fist-of-all if you want use Geb in your application than add these lines in BuildConfig.groovy

and create a GebConfig.groovy in test/functional folder and create driver instance in that like

Now create a Groovy script like env.groovy in support folder like test/cucumber/support and add these lines of code to open browser and initialize URL.

Create a feature file as TestingPage.feature

Now create a folder page in test/functional and create TestingPage.groovy and add these lines of code.

We define static URL because it tells bowser to open different URL and inside static content we define all the fields which will be interacted by browser.We have defined a login method which will be called for login by TestingPage_step

Now define TestingPage_step in cucumber folder and add these lines of code.

There is no need to create an instance of browser and use findby method of selenium. While execution
application will go to TestingPage and use all field to login.