DevQA: make your
testers happier with
Groovy, Spock and Geb
Álvaro Sánchez-Mariscal
Web Architect – odobo
!

@alvaro_sanch...
About me
• Passionate software developer.
• Founded Salenda in 2005.

• Co-founded Escuela de Groovy in 2009.

• Groovy/Gr...
• HTML5 games platform for:
• Game developers.
• Casinos.

• We are hiring!

• http://bit.ly/odobo-grails-job
DevOps
DevQA

QA
Writing tests in Grails
• Unit tests.
• Integration tests.
• Functional tests…
Who should write the
functional tests?
Writing functional tests
• Normally, the Grails developers will write
them.

• But if you have QA automation
engineers…
Problems we found at
odobo and how we
solved them
Disclaimer

One size does not fit all
Problems we had
• Different frameworks used:

• Developers: Selenium IDE + Grails.
• QA: WebDriver + Java + TestNG.

• Dup...
The approach
• Define a unified and shared testing
framework for Dev and QA.

• For any kind of web application.
• Have N+...
The framework
• An independent project using:

• Gradle for building and running.
• Groovy as programming language.
• Spoc...
Independent project
• Pros:

• Easier for non Grails developers.
• Prevents QA from touching anything else.
• We can now w...
Fixtures
• First attempt: GORM standalone. It didn’t
work :(

• We already had a fixture controller to

allow Selenium IDE...
Fixtures: in Grails
Fixtures: in Selenium IDE
Fixtures: in Geb
Jenkins gotchas
• There are 2 projects, so:
1. Run Grails app.
2. When it is up, launch
the tests.
3. Tear down everything...
Solution: a custom script
The language
• Pros:

• Strong knowledge within the Grails team.
• Less verbose than Java (aka “We are not
writing fucking...
The testing framework
• Pros:

• Beautiful DSL, even better combined with
Geb.

• Cons:

• Low IDE support.
The browser tool
• Pros:

• Awesome DSL.

• Cons:

• Very difficult to “try and error” your CSS
selectors.

• You end debu...
Porn for developers!
Porn for developers!
Documentation

In Confluence
Configuration
• Groovy’s ConfigSlurper inside.
• Per environment, like in Grails.
Configuration
Per environment execution
• We have 2 kinds of environments:

• With fixtures enabled, like localhost.
• Live environments...
Per environment execution
Feature Groups
• A port of TestNG’s test groups.
• Used by QA team to group tests around
business features, and not just s...
Feature Groups
Feature Groups
Conclusions
• Happier Grails developers.

• The whole solution is better than Selenium
IDE.

• Happier QA’s.

• Learning a...
Conclusions
• No effort duplication.

• Everybody works on the same project.

• Effective code reuse.

• CSS selectors are...
Developing SPI
apps with
Grails and
Angular JS
This afternoon,
14:00
Thanks!
Álvaro Sánchez-Mariscal
Web Architect – odobo
!

@alvaro_sanchez
Upcoming SlideShare
Loading in …5
×

DevQA: make your testers happier with Groovy, Spock and Geb

2,123
-1

Published on

Writing functional tests using Geb in a Grails application is fine for a development team. But when you have QA automation engineers, giving them access to the Grails app might not be the best solution (specially when they belong to a different team).

So the same way DevOps allow developers and sysadmins collaborate together, let's talk about DevQA, and make them happy using a framework stack powered by Groovy.

Besides above considerations, in this talk I will show a live example on how to setup an independent project for functional tests using Gradle, Groovy, Spock and Geb.

Published in: Technology
1 Comment
3 Likes
Statistics
Notes
No Downloads
Views
Total Views
2,123
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
30
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide

DevQA: make your testers happier with Groovy, Spock and Geb

  1. 1. DevQA: make your testers happier with Groovy, Spock and Geb Álvaro Sánchez-Mariscal Web Architect – odobo ! @alvaro_sanchez
  2. 2. About me • Passionate software developer. • Founded Salenda in 2005. • Co-founded Escuela de Groovy in 2009. • Groovy/Grails lover since 2007. • Working now at Odobo as Web Architect.
  3. 3. • HTML5 games platform for: • Game developers. • Casinos. • We are hiring! • http://bit.ly/odobo-grails-job
  4. 4. DevOps
  5. 5. DevQA QA
  6. 6. Writing tests in Grails • Unit tests. • Integration tests. • Functional tests…
  7. 7. Who should write the functional tests?
  8. 8. Writing functional tests • Normally, the Grails developers will write them. • But if you have QA automation engineers…
  9. 9. Problems we found at odobo and how we solved them
  10. 10. Disclaimer One size does not fit all
  11. 11. Problems we had • Different frameworks used: • Developers: Selenium IDE + Grails. • QA: WebDriver + Java + TestNG. • Duplicated efforts. • Zero knowledge sharing and resources reuse.
  12. 12. The approach • Define a unified and shared testing framework for Dev and QA. • For any kind of web application. • Have N+M testers instead of N Devs and M QAs.
  13. 13. The framework • An independent project using: • Gradle for building and running. • Groovy as programming language. • Spock as testing framework. • Geb as browser automation tool. • With some custom features.
  14. 14. Independent project • Pros: • Easier for non Grails developers. • Prevents QA from touching anything else. • We can now write tests for any application. • Cons: • You need to think about how to feed your app with fixture data.
  15. 15. Fixtures • First attempt: GORM standalone. It didn’t work :( • We already had a fixture controller to allow Selenium IDE invocations via HTTP. • It was easy to reuse in the new project. • This requires to have the Grails application running.
  16. 16. Fixtures: in Grails
  17. 17. Fixtures: in Selenium IDE
  18. 18. Fixtures: in Geb
  19. 19. Jenkins gotchas • There are 2 projects, so: 1. Run Grails app. 2. When it is up, launch the tests. 3. Tear down everything at the end.
  20. 20. Solution: a custom script
  21. 21. The language • Pros: • Strong knowledge within the Grails team. • Less verbose than Java (aka “We are not writing fucking semicolons!”). • Cons: • Learning curve for QA automation engineers.
  22. 22. The testing framework • Pros: • Beautiful DSL, even better combined with Geb. • Cons: • Low IDE support.
  23. 23. The browser tool • Pros: • Awesome DSL. • Cons: • Very difficult to “try and error” your CSS selectors. • You end debugging and evaluating expressions.
  24. 24. Porn for developers!
  25. 25. Porn for developers!
  26. 26. Documentation In Confluence
  27. 27. Configuration • Groovy’s ConfigSlurper inside. • Per environment, like in Grails.
  28. 28. Configuration
  29. 29. Per environment execution • We have 2 kinds of environments: • With fixtures enabled, like localhost. • Live environments, like QA or Staging. • Implemented as a Spock extension.
  30. 30. Per environment execution
  31. 31. Feature Groups • A port of TestNG’s test groups. • Used by QA team to group tests around business features, and not just single user stories. • Eg: @FeatureGroup([‘operatorMarketplace’]) • Implemented as a Spock extension.
  32. 32. Feature Groups
  33. 33. Feature Groups
  34. 34. Conclusions • Happier Grails developers. • The whole solution is better than Selenium IDE. • Happier QA’s. • Learning a lot of new stuff. • Not feeling alone anymore.
  35. 35. Conclusions • No effort duplication. • Everybody works on the same project. • Effective code reuse. • CSS selectors are reused via Geb pages / modules.
  36. 36. Developing SPI apps with Grails and Angular JS This afternoon, 14:00
  37. 37. Thanks! Álvaro Sánchez-Mariscal Web Architect – odobo ! @alvaro_sanchez
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×