Writing Steps in Groovy

Groovy is a very powerful dynamic scripting language that compiles directly to the JVM.

JBehave supports writing Steps classes directly in Groovy, using the GroovyStepsFactory and providing the list of Groovy scripts as classpath resources:

It is also possible to use the Groovy compiler to directly compile Java class files. If this is done, the setup is simpler. The JBehave Tutorial shows a Maven POM file and a runtime configuration that compiles Groovy into Java bytecode before use.

The Groovy script needs to include annotated methods, just as you would in Java:

Using Annotations