7

I'm finding the feedback look pretty slow when running integration and functional tests in Grails. Is there a way I can run them against a running server instance while I'm writing the tests, to save on server startup time each time they're executed?

Martin Dow
  • 5,273
  • 4
  • 30
  • 43

3 Answers3

2

You can use grails interactive which does what you want without starting a server. It starts a JVM and keeps it running and you can use it to run unit and integration tests. Keep in mind that you'll eventually run out of memory and need to restart periodically. See http://docs.grails.org/latest/guide/gettingStarted.html#usingInteractiveMode

Also in 1.3.5 you can run functional tests against a running server. Use the baseUrl attribute described in section 9.3 at http://grails.org/doc/latest/

Burt Beckwith
  • 75,342
  • 5
  • 143
  • 156
  • This works great - I hadn't spotted that command. Going to save me a lot of time over the next few months! Thanks. – Martin Dow Oct 09 '10 at 20:13
1

there's an option --baseUrl

e.g.

grails test-app --baseUrl=http://localhost:8080/myapp/

that runs tests against a running instance, one draw back is that the slate isn't wiped clean after a test, so if your test writes to the db, uploads a file, or some other permanent change to the application, then you may have to do some tearDown.

This is briefly documented at the end of the function testing section of the grails docs

http://grails.org/doc/latest/guide/testing.html#functionalTesting

It's useful for writing/debugging functional tests

chim
  • 8,407
  • 3
  • 52
  • 60
0

I'm using Grails 1.3.5 and the EasyB plugin for stories in the context of functional tests.

Take a look at http://padcom13.blogspot.com/2010/10/grails-easyb-and-selenium.html for step-by-step instructions.

Matthias Hryniszak
  • 3,099
  • 3
  • 36
  • 51