zrpehq
Last Updated: February 25, 2016
·
978
· igosuki

TDD Functional testing with Grails

The problem with being test driven with functional tests is that one has to restart his server after making a change.
Even in Grails, the default behavior is to start a Tomcat instance during the functional test phase, the problem is if you already have an instance rolling because of the ZTA nature of Grails you will get
Unable to start server on http://localhost:8080, address already in use.

In order to prevent this, one has to specify the baseUrl attribute in the command line (/!\ it is NOT a VM arg) :
grails test-app functional -baseUrl=http://yourUrl

Going further, one can then launch the cli and just do
test-app functional: TestName -baseUrl=http://yourUrl

Staying in the grails cli will prevent grails from repackaging everything all the time while code modifications using Eclipse or IntelliJ will be hotswapped.