SlideShare ist ein Scribd-Unternehmen logo
1 von 14
GEB WITH SPOCK
Browser Test automation and
Specification Framework
By Monika Gurram
KickStartPros.com
GEB FEATURES
PRONOUNCED AS “JEB”
 Geb is a browser automation framework written in
Groovy Language.
 Expressiveness and Dynamic nature of Groovy language
makes Geb framework less Code Ceremony.
 Geb uses power of Selenium WebDriver. Cross browser
support.
 Geb provides jQuery-like API for web content selection.
GEB POWER
GEB USES WEBDRIVER & GROOVY DSL
 Selenium WebDriver 2.x cross browser support like IE, FF,
Chrome, Opera & Headless browsers.
 Groovy DSL
to : option defines the page the browser will be sent to if the
content is clicked.
content : descripts the page web elements content.
required : option controls whether or not the content returned by
the definition has to exist or not.
cache: option controls whether or not to evaluate each time the
content is requested. Caching makes tests run fast.
wait : wait for the content using default wait time.
page: option allows the definition of a frame page.
GEB NAVIGATOR API
JQUERY-LIKE API
 Navigator API is jQuery-like API for finding, filtering and
interacting with DOM elements.
 The $ Function for getting DOM elements:
CSS3 Selectors:
 $(«css selector», «index or range»,
«attribute/text matchers»)
 $("div.some-class p:first[title='something']")
Find via index and/or attribute matching:
 $("h1", 2, class: "heading")
 $("p", name: "description")
 $("ul.someClass li", 2)
Text value matching:
 $("h1", text: "All about Geb")
Chaining:
 $("div").find(".b")
 $("div").filter(".c").parents()
and many more built in capabilities.
GEB FEATURES
MORE …
 Geb has first class support for the Page Object pattern
for modelling the UI pages.
 Geb provides less code Ceremony.Geb has built-in DSL.
 Geb provides integration with testing frameworks such
as Spock, JUnit & TestNG.
 Geb is easy to integrate with build tools like Gradle and
Maven
GEB PAGE OBJECTS
BUILT-IN PAGE OBJECTS SUPPORT
 The page objects contains logic for page selectors and page operations.
 Groovy's DSL capabilities allows easily define the web pages in a
