Cannot resolve symbol GrailsUnitTestCase

I'm going nuts trying to figure out why IntelliJ 8.x will not find my grails.test.GrailsUnitTestCase file.

import grails.test.GrailsUnitTestCase
class ControlServiceTests extends GrailsUnitTestCase {

My tests work fine when I run "grails test-app"  (Grails 1.0.4). But when I write these tests in IntelliJ, the GrailsUnitTestCase cannot be found. I'm about ready to go back to Eclipse... yuk!

Anyone have any advice on what I am doing wrong. I feel like I have scoured every parameter in InteliJ and am apparently not smarter than the IDE because I cannot figure it out.

Thanks in advance!



Can you attach your ipr and iml files or better provide a sample project?


I attached my IML and IPR files and can create a sample project if we need it. No time right at this moment.

Thanks for helping.


Thanks. I don't see anything suspicious in the project files, so please
provide a sample project.


Hi, Tim:

I had the same issue, and I finally resolved it with the help of one of my colleagues.

I did the following:

    Main Menu
            Module Settings

    go to Project Structure dialog
        Project Settings
                        you must choose your Grails SDK

    Note: if you are using the maven Grails integration plugin it would
    be great if this were done auto-magically and you didn't have to
    hassle with this bit of config....

        i submitted an issue on that..


        Please vote it up if you think it would be useful for you.

best regards,

Chris Bedford
Founder & Lead Lackey
Build Lackey Labs


I created a sample project and I still couldn't get it to work. I've asked around to my fellow developers and they haven't been successful either.

Here is what I did.

  1. Created a new project from scratch and selected "Grails Application" as the type of project.
  2. Within the grails plugins for the project (within IntelliJ), I refreshed the list and selected "testing" and chose version 0.5
  3. I then created a Book domain class, BookService class and 1 unit test.

I cannot compile the unit test without receiving compilation errors for grails.test.GrailsUnitTestCase. Actually, in this sample project, I'm also getting errors with IntelliJ being able to resolve BookService and Book.

When I run "grails test-app" from the command line, the code compiles and the tests are successful.

What's this doing for you?

BTW, I'm using Mac OS 10.5 with Grails 1.0.4


I'm also using IntelliJ 8.1 build 9732.


Please try the latest EAP from After
opening the project there, please perform CommandAltG (Run Grails
Target) with 'clean' command. Classes should start resolving.


That helped to resolve the compliation errors within IntelliJ. Thanks.

I am still not able to execute the tests by right-click > Run "XyzTest" when they are extending from GrailsUnitTestCase. I attached a screen shot of what I receive within the output window.

I am actually able to do this within the test project that I sent you, although the output is an execution of "grails test-app", but it doesn't find any test classes to run. Below is the output from right-clicking on the BookServiceTest within the test project and then selecting Run "BookServiceTest". Executing grails test-app from the command line works fine still from this project.

Welcome to Grails 1.0.4 -
Licensed under Apache Standard License 2.0
Grails home is set to: /Users/tim/Applications/grails-1.0.4       
Base Directory: /Users/tim/workspace/GrailsUnitTestCaseSample
Running script /Users/tim/Applications/grails-1.0.4/scripts/TestApp.groovy
Environment set to test
Loading with installed plug-ins: ["testing"] ...
     [copy] Copying 1 file to /Users/tim/.grails/1.0.4/projects/GrailsUnitTestCaseSample
[0] spring.GrailsWebApplicationContext Refreshing org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext@b37db4: display name [org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext@b37db4]; startup date [Thu Apr 16 09:53:38 CDT 2009]; root of context hierarchy
[0] spring.GrailsWebApplicationContext Bean factory for application context [org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext@b37db4]:
     [copy] Copying 1 file to /Users/tim/.grails/1.0.4/projects/GrailsUnitTestCaseSample
Loading with installed plug-ins: ["testing"] ...
No tests found in test/unit to execute ...
No tests found in test/integration to execute ...
[junitreport] Processing /Users/tim/workspace/GrailsUnitTestCaseSample/test/reports/TESTS-TestSuites.xml to /tmp/null160108651
[junitreport] Loading stylesheet jar:file:/Users/tim/Applications/grails-1.0.4/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
[junitreport] Transform time: 683ms
[junitreport] Deleting: /tmp/null160108651
Tests passed. View reports in /Users/tim/workspace/GrailsUnitTestCaseSample/test/reports

Process finished with exit code 0

Picture 1.png

Is the reference to GrailsUnitTestCase red? Is TestCase class present in
your project's classpath? Does IDEA understand that the former is
inheritor of the latter? When I open your project, all three answers for
me are true, and running JUnit tests works.

What you get is not 'grails test-app', but 'grails test-app
BookServiceTest', which isn't supported by Grails. You can invoke tests
from context menu on 'unit' or 'integration' folder, and the tests will
be found.


Please sign in to leave a comment.