Geb+Spock: let your functional
tests live long and prosper
Esther Lozano
@esloho
Hello! I’m Esther 2009
2015
@esloho
esloho@gmail.com
https://github.com/esloho
Functional tests
Spock
Testing 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)
Geb
Groovy 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
Page Object
Models 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)
References
Official 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
@esloho
esloho@gmail.com
https://github.com/esloho
Questions?

Geb+spock: let your functional tests live long and prosper

  • 1.
    Geb+Spock: let yourfunctional tests live long and prosper Esther Lozano @esloho
  • 2.
    Hello! I’m Esther2009 2015 @esloho esloho@gmail.com https://github.com/esloho
  • 3.
  • 4.
    Spock Testing and specificationframework 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)
  • 5.
    Geb Groovy developer toolfor 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
  • 6.
    Page Object Models andencapsulates web content Popularized by WebDriver Reduces amount of duplicated code Improves reusability and maintainability First class support in Geb via Page and Module constructs
  • 7.
  • 8.
    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)
  • 9.
    References Official Spock documentationhttp://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
  • 10.

Editor's Notes

  • #3 Hilar aquí el comentario de Teams (just released/made public few weeks ago) con: java + Spring boot project, we needed functional tests → Spock + Geb
  • #5 2008 Cualquier testing: Unitarios, de integración, funcionales Apache License v2 Fácil de leer pero orientado a desarrolladores: basado en código, no en leng. natural como Cucumber Sputnik es el runner JUnit de Spock = permite ejecutar las especificaciones de Spock con JUnit assert implícito
  • #6 2009 Puede hacerse todo lo que se hace con WebDriver (Selenium 2) y más
  • #7 Define el contenido de una página. Comportamientos como métodos Unidades reutilizables = reduce la duplicidad de código
  • #9 Asynchronous (waitFor directive, wait:true property, configurable time)