I've created a test-type for selenium types, and now I'd like to use grails.serverURL
as the base url for the system under test.
Using ConfigSlurper
on Config.groovy
doesn't pick up the environmentally-conditioned grails.serverURL
, and ConfigurationHolder.config
is null.
How do I access grails.serverURL
in unit tests? (Really my custom-test-phase that runs like a unit test)
您需要将GrailsUtil.environment
传递给ConfigSlurper
构造函数。
def config = new ConfigSlurper(GrailsUtil.environment).parse(new File('grails-app/conf/Config.groovy').toURL())
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.