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.
Tools
- 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.
- Testem, testacular – interactive javascript test runners to use for testing client side code.
- 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
Grails Plugins
- 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.
- Jasmine – http://grails.org/plugin/jasmine – A test runner for the Jasmine javascript test library.
- 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/
Videos
- 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
Useful Presentations/Resources
- Venkat Subramaniam’s has a few killer presentations on BDD and groovy testing ( Warning: pdf / zip files ) – including Testing with Spock, Unit and Functional Testing with Groovy and Testing Javascript.
- 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.
Upcoming Books
- 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/
I like Gmock for mocking in unit tests (http://code.google.com/p/gmock/)
the last url (http://www.manning.com/gsmith2/) is pointing to http://grails.org/plugin/functional-test 🙂
thanks, fixed
Pingback: Questa settimana in Grails (2012-52) - luca-canducci.com - Il blog di Luca Canducci: notizie, tips e nuove tecnologie dal mondo dell’IT.
Great list of resources, thanks!
I love canoo webtest because of the great reports it generates. Does any other tool generate such reports out of the box?
Build-Test-Data – http://www.grails.org/plugin/build-test-data points to the autoTest plugin instead!
Otherwise, thanks for the list!
fixed, thanks. Got to stop drinking and linking.
Pingback: An Army of Solipsists » Blog Archive » This Week in Grails (2012-52)
This is great! Thanks for posting it.
Pingback: This Week in Grails (2012-52) | Nevada Java User Group
Very thorough. Good job.
The remote control plugin might be a candidate for this
https://github.com/alkemist/grails-remote-control/
you’re right. It has now been added.
Thanks for great list.
I like Improx Plugin (http://grails.org/plugin/improx).
It can quickly run a test from your favorite editor or IDE.
Great job! Thanks.
Pingback: Testing Grails | Contracting from the trenches...
Great! All that I want to know in one article!
Thanks a lot 🙂
Superb , the collection was awesome.
I have tried several of this options in cloud environment.
used jelastic for my work and it worked well enough-
http://jelastic.com/docs/jelastic-grails-deploy
great post! thank you…