On 6/06/10 10:35 AM, Peter Niederwieser wrote:
I'd like to provide the following feature to Spock&  Gradle users:

Reorder the classes in a test run such that classes that are more likely to
fail run sooner. (Test methods will also be reordered, but his happens
beneath Gradle's radar.)

I've already implemented the reordering part on the Spock side, and now I'm
looking for the right Gradle task/API hook. It seems that test class run
order is determined by DefaultTestClassScanner, DefaultConfigurableFileTree,
and ultimately DefaultDirectoryWalker. However, I haven't found a hook to
replace either of those. Any hints?

There's no hooks for anything like this yet, but it would be good to provide something.

Here's roughly how the test execution code is structured:

TestClassScanner -> TestClassDetector -> TestClassProcessor -> TestResultProcessor

* TestClassScanner produces candidate files to check for test classes.
* TestClassDetector analyses the files and produces test class names.
* TestClassProcessor executes the tests and produces test execution events. This is actually a chain of processors.

One possible hook we could provide is to allow you to provide a custom TestClassProcessor implementation, which decorates the built-in one. This would allow you to reorder tests, inject tests, filter tests, and the same for results.

One problem is that these APIs are very much internal APIs at the moment, and it's quite possible they will change again in the next few releases. An option would be to introduce a public API which looks something like TestClassProcessor, but which we can keep a bit more stable.


--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to