What version of grails are you using? It works great for both situations for me on 1.0.4 (last).
I create a new empty application and create a service class with an integration test:
FooService.groovy:
class FooService { def logSomething(message) { log.error(message) return true } }
FooServiceTests.groovy:
class FooServiceTests extends GroovyTestCase { def fooService void testSomething() { assert fooService.logSomething("it works") } }
When starting only a test application, I get a log message:
% grails test-app Welcome to Grails 1.0.4 - http://grails.org/ .... ------------------------------------------------------- Running 1 Integration Test... Running test FooServiceTests... testSomething...[4174] service.FooService it works SUCCESS Integration Tests Completed in 440ms ------------------------------------------------------- ...
When doing only integration tests, it also works:
% grails test-app -integration Welcome to Grails 1.0.4 - http://grails.org/ .... ------------------------------------------------------- Running 1 Integration Test... Running test FooServiceTests... testSomething...[4444] service.FooService it works SUCCESS Integration Tests Completed in 481ms ------------------------------------------------------- ....
Are you going to get together with the registrar class (or redefine any metaclass stuff on the registrar, in any previous integration classes or unit tests, and not then reinitialize the metaClass?
source share