I'm attempting a Kotlin Compose Multiplatform project and want to write a unit test for a piece of @Composable
UI in my commonMain
project. From the references I've found online, I should be able to do the following:
@get:Rule
val compose = createComposeRule()
But I haven't been able to find the right dependency to have createComposeRule
show up as a valid function.
My current build.gradle.kts
has this (just displaying applicable points):
plugins {
kotlin("multiplatform") version "1.7.10"
id("org.jetbrains.compose") version "1.3.0"
}
kotlin {
sourceSets {
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
implementation(compose("org.jetbrains.compose.ui:ui-test-junit4"))
}
}
}
}
Is there an available dependency or version I'm missing to make createComposeRule
available, or should I be using a different type of UI test for this source set?