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

Michael Vandendriessche

03/01/2022, 6:47 PM
Hi everyone, I encountered something weird with Kotest in Android Studio. I created a new project with only this test (and the kotest dependency and the useJUnitPlatform in build.gradle) and everything looks fine like in the screenshot. However in my main project the names of the describe block are not shown. Where it says
describe
and
inner describe
in the screenshot, in my main project it shows the package name (same as just under test results). So every describe string is replaced by my package name. In my main project I also had 2 dynamic tests, each in their own describe. because the string in the describe is replaced by my package name for some reason it merged the tests from both describes under the same level in the result screen in Android Studio. I commented those out but no difference. So I can see the test name, but not the describe block name. Does anyone know more about this weird behaviour and how I can fix it? The test itself looks fine. I have many more dependencies in my main project than in the new project, should be OK I guess. in testImplementation I only have mockK dependencies. AndroidTestImplementation dependencies should not matter for unit tests I guess.
Will check for replies tomorrow morning, it's almost 8pm here. Thanks!
If my problem was not clear. This is how the tests look like in my main project. The grayed out part is the packagename. You can see some tests with the same name, those are written in a separate describe block with it's own name. Since the name somehow changes to my packagename they're grouped together.
j

Jim

03/02/2022, 8:37 PM
are you saying that the tests shown in the redacted screenshots should have describe scopes around them?
m

Michael Vandendriessche

03/03/2022, 9:21 AM
@Jim Yes, those should be the "describe" and "inner describe" strings I give in the example above. It's really weird, I don't understand it. I tried restarting Android Studio and cleaning project but it still acts the same.
This is the behaviour I get in an empty project. I get a warning the test names are duplicated but they still show as separate describe blocks. While in my main project the describe blocks have a distinct name but somehow end up in the same block in the result (and their name is replaced by package name)
j

Jim

03/03/2022, 3:31 PM
I wonder if the Android plugin is messing with the kotest plugin 🤔
Can you repro in a mvp project that we can look at?