Skip to content

hauner/grails-cucumber

Repository files navigation

Cucumber Grails Plugin

grails-cucumber is a Grails plugin for Cucumber based on Cucumber-JVM. Cucumber-JVM is the JVM implementation of cucumber with support for many JVM languages.

See the wiki for more information, especially the plugin guide or the articles that walk through simple examples.

Quick Usage

The plugin integrates cucumber as a grails test type into the grails test infrastructure. That means you can run the cucumber features with test-app and that the results will be included in the usual grails test reports.

Currently the plugin registers the cucumber test type only to the functional test phase. To run the cucumber features you call grails by one of the following commands:

grails test-app functional:cucumber
grails test-app :cucumber
  • cucumber features and steps are expected in the test/functional folder

  • step implementations look like this:

      import static cucumber.api.groovy.EN.*
    
      Given (~'^I have specified my app by example$') { ->
      	// implement me using groovy and grails code
      }
      
      When (~'^I run the specification without failures$') { ->
      	// implement me using groovy and grails code
      }
      
      Then (~'^I am confident the app does what the customer wanted$') { ->
      	// implement me using groovy and grails code
      }
    
  • failing steps, steps with errors or undefined steps are all reported by grails as FAILED. The normal cucumber output can be found in target/test-reports

  • You can provide feature and scenario filters on the command line. The plugin does currently support cucumbers @tag and dir/file:line filters. See cli options.

Changes

see CHANGES.md

Development

Plugin test code

  • the plugin has a number of unit tests and a single "cli" test. There are also a number of cucumber tests which are not meant to be run directly. They are only used by the "cli" test. You can run the cli test with

grails test-app other:cli

and the unit tests with

grails test-app unit:

The unit tests will also run from an IDE without starting up grails (works for me with IDEA 11.1).