TestKit: BuildResult.task(...) always returns 'null' for Gradle versions < 2.5

For Gradle versions < 2.5 the task method of BuildResult always returns null, which results in:

java.lang.NullPointerException: Cannot get property 'outcome' on null object

when used as described in the TestKit Userguide

This is probably not a bug, but simply something that can’t be done with gradle versions prior 2.5. If that is the case, please add some documentation instead (I couldn’t find any).

You are correct here. We tested and documented this behavior in Gradle version 2.11. Right now we are still in RC mode but will release the final soon. You can find the documentation of this in the user guide. Please see paragraph “Feature support when testing with different Gradle versions” for more information.