https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
d

Darryl Pierce

12/09/2023, 8:42 PM
Have a question: I'm ready to start adding unit tests for the composables in my KMP project. The project was generated from the Kotlin Multiplatform Wizard, but I'm not seeing an androidTest directory in the project. Where should I be adding these tests?
l

Lito Bumba

12/10/2023, 2:03 PM
Inside composeApp, you add new directory Like this exemple
d

Darryl Pierce

12/10/2023, 3:15 PM
I've managed to get a minimal setup by adding this to my composeApp/build.gradle.kts file, within the sourceSets block:
val androidUnitTest by _getting_ *{*
dependencies *{*
implementation(_libs_._junit_)
implementation(_libs_._kotlin_._test_)
implementation(_libs_._androidx_._test_._core_)
implementation(_libs_._androidx_._test_._junit_)
implementation(_libs_._compose_._ui_._test_._junit_)
implementation(_libs_._androidx_._espresso_._core_)
}
}
Now the issue I'm seeing is that, when I run the tests, they're not running with the Android emulator and I get: FINGERPRINT must not be null java.lang.NullPointerException: FINGERPRINT must not be null
I just feel like it shouldn't be this difficult to setup, but there's no consistency between the various example projects out there.
10 Views