Especially I asked myself - maybe it can prove useful for testing ? Many agilers know that one of biggest obstacles in implementing TDD in company is that no one really wants to write tests - as it takes precious time. Groovy posses some interesting features which can make testing simpler - and faster! In my opinion, following ones are noteworthy:
- closures - passing block of logic code to always-required try catch finally (try-catch) block in IO operations is quite convenient (of course closures are far more potent); also "it" keyword for first argument to shorten closure declaration is one neat trick
- "spread dot" operator - no more for-each loops only to obtain one property value from a collection!
- safe navigation operator "?." (aka Elvis :) ), shortening few access lines into one
- additional helper methods, as findAll(), every(), any(), collect()
What I really like in Groovy testing idea is that it shortens TDD development time without sacrificing quality of the final product. Typically, overusing Groovy's shortening syntax in production code would be like shooting self in foot, as it would make code more error-prone and less maintainable. But this can't be applied to test code, as it serves different purpose and in fact could be, let's say, lesser quality that production one.
For those interested I really recommend short presentation about Groovy from GeeCON by Vaclav Pech. You can find it here