Running all unit/integration tests consumes a lot of time, so most of the time during development, you probably run single integration tests from the command line:
grails test-app -integration ClassUnderTest
If you want to debug an integration test to find out why a test is failing, follow the steps described below:
In IntelliJ, do the following:
- Create new run configuration (Edit configurations -> Add new configuration -> Remote)
- Enter name for the configuration
- Deselect "Make"
- Set brakepoint in your test class to make the debugger stop at this point.
Using the command line, run the single integration test using "grails-debug" instead of "grails". This will start grails in debugging mode (it will open a remote debug port).
grails-debug test-app -integration ClassUnderTest
Run your remote debugging session in IntelliJ by pressing on the debug button next to your run config...
If you use a different IDE like Eclipse or Netbeans, remote debugging should be as easy as described above.