mzgreen
12/31/2019, 1:28 PMcommonTest {
dependencies {
implementation kotlin('test-common')
implementation kotlin('test-annotations-common')
}
}
And then in commonTest/kotlin/
directory I have this file:
class Test {
@Test
fun foo() {
assertEquals(1,2,"Test failed")
}
}
I run it ./gradlew :common:test
and I get errors like:
> Task :common:compileDebugUnitTestKotlinAndroid FAILED
e: .../common/src/commonTest/kotlin/Test.kt: (1, 20): Unresolved reference: Test
e: .../common/src/commonTest/kotlin/Test.kt: (2, 20): Unresolved reference: assertEquals
e: .../common/src/commonTest/kotlin/Test.kt: (6, 5): 'Test' is not an annotation class
e: .../common/src/commonTest/kotlin/Test.kt: (8, 9): Unresolved reference: assertEquals
Not sure what is going on.egorand
12/31/2019, 1:31 PMTest
and assertEquals
?egorand
12/31/2019, 1:31 PMorg.junit.*
mzgreen
12/31/2019, 1:53 PMmzgreen
12/31/2019, 1:55 PMimport kotlin.test.Test
import kotlin.test.assertEquals
class Test {
@Test
fun foo() {
assertEquals(1,2,"Test failed")
}
}
If I remove deps from build.gradle then IDE doesn’t see those classes as expected. Maybe the way I run the test is wrong?mzgreen
12/31/2019, 2:08 PMcommon:compileDebugUnitTestKotlinAndroid
🤔mzgreen
12/31/2019, 2:17 PMExecuting tests
section: https://proandroiddev.com/current-issues-with-kotlin-multiplatform-and-how-to-fix-them-5ae62822a546mzgreen
12/31/2019, 2:17 PMKris Wong
12/31/2019, 2:20 PMKris Wong
12/31/2019, 2:20 PMimplementation(kotlin("test"))
implementation(kotlin("test-junit"))
Kris Wong
12/31/2019, 2:21 PMmzgreen
12/31/2019, 2:22 PM