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
[gradle-testkit-truth] More useful error messages #1068
I'm adding gradle-testkit-truth to my project and it works fine when the tests passes but when the things go wrong the message is not that useful.
With this code assertThat(buildResult).task(":lightsaberChecka").failed() I get this message error:
value of : buildResult.task(:lightsaberChecka)
expected to have a value: FAILED
but was : null
buildResult was : org.gradle.testkit.runner.internal.FeatureCheckBuildResult@3670f00
org.gradle.testkit.runner.internal.FeatureCheckBuildResult@3670f00 gives no information about what's going on.
I would print the output as the "actual" value to provide this information.
Also task(":lightsaberChecka") provides a Subject of a null instance that is not that useful. I think that something like this would improve the error message:
As you can see I have something similar implemented already but I like the idea of having a truth library for this so I can contribute to this library if you think that things like this are valuable.
I'm adding
gradle-testkit-truth
to my project and it works fine when the tests passes but when the things go wrong the message is not that useful.With this code
assertThat(buildResult).task(":lightsaberChecka").failed()
I get this message error:org.gradle.testkit.runner.internal.FeatureCheckBuildResult@3670f00
gives no information about what's going on.I would print the
output
as the "actual" value to provide this information.Also
task(":lightsaberChecka")
provides a Subject of anull
instance that is not that useful. I think that something like this would improve the error message:https://github.com/SchwarzIT/dagger-lightsaber/blob/98686ec190168c7f14fed377651c4024af8b9788/gradle-plugin/src/functionalTest/kotlin/schwarz/it/lightsaber/gradle/truth/BuildResultSubject.kt#L17-L23
With this I get error messages like this:
As you can see I have something similar implemented already but I like the idea of having a truth library for this so I can contribute to this library if you think that things like this are valuable.