P0.2: Android test infrastructure (TDD foundation)
- Add androidUnitTest source set: JUnit 4, Robolectric 4.14.1, mockk, androidx.test - Add androidInstrumentedTest source set: androidx.test.ext, espresso, mockk-android - Pin Robolectric to SDK 34 (Robolectric 4.14.1 doesn't yet support compileSdk 36) - Enable includeAndroidResources for Robolectric - Canary tests green on both source sets Verifies: ./gradlew :composeApp:testDebugUnitTest ./gradlew :composeApp:compileDebugAndroidTestSources Part of Android -> iOS parity plan (rc-android-ios-parity.md). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package com.tt.honeyDue
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
class CanaryUnitTest {
|
||||
|
||||
@Test
|
||||
fun arithmetic_sanity() {
|
||||
assertEquals(2, 1 + 1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun robolectric_android_runtime_available() {
|
||||
val appContext = androidx.test.core.app.ApplicationProvider.getApplicationContext<android.content.Context>()
|
||||
assertTrue(appContext.packageName.startsWith("com.tt.honeyDue"))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
sdk=34
|
||||
Reference in New Issue
Block a user