Smart Testing

summary: Incremental Testing, Scheduling based on quickest possible feedback. Preemptive testing via the daemon. status: Discussions are happening and we will iteratively add features in this area after 1.0. code: planned

Smart testing is part of a general strategy to optimize the change code - run tests loop which a developer runs many times a day. Gradle will provide incremental testing, where tests are re-executed only when the code which affects them changes. For example, if the developer changes a functional test, only that test needs to be executed again, whereas if they change a production class, all the functional tests might need to be re-executed. This allows the developer to run tests, and then fix any broken tests, and continue from where they left off, running only the smallest possible set of tests to cover the changes.

Gradle will also schedule tests so as to provide the quickest possible feedback. For example, Gradle might run tests which break the most frequently first. Or Gradle might run the tests which provide the broadest coverage first.

Finally, the build daemon opens up some interesting possibilities for smart testing. The build daemon will be able to preemptively run tests and other checks in the background, as it notices that source files have changed. This would work nicely with IDE integration, to provide feedback in the IDE (or with some other notification mechanism like Growl).

This would be a huge benefit that would compare to guard running tests in the ruby world. Can’t wait to see this being implemented in gradle.

This sounds very similar to infinitest