autonomousapps / dependency-analysis-gradle-plugin

Gradle plugin for JVM projects written in Java, Kotlin, Groovy, or Scala; and Android projects written in Java or Kotlin. Provides advice for managing dependencies and other applied plugins
Apache License 2.0
1.67k stars 115 forks source link

Improve actual output on testkit-truth #1073

Closed BraisGabin closed 6 months ago

BraisGabin commented 6 months ago

Right now when a test doesn't pass you get an output like this one:

Caused by: value of                : buildResult.task(:proj:compileJava2)
expected to have a value: FAILED
but was                 : null
buildResult was         : org.gradle.testkit.runner.internal.FeatureCheckBuildResult@1d75e7af
    at [[Reflective call: 4 frames collapsed (https://goo.gl/aH3UyP)]].(:0)
    ... 1 more

With this change we get outputs like this one that give more information:

Caused by: value of:
    buildResult.task(:proj:compileJava2)
expected to have a value:
    FAILED
but was:
    null
buildResult was:
    Calculating task graph as no cached configuration is available for tasks: proj:assemble
    > Task :proj:processResources NO-SOURCE
    > Task :proj:compileJava
    > Task :proj:classes
    > Task :proj:jar
    > Task :proj:assemble

    BUILD SUCCESSFUL in 2s
    2 actionable tasks: 2 executed
    Configuration cache entry stored.

    at [[Reflective call: 4 frames collapsed (https://goo.gl/aH3UyP)]].(:0)
    ... 1 more

This way you can see directly that the task :proj:compileJava2 was not executed but :proj:compileJava was.

Related with #1068 (doesn't close it yet, I will create some more PRs)