This post is a collection of interesting resources to learn to test things better in Grails. It contains a bunch of tools, videos and other resources I found useful in learning to test Grails applications properly.
If I’ve missed something cool, please let me know in the comments.
- Geb – http://www.gebish.org/ – a groovy testing framework around webdriver with jquery syntax. Essential for functional tests.
- Geb IDE – https://github.com/DealerDotCom/GebIDE – A browser plugin that helps you write geb tests better.
- Spock – http://code.google.com/p/spock/ – a specification framework that helps do behaviour driven development. Also try the Spock Web Console.
- Betamax – http://freeside.co/betamax/ – A library for recording and replaying http traffic for your tests.
- Sikuli – http://www.sikuli.org/ – a tool to help test automation using screenshots.
- CloudFoundry Bosh – https://github.com/cloudfoundry/bosh – open source tool by VMWare to help specify and deploy complex environments. Used to deploy Cloud Foundry.com.
- BuildHive – https://buildhive.cloudbees.com/ – Free continous integration for plugins and open source projects by Cloudbees.
- TestBox – https://github.com/osoco/testbox – A virtual personal server based on Vagrant preconfigured with grails that runs your git commits in jenkins.
- IntelliJ – Testing Grails Applications in IntelliJ Idea – http://www.jetbrains.com/idea/webhelp/testing-grails-applications.html
- Fixtures – http://grails.org/plugin/fixtures – Allows you to use a simple DSL for defining your domain data.
- Build-Test-Data – http://www.grails.org/plugin/build-test-data – Provides automatic values for constraints in test data.
- Auto Test – http://www.grails.org/plugin/auto-test / Guard – http://grails.org/plugin/guard – Reruns grails tests when code changes.
- Remote Control plugin: http://grails.org/plugin/remote-control – allows you to execute code on the running application remotely.
- Funky Test Load – http://www.grails.org/plugin/funky-test-load – Uses your functional tests as load testing tool.
- Greenmail – http://www.grails.org/plugin/greenmail – Test mail sending.
- Split Test – http://grails.org/plugin/split-test – Simple A/B testing plugin.
- Functional Test Development – http://grails.org/plugin/functional-test-development – convenient runners to develop functional tests without restarts.
- Functional Test – http://grails.org/plugin/functional-test – Uses the HTMLUnit to allow you to quickly test things like REST calls without relying on many other libraries.
- Spock – http://www.grails.org/plugin/spock – Integrates Spock
- Geb – http://www.grails.org/plugin/geb – Integrates Geb
- Webtest – http://grails.org/plugin/webtest – Integrates Canoo Webtest.
- FitNesse, EasyB, Cucumber – alternative specification frameworks to Spock.
Must Read Guides
- Grails user guide on testing – http://grails.org/doc/latest/guide/testing.html
- The book of Geb – http://www.gebish.org/manual/0.7.2/ – the manual for the Geb automation framework.
- Spock Framework reference documentation – https://spock-framework.readthedocs.org/en/latest/
- Productive Grails Functional Testing – http://skillsmatter.com/podcast/groovy-grails/productive-grails-functional-testing – Luke Daley
- Smarter testing with Spock – http://skillsmatter.com/podcast/groovy-grails/spock – Luke Daley
- Groovier testing with Spock – http://skillsmatter.com/podcast/groovy-grails/groovier-testing-with-spock – Rob Fletcher
- Grails Testing Training Seminar – http://www.youtube.com/watch?v=RZlXFR013hg – Colin Harrington
- Testing HTTP Dependencies with Betamax – http://skillsmatter.com/podcast/groovy-grails/testing-http-dependencies-with-betamax – Rob Fletcher
- Testing Gaelyk Applications – http://skillsmatter.com/podcast/java-jee/testing-gaelyk-applications – Marcin Erdmann
- Continous Delivery in the Cloud with Cloudbees – http://skillsmatter.com/podcast/groovy-grails/continuous-delivery-in-the-cloud-with-cloudbees – Marco Vermeulen
- Groovy Testing for Agile Teams – http://www.testingtv.com/2012/08/20/groovy-testing-for-agile-teams/ – Paul King
- How to use Autotest plugin – https://www.youtube.com/watch?v=7qLuDlJqFwY – Mike Hugo
- Ted Naleid has a good Build Test Data presentation available online.
- Luke Daley’s presentations on Geb and Functional Testing are available to download here.
- Object Partner’s Grails Unit Testing Cheatsheet http://zanthrash.com/grailstesting/UnitTestingCheatSheet.pdf – and presentation ( on 1.3.x )
- Peter Bell’s Groovy Testing Strategies – http://pbell.com/presentations/2011-01-13-GroovyTestingStrategies.pdf
Books I’ve Found Useful
- Growing Object-Oriented Software, Guided by Tests – Outlines a lot of good practices and principles around writing tests.
- ATDD By Example – pretty good end-to-end introduction to how to do BDD. It’s kinda like a ‘ok, so you have Spock, this is how you use it in business and development’ type book. Good fast read. ( Uses FitNess, however, not Spock ).
- Continous Delivery – more of a automated deployment book, but really sheds light on how tools like CloudFoundry Bosh could be used within a company.
- How Google Tests Software – Good overview of how Google conducts testing both in software, support tools and within their company structure.
- Rails Test Prescriptions – A good overview of TDD techniques and walkthrough of the testing tools and techniques available in Rails. It was a good exercise to read and then think, ‘how do I do this in Grails?’.
- Always be Testing – Describes what and how to test in an A/B test. Focused on Google’s A/B testing tools but a lot of useful tips for Split Testing plugin or Optimizely.
- Programming Grails – By Burt Beckwith – The Testing chapter is still in progress, but already a lot of good tips on testing plugins during development and across different versions. http://shop.oreilly.com/product/0636920024750.do
- Grails in Action, 2nd Edition – By Glen Smith and Peter Ledbrook – promises lots of examples testing Spock and Grails. http://www.manning.com/gsmith2/