Geb+Spock: let your functional tests live long and prosper
Esther Lozano@esloh
o
Functional tests
SpockTesting and specification framework for Java and Groovy applications
Open source (Apache License 2.0)
Beautiful and highly expressive tests
Given-When-Then structure
JUnit integration (via Sputnik runner)
GebGroovy developer tool for browser automation (on top of WebDriver)
Open source (Apache License 2.0)
jQuery-ish navigation API
Page Object Pattern
Optimized for Spock but works with JUnit, TestNG and Cucumber-JVM
(pronounced
“jeb”)
Page ObjectModels and encapsulates web content
Popularized by WebDriver
Reduces amount of duplicated code
Improves reusability and maintainability
First class support in Geb via Page and Module constructs
Demo time!
And more!JavaScript interface (js object to access methods and global variables)
JQuery adapter gives you the jQuery object (useful for simulating
events)
Interaction DSL (on top of WebDriver’s Actions)
Remote browser (since it’s supported by Selenium)
ReferencesOfficial Spock documentation http://spockframework.github.io/spock/docs/1.0/
Official Geb documentation (awesome!) http://www.gebish.org/manual/current/
Taming Functional Web Testing https://www.youtube.com/watch?v=SNMgf6ndoeU
Tutorial (in spanish) http://www.adictosaltrabajo.com/tutoriales/tests-funcionales-con-spock-y-geb-para-una-aplicacion-spring-boot/
Demo code https://github.com/esloho/functional-testing-with-spock