-
Notifications
You must be signed in to change notification settings - Fork 41
Installation
See new documentation at: http://longwa.github.io/build-test-data/index
Add testCompile "org.grails.plugins:build-test-data:3.0.1"
to build.gradle
Add test ":build-test-data:2.4.0"
to grails-app/conf/BuildConfig.groovy
Now all of your domain classes implement the BuildTestDataEntity
trait and have a static build()
method that automatically generates a valid instance and saves it to the database. You can start using it in your integration tests like this without any additional configuration:
def author = Author.build()
Most domain objects should be able to be persisted without passing any parameters to build().
For ones that can't be, or if you want to have finer control over the kind of data that they get injected with, there is a config file that gets installed at grails-app/conf/TestDataConfig.groovy
. See the TestDataConfig page for more information about the kind of control that you have over how data is automatically constructed.
See the Basic Usage page for additional quick start information.