How to get on board with Groovy

For Gint Version 3 - see How to Get On Board With Groovy


Summary

If you are not familiar with Groovy, then you need to get a better understanding of Groovy in order to use GINT effectively. Check out the Groovy documentation site. Groovy covers a lot of territory, but for GINT use, only the basics are really needed in most cases. If you are coming from a Java background, picking up Groovy is really easy because it shares similar syntax and, in most cases, just extends all the things you can do. If you are coming from a non-Java or non-programming background, GINT can still be used effectively with just a minimal set of Groovy skills. The following is a quick overview with pointers to the key topics that are important to learn to use Groovy in a GINT context.

Groovy Topics

Here is a starter list of topics taken from the Groovy Documentation Site and other places. Lists, Maps, Closures, and String are the key Groovy concepts when testing using GINT.

Gant Topics

Gant was built as an ANT tool but with Groovy replacing XML. However, for me, the power of Gant as an extension Groovy is in its declarative nature with it's dependency based programming model (think targets (smile)). 

  • Targets
  • A key conceptual difference between Groovy scripts and Gant scripts is that gant scripts are declarative
    • Gant target definitions are processed in the first pass and then appropriate target code is run in the second pass
    • This allows for targets to be dynamically created by standard Groovy processing code at declare time
    • It enables a convenient listing of targets via the gant -p option. Essentially, this runs the declare pass but not the second runtime pass
    • It means you need to be careful and understand lazy evaluation concepts (see Groovy references)


What is Gradle?

Gradle is another build tool (like Gant) based on Groovy and also having a dependency based programming model. Gradle has replaced Gant as the primary build tool for many projects. A future release of GINT may migrate to a Gradle base at some point. It is expected that this will be a relatively easy migration for most GINT tests.