0

Sometimes, you could need to split the configuration between integration and functional tests, Imagine you are using spring-security-core plugin and you don't want to enable it in integration test environment. If so, you could have something like this in your conf/Config.groovy:

test {  
    integration {
        grails.plugins.springsecurity.active = false
    }
    functional {
        grails.plugins.springsecurity.active = true
    }
}

So easy and so expressive.

1
  • No Tim, it was an attempt helping people with the same I had recently. Sorry for not being clearer. Oct 10, 2012 at 13:53

1 Answer 1

2

Grails config files are groovy files, meaning they are executable. By capturing the test phase (unit/integration/functional) in scripts/_Events.groovy:

eventTestPhaseStart = { args ->
    System.properties['grails.test.phase'] = args
}

It can be used in Config.groovy:

grails.plugins.springsecurity.active = 
  (System.properties['grails.test.phase'] != 'integration')

Here's another example that does the same thing use a separate database for functional testing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.