Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I run grails integration & functional tests against a running server?

Tags:

grails

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?

like image 877
Martin Dow Avatar asked Oct 06 '10 22:10

Martin Dow


2 Answers

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/

like image 169
Burt Beckwith Avatar answered Sep 27 '22 23:09

Burt Beckwith


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

like image 40
chim Avatar answered Sep 27 '22 23:09

chim