Hey all, I'm facing a strange issue, tests pass lo...
# kotest
s
Hey all, I'm facing a strange issue, tests pass locally, but fail on Server. In order to fix them, I need to know the issue of course, how ever, the output from server is only:
Copy code
io.kotest.assertions.AssertionFailedError at MyTest.kt:112
without any extra information about what was the reason. the test that is failing has only one assertion: Line 112 as mentioned in error:
Copy code
response shouldBe "ok"
1. why this assertion doesn't have more informative output? 2. how can I have a better output? Any idea ?
m
hey @Shervin have you tried
withClue
? that can be extremely helpful in these circumstances. https://kotest.io/docs/assertions/clues.html
interestingly it should also print out what the value of the response was though.. did you get that?
s
Excellent! building on server to see the actual value
strangely no info is printed:
Copy code
response.asClue {
    it.title shouldBe "ok"
}
m
hmm..
are you running this with gradle? do you know what your log settings might be?
try adding this
Copy code
tasks {
  withType<Test> {
    useJUnitPlatform()
    testLogging {
      setExceptionFormat("full")
      setEvents(listOf("passed", "skipped", "failed", "standardOut", "standardError"))
    }
  }
}
and was that kotest 5.6.1 @Shervin?
s
do I need to use
useJUnitPlatform()
when I'm using only
Copy code
io.quarkus:quarkus-junit5
for test runner ?
Kotest version is
5.5.4
m
oh you’re using quarkus.. I need to recall, I don’t know how kotest integrates for quarkus, but not too sure. hmm I’m not the expert there. How about the logging settings? as in, if you print anything into stdout or to stderr did it print out in the console?
s
building on server with your solution to see the effects right now
didn't help right now trying
Copy code
quarkus.log.category.io.quarkus.test=TRACE
and then I guess this is not a Kotest issue Kotest is probably throwing the error, but Quarkus is swallowing them.
m
right.. yeah I don’t know too much about quarkus, @Emil Kantis of the top of your head do you have any hints? I remember vaguely seeing an issue about kotest compatibility with Quarkus. would this be related?
e
I'm not using Quarkus either, but I think you still need the
useJUnitPlatform()
. It tells Gradle that you're using JUnit as a testing platform and will pick up test results from there.. Kotest integrates with JUnit to provide test results, but Gradle needs to know that it should listen for it
s
Thanks @mitch and @Emil Kantis! I am able to read the error, although it's super verbose 😄 FYI: the test was failing because of server time vs local time 😄
e
I usually add the gradle plugin
Copy code
com.adarshr.test-logger
to get prettier console output from Gradle tests
And if a test fails, I make sure to upload the gradle test reports so I can download and look at them, they'll show result, logs, stdout/stderr, etc per test
s
interesting! I will give it a try