Why isn't Gradle running my Groovy integration tests?

Is anyone using Spock for their integration tests? I’ve had the integTest task working for quite some time with standard JUnit-based integration tests. Today, I tried to add my first Spock-based integration test (already been using it for unit tests for a while).

In my build script, I changed this:

sourceSets {
        integTest {
            java {
                srcDir 'src/testIntegration/java'
            }
            ...
        }
        ...
    }

to this:

sourceSets {
        integTest {
            java {
                srcDir 'src/testIntegration/java'
                srcDir 'src/testIntegration/groovy'
            }
            ...
        }
        ...
    }

My integTest task already uses this for the include, so I do not think I need to change it:

include( '**/*IntegrationTest*' )

The integration test source file in the the proper location, but it never gets compiled. Actually, running with --debug shows that Gradle does not think there are any source files for compileIntegTestGroovy to build. I’m at a loss as to why that is.

I guess I’m looking for someone else to tell me they are successfully doing this, so I know I’m doing something silly on my side.

Thanks,

Jamie

Are you using the groovy plugin? My guess is that the groovy code in sourceSets.integTest.java is not compiled because it’s not java :slight_smile: compileIntegTestGroovy looks for input in sourceSets.integTest.groovy

Take a look at the documentation of the groovy plugin.

D’oh! I knew I was doing something dumb; just stared at it so long I couldn’t spot it. Thanks.