Tomek Kaczanowski wrote:
Hi Tom,
- only execute a single test:
gradle test(test.XXTest)
- execute all tests extending a base class:
gradle test(test.AbtractXXXTest+) -- don't know if a plus sign is best
perhaps a minus sign is more appropriate
or
gradle test(test.AbstractXXXTest-)
- execute all tests in a package:
gradle test(org.gradle.*)
gradle test(org.gradle.**) -- including contained packages
or a combination of them separated by comma's:
gradle test(test.XXTest,test.YYTest,org.gradle.**)
I'm a TestNG user, and I'd be interested in telling Gradle to run
specific groups of tests (defined using TestNG annotations). Will it
also be possible with Gradle ?
Or more generally, I'd like to treat Gradle as a proxy, that would
pass some parameters to the testing framework below (in my case
TestNG).
This is a good way of thinking about the problem, I think. To run a
specific set of tests, you effectively want to use a set include and
exclude patterns which are different to those coded in the build script.
If we had some general way of configuring tasks from the command-line,
you could use that for running selected tests, but you could also use it
for a bunch of other things (eg switching on showing test output on the
console, or running in debug mode, max number of forks, etc).
Perhaps:
gradle test test.includes='some/pattern/**'
test.excludes='some/other/pattern/**'
That is, we add the following:
gradle <task>.<property>=<value>
Where <task> follows the same format as gradle <task> or gradle -x <task>
We could possibly merge this with the -P option, so we would allow:
gradle -Pprop=value // sets prop on all projects
gradle prop=value // as above
gradle -Ptest.prop=value // sets the prop on all test tasks
gradle test.prop=value // as above
gradle -Pgradle-core:test.prop=value // sets the prop on
:gradle-core:test task
gradle -Pgradle-core.prop=value // sets the prop on :gradle-core projects
Adam