Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.



Groovy is great for Agile development in general and testing in particular because:

  • it has built-in support for the JUnit testing framework
  • it has built-in mocking capabilities
  • it provides a very expressive language in which to write tests which can utilise Closure syntax and Groovy's other features which support the creation of testing domain specific languages (DSLs)
  • it can easily leverage Java testing frameworks and IDE support
  • it's built-in AntBuilder support makes it easy to set up integration tests

This page explores testing features of Groovy and some other testing frameworks that you may sometimes wish to use to complement Groovy's built-in capabilities.

Two main examples are used:

  • A Stack Example
  • An Item Storer Example

Some of the examples on this page rely on annotations: a feature currently available in the Groovy 1.1 snapshot releases 5+ when used with Java 5 and above.