Search code examples
testinggrailsgroovyjunitfunctional-testing

grails -functional tests won't run, even from within Intelli-J?


I have a tests in /test/functional that extends GrailsUnitTestCase. When I run grails test-app they don't run, and when I try to run them from within Intelli-J, I get no tests found.

My test is simple enough, but I just don't see why it's not running. If I put it in /integration/ or /unit/, it seems to run. I'm using grails 1.3.6. Is there any reason -functional test-phase tests wouldn't run for me?

class MyServiceFunctionalTests extends GrailsUnitTestCase {
    MyService myService

    public void setUp() {
        myService = new MyService()
    }

    public void testSomething(){
       assertTrue( true );
    } 
} 

Solution

  • Do you have a functional test plugin installed? There's no direct support in Grails core for functional tests, so you'd want to install http://grails.org/plugin/functional-test or http://grails.org/plugin/geb or one of the other func test plugins.

    I know your code is just an example, but it wouldn't make sense to either extend GrailsUnitTestCase or create a new instance of MyService (or even attempt to use dependency injection). Functional tests are really just clients of a running application that make GET and POST requests and verify the responses, so you won't have access to Spring beans, services, etc.