maintainable and extensible manner.
import geb.Page
class LoginPage extends Page {
static url = "http://myapp.com/login"
static at = { heading.text() == "Please Login" }
static content = {
heading { $("h1") }
loginForm { $("form.login") }
loginButton(to: WelcomePage) { $("input", type: "submit",
name: "login") }
}
}
class WelcomePage extends Page {
static at = { heading.text() == “Welcome to myApp" }
static content = {
heading { $("h1") }
}
}
Page
Objects
Geb DSL
GEB TEST CLASS
CLEAN TEST CODE
 The page objects contains logic for page selectors and page
operations.
 Test classes code is clean and reusable page objects code.
 Test classes contains
Mock data, assertions
and calls to page objects.
import geb.Browser
Browser.drive {
to LoginPage
assert at(LoginPage)
loginForm.with {
username = “myUser”
password = “myPassword”
}
loginButton.click()
assert at(WelcomePage)
}
GEB CODING SIMPLE
AJAX WAIT SIMPLE
 In Groovy Language = Less
Code Ceremony.
def element =
waitFor{$("p#dynamicContentI
d")}
// And then Assert code.
assert element.text() ==
"Added dynamically!"
 In Java Language = High Code
Ceremony.
WebDriverWait wait =
new WebDriverWait(driver,
10);
WebElement element =
wait.until(
ExpectedConditions.visibilit
yOfElementLocated(By.id("dyn
amicContentId")));
// And then Assert code…
assertEquals(element.getText
(), "Added dynamically!");
Geb + Groovy + Selenium Java + Selenium
GEB CONFIGURATION
SIMPLE TO CONFIGURE
 Geb allows Option to provide runtime arguments. Easy to run tests across multiple
browsers and multiple test environments without changing code.
–Dgeb.env=firefox (browser choice)
–Dbase.url=http://myapp.com/. (application url)
 Sample GebConfig.groovy file as below.
import org.openqa.selenium.*
waiting {
timeout = 10
}
// System property 'geb.env' is set to 'chrome' or 'ie' or 'firefox'
environments {
chrome { driver = { new ChromeDriver() } }
firefox { driver = { new FirefoxDriver()} }
ie { driver = { new InternetExplorerDriver() }
}
}
reportsDir = "target/geb-reports"
WHAT IS SPOCK?
SPECIFICATION LANGUAGE
 Spock is a testing framework written in Groovy
language.
 Good Test tool for Behavior-Driven Development (BDD).
 It’s highly expressive specification language.
 Runs with JUnit runner and compatible with all IDEs like
eclipse and IntellliJ.
SPOCK API
CODE BLOCKS AND IT’S PHASES
SPOCK BLOCKS
READABLE CODE BLOCKS
 Spock follows BDD’s Given-When-Then (Gherkin)
concept.
Given Step: put the system/browser in a known state/page
before the user.
When Step: describe the key action the user performs. UI
Operations like click.
Then Step: observe outcomes of test. Your assertions goes
here.
 Spock specification tests are more readable and
maintainable.
GEB WITH SPOCK
READABLE CODE
import geb.Page
import geb.spock.GebSpec
class LoginSpec extends GebSpec {
def "login to app"() {
given: "As an app user, access login page."
to LoginPage
when: "user enter valid login details"
loginForm.with {
username = "myUser"
password = "myPassword"
}
and: "performed login operation"
loginButton.click()
then: "user need to be successfully logged
in."
at WelcomePage
}
}
Spock Blocks
REFERENCE LINKS
 Selenium WebDriver
 Behavior-driven development
 Page Objects Pattern
 Book of Geb
 Spock Project
Thanks
Monika Gurram
KickStartPros.com

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Realtime selenium interview questions
Realtime selenium interview questionsRealtime selenium interview questions
Realtime selenium interview questions
 
Job schedulers android
Job schedulers androidJob schedulers android
Job schedulers android
 
What Is Cucumber?
What Is Cucumber?What Is Cucumber?
What Is Cucumber?
 
Spring beans
Spring beansSpring beans
Spring beans
 
Service workers
Service workersService workers
Service workers
 
A guide to getting started with WebdriverIO
A guide to getting started with WebdriverIOA guide to getting started with WebdriverIO
A guide to getting started with WebdriverIO
 
Angular
AngularAngular
Angular
 
Java script
Java scriptJava script
Java script
 
AngularJS for Beginners
AngularJS for BeginnersAngularJS for Beginners
AngularJS for Beginners
 
Introduction to Angularjs
Introduction to AngularjsIntroduction to Angularjs
Introduction to Angularjs
 
Webdriver io presentation
Webdriver io presentationWebdriver io presentation
Webdriver io presentation
 
Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics
 
Express JS
Express JSExpress JS
Express JS
 
Cucumber presenation
Cucumber presenationCucumber presenation
Cucumber presenation
 
Selenium-Locators
Selenium-LocatorsSelenium-Locators
Selenium-Locators
 
Nuxt.JS Introdruction
Nuxt.JS IntrodructionNuxt.JS Introdruction
Nuxt.JS Introdruction
 
Setting up Page Object Model in Automation Framework
Setting up Page Object Model in Automation FrameworkSetting up Page Object Model in Automation Framework
Setting up Page Object Model in Automation Framework
 
Spring framework core
Spring framework coreSpring framework core
Spring framework core
 
Webdriver.io
Webdriver.io Webdriver.io
Webdriver.io
 
Java Quiz Questions
Java Quiz QuestionsJava Quiz Questions
Java Quiz Questions
 

Andere mochten auch

Andere mochten auch (20)

Taming Functional Web Testing with Spock and Geb
Taming Functional Web Testing with Spock and GebTaming Functional Web Testing with Spock and Geb
Taming Functional Web Testing with Spock and Geb
 
Smarter Testing With Spock
Smarter Testing With SpockSmarter Testing With Spock
Smarter Testing With Spock
 
Spock framework
Spock frameworkSpock framework
Spock framework
 
Testing Web Applications with GEB
Testing Web Applications with GEBTesting Web Applications with GEB
Testing Web Applications with GEB
 
End-to-End Test Automation for Both Horizontal and Vertical Scale
End-to-End Test Automation for Both Horizontal and Vertical ScaleEnd-to-End Test Automation for Both Horizontal and Vertical Scale
End-to-End Test Automation for Both Horizontal and Vertical Scale
 
Smidig 2016 - Do you trust your test?
Smidig 2016 - Do you trust your test?Smidig 2016 - Do you trust your test?
Smidig 2016 - Do you trust your test?
 
Spock and Geb in Action
Spock and Geb in ActionSpock and Geb in Action
Spock and Geb in Action
 
Tests en Java con Groovy y Spock
Tests en Java con Groovy y SpockTests en Java con Groovy y Spock
Tests en Java con Groovy y Spock
 
Idiomatic spock
Idiomatic spockIdiomatic spock
Idiomatic spock
 
Acceptance testing with Geb
Acceptance testing with GebAcceptance testing with Geb
Acceptance testing with Geb
 
Geb for browser automation
Geb for browser automationGeb for browser automation
Geb for browser automation
 
Design Patterns from 10K feet
Design Patterns from 10K feetDesign Patterns from 10K feet
Design Patterns from 10K feet
 
Cloud browser testing with Gradle and Geb
Cloud browser testing with Gradle and GebCloud browser testing with Gradle and Geb
Cloud browser testing with Gradle and Geb
 
Java beyond Java - from the language to platform
Java beyond Java - from the language to platformJava beyond Java - from the language to platform
Java beyond Java - from the language to platform
 
Better Selenium Tests with Geb - Selenium Conf 2014
Better Selenium Tests with Geb - Selenium Conf 2014Better Selenium Tests with Geb - Selenium Conf 2014
Better Selenium Tests with Geb - Selenium Conf 2014
 
Spock Framework
Spock FrameworkSpock Framework
Spock Framework
 
Functional testing your Grails app with GEB
Functional testing your Grails app with GEBFunctional testing your Grails app with GEB
Functional testing your Grails app with GEB
 
What makes Geb groovy?
What makes Geb groovy?What makes Geb groovy?
What makes Geb groovy?
 
Westrich spock-assets-gum
Westrich spock-assets-gumWestrich spock-assets-gum
Westrich spock-assets-gum
 
Spock - the next stage of unit testing
Spock - the next stage of unit testingSpock - the next stage of unit testing
Spock - the next stage of unit testing
 

Ähnlich wie Geb with spock

Agile NCR 2013 - Gaurav Bansal- web_automation
Agile NCR 2013 - Gaurav Bansal- web_automationAgile NCR 2013 - Gaurav Bansal- web_automation
Agile NCR 2013 - Gaurav Bansal- web_automation
AgileNCR2013
 
T 0230 Google Wave Powered By Gwt
T 0230 Google Wave Powered By GwtT 0230 Google Wave Powered By Gwt
T 0230 Google Wave Powered By Gwt
supertoy2015
 
Top100summit 谷歌-scott-improve your automated web application testing
Top100summit  谷歌-scott-improve your automated web application testingTop100summit  谷歌-scott-improve your automated web application testing
Top100summit 谷歌-scott-improve your automated web application testing
drewz lin
 

Ähnlich wie Geb with spock (20)

Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model
Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect ModelComprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model
Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model
 
Stanislaw potoczny kra_qa_21.01.20
Stanislaw potoczny kra_qa_21.01.20Stanislaw potoczny kra_qa_21.01.20
Stanislaw potoczny kra_qa_21.01.20
 
Groovy Finesse
Groovy FinesseGroovy Finesse
Groovy Finesse
 
Groovy Finesse
Groovy FinesseGroovy Finesse
Groovy Finesse
 
Agile NCR 2013 - Gaurav Bansal- web_automation
Agile NCR 2013 - Gaurav Bansal- web_automationAgile NCR 2013 - Gaurav Bansal- web_automation
Agile NCR 2013 - Gaurav Bansal- web_automation
 
淺談 Geb 網站自動化測試(JCConf 2014)
淺談 Geb 網站自動化測試(JCConf 2014)淺談 Geb 網站自動化測試(JCConf 2014)
淺談 Geb 網站自動化測試(JCConf 2014)
 
Groovy and Grails intro
Groovy and Grails introGroovy and Grails intro
Groovy and Grails intro
 
Grails 101
Grails 101Grails 101
Grails 101
 
ASP.NET MVC Workshop for Women in Technology
ASP.NET MVC Workshop for Women in TechnologyASP.NET MVC Workshop for Women in Technology
ASP.NET MVC Workshop for Women in Technology
 
T 0230 Google Wave Powered By Gwt
T 0230 Google Wave Powered By GwtT 0230 Google Wave Powered By Gwt
T 0230 Google Wave Powered By Gwt
 
Play Framework on Google App Engine
Play Framework on Google App EnginePlay Framework on Google App Engine
Play Framework on Google App Engine
 
Geb+spock: let your functional tests live long and prosper
Geb+spock: let your functional tests live long and prosperGeb+spock: let your functional tests live long and prosper
Geb+spock: let your functional tests live long and prosper
 
Grunt Continuous Development of the Front End Tier
Grunt Continuous Development of the Front End TierGrunt Continuous Development of the Front End Tier
Grunt Continuous Development of the Front End Tier
 
Behavior Driven Development by Example
Behavior Driven Development by ExampleBehavior Driven Development by Example
Behavior Driven Development by Example
 
Google App Engine With Java And Groovy
Google App Engine With Java And GroovyGoogle App Engine With Java And Groovy
Google App Engine With Java And Groovy
 
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java TechnologyGriffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
 
Advanced JavaScript
Advanced JavaScriptAdvanced JavaScript
Advanced JavaScript
 
Top100summit 谷歌-scott-improve your automated web application testing
Top100summit  谷歌-scott-improve your automated web application testingTop100summit  谷歌-scott-improve your automated web application testing
Top100summit 谷歌-scott-improve your automated web application testing
 
QA Fes 2016. Александр Хотемской. Обзор ProtractorJS как фреймворка для брауз...
QA Fes 2016. Александр Хотемской. Обзор ProtractorJS как фреймворка для брауз...QA Fes 2016. Александр Хотемской. Обзор ProtractorJS как фреймворка для брауз...
QA Fes 2016. Александр Хотемской. Обзор ProtractorJS как фреймворка для брауз...
 
OSGi enRoute Unveiled - P Kriens
OSGi enRoute Unveiled - P KriensOSGi enRoute Unveiled - P Kriens
OSGi enRoute Unveiled - P Kriens
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Kürzlich hochgeladen (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 

Geb with spock

  • 1. GEB WITH SPOCK Browser Test automation and Specification Framework By Monika Gurram KickStartPros.com
  • 2. GEB FEATURES PRONOUNCED AS “JEB”  Geb is a browser automation framework written in Groovy Language.  Expressiveness and Dynamic nature of Groovy language makes Geb framework less Code Ceremony.  Geb uses power of Selenium WebDriver. Cross browser support.  Geb provides jQuery-like API for web content selection.
  • 3. GEB POWER GEB USES WEBDRIVER & GROOVY DSL  Selenium WebDriver 2.x cross browser support like IE, FF, Chrome, Opera & Headless browsers.  Groovy DSL to : option defines the page the browser will be sent to if the content is clicked. content : descripts the page web elements content. required : option controls whether or not the content returned by the definition has to exist or not. cache: option controls whether or not to evaluate each time the content is requested. Caching makes tests run fast. wait : wait for the content using default wait time. page: option allows the definition of a frame page.
  • 4. GEB NAVIGATOR API JQUERY-LIKE API  Navigator API is jQuery-like API for finding, filtering and interacting with DOM elements.  The $ Function for getting DOM elements: CSS3 Selectors:  $(«css selector», «index or range», «attribute/text matchers»)  $("div.some-class p:first[title='something']") Find via index and/or attribute matching:  $("h1", 2, class: "heading")  $("p", name: "description")  $("ul.someClass li", 2) Text value matching:  $("h1", text: "All about Geb") Chaining:  $("div").find(".b")  $("div").filter(".c").parents() and many more built in capabilities.
  • 5. GEB FEATURES MORE …  Geb has first class support for the Page Object pattern for modelling the UI pages.  Geb provides less code Ceremony.Geb has built-in DSL.  Geb provides integration with testing frameworks such as Spock, JUnit & TestNG.  Geb is easy to integrate with build tools like Gradle and Maven
  • 6. GEB PAGE OBJECTS BUILT-IN PAGE OBJECTS SUPPORT  The page objects contains logic for page selectors and page operations.  Groovy's DSL capabilities allows easily define the web pages in a maintainable and extensible manner. import geb.Page class LoginPage extends Page { static url = "http://myapp.com/login" static at = { heading.text() == "Please Login" } static content = { heading { $("h1") } loginForm { $("form.login") } loginButton(to: WelcomePage) { $("input", type: "submit", name: "login") } } } class WelcomePage extends Page { static at = { heading.text() == “Welcome to myApp" } static content = { heading { $("h1") } } } Page Objects Geb DSL
  • 7. GEB TEST CLASS CLEAN TEST CODE  The page objects contains logic for page selectors and page operations.  Test classes code is clean and reusable page objects code.  Test classes contains Mock data, assertions and calls to page objects. import geb.Browser Browser.drive { to LoginPage assert at(LoginPage) loginForm.with { username = “myUser” password = “myPassword” } loginButton.click() assert at(WelcomePage) }
  • 8. GEB CODING SIMPLE AJAX WAIT SIMPLE  In Groovy Language = Less Code Ceremony. def element = waitFor{$("p#dynamicContentI d")} // And then Assert code. assert element.text() == "Added dynamically!"  In Java Language = High Code Ceremony. WebDriverWait wait = new WebDriverWait(driver, 10); WebElement element = wait.until( ExpectedConditions.visibilit yOfElementLocated(By.id("dyn amicContentId"))); // And then Assert code… assertEquals(element.getText (), "Added dynamically!"); Geb + Groovy + Selenium Java + Selenium
  • 9. GEB CONFIGURATION SIMPLE TO CONFIGURE  Geb allows Option to provide runtime arguments. Easy to run tests across multiple browsers and multiple test environments without changing code. –Dgeb.env=firefox (browser choice) –Dbase.url=http://myapp.com/. (application url)  Sample GebConfig.groovy file as below. import org.openqa.selenium.* waiting { timeout = 10 } // System property 'geb.env' is set to 'chrome' or 'ie' or 'firefox' environments { chrome { driver = { new ChromeDriver() } } firefox { driver = { new FirefoxDriver()} } ie { driver = { new InternetExplorerDriver() } } } reportsDir = "target/geb-reports"
  • 10. WHAT IS SPOCK? SPECIFICATION LANGUAGE  Spock is a testing framework written in Groovy language.  Good Test tool for Behavior-Driven Development (BDD).  It’s highly expressive specification language.  Runs with JUnit runner and compatible with all IDEs like eclipse and IntellliJ.
  • 11. SPOCK API CODE BLOCKS AND IT’S PHASES
  • 12. SPOCK BLOCKS READABLE CODE BLOCKS  Spock follows BDD’s Given-When-Then (Gherkin) concept. Given Step: put the system/browser in a known state/page before the user. When Step: describe the key action the user performs. UI Operations like click. Then Step: observe outcomes of test. Your assertions goes here.  Spock specification tests are more readable and maintainable.
  • 13. GEB WITH SPOCK READABLE CODE import geb.Page import geb.spock.GebSpec class LoginSpec extends GebSpec { def "login to app"() { given: "As an app user, access login page." to LoginPage when: "user enter valid login details" loginForm.with { username = "myUser" password = "myPassword" } and: "performed login operation" loginButton.click() then: "user need to be successfully logged in." at WelcomePage } } Spock Blocks
  • 14. REFERENCE LINKS  Selenium WebDriver  Behavior-driven development  Page Objects Pattern  Book of Geb  Spock Project Thanks Monika Gurram KickStartPros.com