My personal experience is that it's super hard to test at that level and also there is stuff you are not able to test like build cache, incremental build, different Gradle versions, etc... I either rely on:
• Unit test for individual methods that do not depend on the Gradle API/environment
• Integration tests using
GradleRunner
for everything else