diff -r 5986ef49853d -r ab226603d0f5 buildSrc/src/main/kotlin/AndroidTests.kt --- a/buildSrc/src/main/kotlin/AndroidTests.kt Mon May 04 16:21:57 2026 -0400 +++ b/buildSrc/src/main/kotlin/AndroidTests.kt Mon May 04 18:00:16 2026 -0400 @@ -21,8 +21,10 @@ */ package com.geekorum.build +import com.android.build.api.dsl.ApplicationExtension import com.android.build.api.dsl.CommonExtension import com.android.build.api.dsl.DefaultConfig +import com.android.build.api.dsl.LibraryExtension import com.android.build.gradle.BaseExtension import com.android.build.gradle.internal.dsl.TestOptions import org.gradle.api.Project @@ -36,28 +38,37 @@ import org.gradle.kotlin.dsl.dependencies import org.gradle.kotlin.dsl.kotlin -const val espressoVersion = "3.5.0-alpha07" // alpha for this bug https://github.com/robolectric/robolectric/issues/6593 -const val androidxTestRunnerVersion = "1.4.0" -const val androidxTestCoreVersion = "1.4.0" -const val robolectricVersion = "4.8.2" +const val espressoVersion = "3.6.1" +const val androidxTestRunnerVersion = "1.6.2" +const val androidxTestCoreVersion = "1.6.1" +const val robolectricVersion = "4.14.1" -private typealias BaseExtension = CommonExtension<*, *, DefaultConfig, *, *, *> /* * Configuration for espresso and robolectric usage in an Android project */ -@Suppress("UnstableApiUsage") internal fun Project.configureTests() { - extensions.configure("android") { - defaultConfig { - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - testInstrumentationRunnerArguments += mapOf( - "clearPackageData" to "true", - "disableAnalytics" to "true" - ) + extensions.configure("android") { + if (this is ApplicationExtension) { + defaultConfig { + testInstrumentationRunner = "com.geekorum.ttrss.HiltRunner" + testInstrumentationRunnerArguments += mapOf( + "clearPackageData" to "true", + "disableAnalytics" to "true" + ) + } + } + if (this is LibraryExtension) { + defaultConfig { + testInstrumentationRunner = "com.geekorum.ttrss.HiltRunner" + testInstrumentationRunnerArguments += mapOf( + "clearPackageData" to "true", + "disableAnalytics" to "true" + ) + } } - testOptions { + testOptions.apply { execution = "ANDROIDX_TEST_ORCHESTRATOR" animationsDisabled = true @@ -67,20 +78,20 @@ } } - dependencies { dualTestImplementation(kotlin("test-junit")) - androidTestUtil("androidx.test:orchestrator:$androidxTestRunnerVersion") + androidTestUtil("androidx.test:orchestrator:1.5.1") androidTestImplementation("androidx.test:runner:$androidxTestRunnerVersion") - dualTestImplementation("androidx.test.ext:junit-ktx:1.1.1") + dualTestImplementation("androidx.test.ext:junit-ktx:1.2.1") dualTestImplementation("androidx.test:core-ktx:$androidxTestCoreVersion") - dualTestImplementation("androidx.test:rules:$androidxTestRunnerVersion") + dualTestImplementation("androidx.test:rules:1.6.1") + // fragment testing is usually declared on debugImplementation configuration and need these dependencies constraints { debugImplementation("androidx.test:core:$androidxTestCoreVersion") - debugImplementation("androidx.test:monitor:$androidxTestRunnerVersion") + debugImplementation("androidx.test:monitor:1.7.2") } dualTestImplementation("androidx.test.espresso:espresso-core:$espressoVersion") @@ -88,12 +99,12 @@ dualTestImplementation("androidx.test.espresso:espresso-intents:$espressoVersion") // assertions - dualTestImplementation("com.google.truth:truth:1.0") - dualTestImplementation("androidx.test.ext:truth:1.3.0-alpha01") + dualTestImplementation("com.google.truth:truth:1.4.4") + dualTestImplementation("androidx.test.ext:truth:1.6.0") // mock - testImplementation("io.mockk:mockk:1.13.2") - androidTestImplementation("io.mockk:mockk-android:1.13.2") + testImplementation("io.mockk:mockk:1.13.8") + androidTestImplementation("io.mockk:mockk-android:1.13.8") testImplementation("org.robolectric:robolectric:$robolectricVersion") constraints {