Gradle Test step doesn’t work when gradlew is set at top level directory

Problem Statement:

Customers have reported that when they execute a Run Test step that uses Gradle as a build tool, the step works fine when the Gradle wrapper is set to the top level of the repo that is being cloned. This is because the gradle wrapper is set to ./gradlew as the run command.

However, if the gradle wrapper is not set to the top level in the pre-command, it will not use the gradle wrapper instead it will just run the command as gradle and create an error “gradle is not found”

Explanation:

Test intelligence assumes ./gradlew is present at the root of the project. If not, it falls back to the gradle tool to run the tests. As long as the Gradle version has test filtering support, it will be able to run test intelligence.