Plugins You can find out about all the publicly available Grails plugins.

Sham Plugin

  • Tags: /
  • Latest: 0.3
  • Last Updated: 07 February 2013
  • Grails version: 1.3.7 > *
0 vote
compile "org.grails.plugins:sham:0.3"

 Documentation  Source  Issues


A plugin using the sham data generation library to generate test / demo data when testing your app.


grails install-plugin sham


This plugin allows easy generation of realistic test data for your application.

If you are currently using the build-test-data or fixtures plugins, you will be familiar with your data having the same values over and over again, maybe with an index number if you're lucky. This doesn't help you show your application to your customer, and it doesn't help you see how resilient your website layout is to differently sized content.

This is where the sham library and plugin can help.


Once you have installed the plugin, there is a sham bean available in your Grails application context or for dependency injection. Alternately, there is a static instance available by calling Sham.instance , and this may be more useful in your tests.


If you have a fixture which previously had some hardcoded data set up:
build {
    myArticle( {
        title = 'Exciting headline here'
        teaser = 'Some really exciting text that should make someone click through to the underlying article'
        text = 'Full article copy here'
        author = 'Joe Bloggs'

it could be made much more dynamic with the application of soms Sham data:

def sham = Sham.instance
build {
    myArticle( {
        title = sham.nextHeadline()
        teaser = sham.nextParagraph()
        text = sham.nextParagraphs() // produces random number of paragraphs between 1 and 8
        author = sham.nextPerson().name

This will create an article with randomly generated news headline, body text, teaser and author name.

Full documentation coming soon! In the meantime, have a look at the fixtures in the demo app in the source, or check out what data generation is available in the library