First of all, you should model these as separate source sets. See the Gradle User Guide and/or samples in the full Gradle distribution (e.g. the ‘java/withIntegrationTests’ sample) for how to do this.
The ‘testSrcDirs’ property is only relevant when using TestNG. However you’ll have to configure several other properties. Again, see the ‘java/withIntegrationTests’ sample and also the ‘Test’ task type in the Gradle Build Language Reference.
Thanks for the prompty response Peter. I’ve found example and trying to set it up. Will there be any differences for sources in groovy cause after first try it’s not working? I suppose there shouldn’t be.
No idea, what’s going wrong… Of course my build.gradle has much more configuration but it doesn’t affects the current problem (probably). Am I missing something?
One thing that I can spot is that the first two dependency declarations aren’t assigned to a configuration (e.g. ‘compile’), which makes them no-ops. Hence even compilation of Groovy code shouldn’t work.
There’s also a spelling mistake in the configuration of the ‘Test’ task (‘classPath’ should be ‘classpath’).
Thanks Peter. Compilation was working well, I just haven’t rewritten configuration for ‘gradleApi()’ and ‘localGroovy()’. I’ve fixed the spelling mistake in ‘classpath’ and now tests run as I expected. Thank You very much for helping me to configure it well.