Grails: Fix functional tests for forked execution

If you’ve also run into the issue that functional tests have a problem with forked execution, but you still want to use it for development (e.g. for reloading), you can use the environment support in BuildConfig.groovy for enabling forking for development mode, but disabling it in test mode (because the server running for the functional test mode is, despite test mode, still executed with the fork.run configuration).

forkConfig = [maxMemory: 1024, minMemory: 64, debug: false, maxPerm: 256]
grails.project.fork = [
        //fork during development for reloading, but for functional tests forked execution breaks the server start
        run: (grails.util.Environment.current == grails.util.Environment.DEVELOPMENT ? forkConfig: false)
]

This entry was posted in Software. Bookmark the permalink.