https://kotlinlang.org logo
#kotest
Title
# kotest
j

Justin Tullgren

09/17/2021, 4:46 PM
Any way to get more information out of kotest? I have a test run that gets through 3 tests successfully and then just hangs (using gradle or kotest plugin).
This run is in the gradle testImplementation configuration. I have a coroutines listener to use the coroutines test dispatcher.
removing it doens't make a difference
s

sam

09/17/2021, 4:48 PM
is it just a single test that is hanging ?
j

Justin Tullgren

09/17/2021, 4:49 PM
i'll check, one second
no its not. its all types that use coroutines
tests that use coroutines
s

sam

09/17/2021, 4:50 PM
are you able to share your listener ?
j

Justin Tullgren

09/17/2021, 4:51 PM
this is clearly on my end i just can't figure out what kotest is thinking, since the timeouts never expire or throw
s

sam

09/17/2021, 4:52 PM
what is TestCoroutineDispatcher
and is Dispatchers.setMain some android thing ?
j

Justin Tullgren

09/17/2021, 4:52 PM
not just android, swing or javafx too, anything that has a Main looper for UI rendering
s

sam

09/17/2021, 4:53 PM
are you wanting to run your test on that dispatcher ?
no i am not, i manage that dispatcher in the tests (advancing time etc)
just curious why kotest waits even though there is a timeout and invocation timeout of 60 seconds
s

sam

09/17/2021, 4:55 PM
I think your listener must be changing the dispatcher for the test somehow and the coroutine kotest has created for the test is never completed
if you remove that listener does it complete the tests ?
j

Justin Tullgren

09/17/2021, 4:55 PM
no, it doesn't make a difference
already tried
s

sam

09/17/2021, 4:56 PM
I would keep that listener out for now if it's not making any difference. And I would need to see a test that is failing, perhaps you can pare down the tests until you find the one at fault
j

Justin Tullgren

09/17/2021, 4:56 PM
kk thats my plan, i was just looking for more info from kotest. thanks!
s

sam

09/17/2021, 4:56 PM
you can enable KOTEST_DEBUG=true
as an env var
j

Justin Tullgren

09/17/2021, 4:57 PM
ahh great. jvm arg?
or gradle?
s

sam

09/17/2021, 4:57 PM
env is easist
you can do sys prop too, but gradle is weird about propogating those
j

Justin Tullgren

09/17/2021, 4:57 PM
k i'll give it a go. thanks for your help
👍🏻 1
s

sam

09/17/2021, 4:59 PM
If you can get the failure down to a single test, I will be able to help you fix ti
Or fix kotest if required
j

Justin Tullgren

09/17/2021, 5:00 PM
thanks! that debug stopped on a test (started and then hung) so i am looking at it
quick question, are value/inline classes supported ?
s

sam

09/17/2021, 5:10 PM
supported for what
like just having them around in tests ?
j

Justin Tullgren

09/17/2021, 5:10 PM
just in the test body
ya
kotest 4.6.1
s

sam

09/17/2021, 5:11 PM
yeah I assume so, a test is just
suspend () -> Unit
j

Justin Tullgren

09/17/2021, 5:11 PM
kk
thanks
👍🏻 1
thanks for you help, its a mockk issue
s

sam

09/17/2021, 5:18 PM
ah interesting
j

Justin Tullgren

09/17/2021, 5:19 PM
imma keep that prop on every build unless there is a problem with doing that?
s

sam

09/17/2021, 5:19 PM
no problem if you don't mind the verbose output
j

Justin Tullgren

09/17/2021, 5:20 PM
great thanks again
8 Views