Run single Spock test in Grails

When using Spock framework together with Intellij Idea 11 I found very annoying that when I try to run single test all test in spec are executed.
First I thought that this is Idea issue but it turned out to be Grails problem.

The thing is that You can only run whole spec from Grails command line:

grails test-app unit:spock SomeControllerSpec

New Feature request to fix this: http://jira.grails.org/browse/GPSPOCK-3

Workaround

There is a annotation you can use as a workaround to run only one test:

@IgnoreRest
def "should test something"() {
...
}

You can put this on test you are working on to prevent all other test in spec from running.
Don’t forget to remove it when You finish.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s