Grails plugin
1. Installation
Download the plugin here.
From the command line inside the Grails application directory, execute the following command :
grails install-plugin [location of the GreenPepper plugin]
2. Create the fixture
Fixture classes are created in Groovy and must reside under the test/greenpepper directory (you would need to create the greenpepper directory under test if not present). This directory will be used when executing the specifications. See our Sample Application for more details.
3. Specifications Repository
GreenPepper specifications repository must be set in the resources.groovy. A repository will be bind to a Runner (a GrailsCliRunner instance). This way we can leverage the use of Dependency Injection into Fixture classes (magically!). See our Sample Application for more details.
4. Execute specifications
4.1 Command-line
From the command line inside the Grails application directory, execute the following command :
This will execute the runners as defined in the resources.groovy under the test environment.
This is the output from our Sample application :
...
Executing specifications ...
Executing specifications for runner 'MovieStoreSpecification' ...
-------------------------------------------------------
G R E E N P E P P E R S P E C I F I C A T I O N S
-------------------------------------------------------
Running MovieStore.html
12 tests: 12 right, 0 wrong, 0 ignored, 0 exception(s)
Results: 12 tests: 12 right, 0 wrong, 0 ignored, 0 exception(s) for 1 specification(s)
...
4.2 From the application itself
The plugin can be use directly inside the web application. The GreenPepper runners screen will be found under the /greenPepper URL suffix (ex: http://localhost/myapp/greenPepper
)
You can also add a link to the GreenPepper runners by adding for following snippet:
<gp:ifTestEnv>
<span class="menuButton">
<gp:link/>
</span>
</gp:ifTestEnv>
Use greenpepper-run-app instead of just greenpepper-run.
grails greenpepper-run-app
You should see the GreenPepper icon that will browse to the available runners.
5. Sample Application
Our sample application project can be found here
(Use anonymous for username and password]