How can I determine if Grails application under testing? -


i need determine if grails application under testing. cannot use if (environment.getcurrent() == environment.test), because current environment environment.custom name jenkins. there other way find out if it's under testing?

one approach i've used set environment variable hooking eventtestphasestart gant event. can creating script named events.groovy in /scripts.

<project dir>/scripts/events.groovy:

eventtestphasestart = { args ->     system.properties['grails.testphase'] = args } 

you can use determine if app under testing:

if (system.properties['grails.testphase'] != null)     println "i'm testing!" 

you can use have specific behavior particular test phase:

if (system.properties['grails.testphase'] == 'integration')     println "do when running integration tests." 

Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -