diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 355ec42c0..47b8af943 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -112,16 +112,14 @@ dependencies { kspTest(libs.hilt.compiler) testImplementation(projects.core.dataTest) - testImplementation(projects.core.testing) - testImplementation(projects.sync.syncTest) - testImplementation(libs.androidx.compose.ui.test) - testImplementation(libs.androidx.work.testing) testImplementation(libs.hilt.android.testing) + testImplementation(projects.sync.syncTest) testDemoImplementation(libs.robolectric) testDemoImplementation(libs.roborazzi) testDemoImplementation(projects.core.screenshotTesting) + androidTestImplementation(kotlin("test")) androidTestImplementation(projects.core.testing) androidTestImplementation(projects.core.dataTest) androidTestImplementation(projects.core.datastoreTest) diff --git a/build-logic/convention/src/main/kotlin/AndroidFeatureConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidFeatureConventionPlugin.kt index 52c337521..024ec4fe0 100644 --- a/build-logic/convention/src/main/kotlin/AndroidFeatureConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/AndroidFeatureConventionPlugin.kt @@ -30,10 +30,6 @@ class AndroidFeatureConventionPlugin : Plugin { apply("nowinandroid.android.hilt") } extensions.configure { - defaultConfig { - testInstrumentationRunner = - "com.google.samples.apps.nowinandroid.core.testing.NiaTestRunner" - } testOptions.animationsDisabled = true configureGradleManagedDevices(this) } diff --git a/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt index be5b41d07..71d818c0c 100644 --- a/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt @@ -40,6 +40,7 @@ class AndroidLibraryConventionPlugin : Plugin { extensions.configure { configureKotlinAndroid(this) defaultConfig.targetSdk = 34 + defaultConfig.testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testOptions.animationsDisabled = true configureFlavors(this) configureGradleManagedDevices(this) @@ -52,6 +53,7 @@ class AndroidLibraryConventionPlugin : Plugin { disableUnnecessaryAndroidTests(target) } dependencies { + add("androidTestImplementation", kotlin("test")) add("testImplementation", kotlin("test")) add("implementation", libs.findLibrary("androidx.tracing.ktx").get()) diff --git a/core/database/build.gradle.kts b/core/database/build.gradle.kts index 4a6bcb66a..a9e38ead7 100644 --- a/core/database/build.gradle.kts +++ b/core/database/build.gradle.kts @@ -22,10 +22,6 @@ plugins { } android { - defaultConfig { - testInstrumentationRunner = - "com.google.samples.apps.nowinandroid.core.testing.NiaTestRunner" - } namespace = "com.google.samples.apps.nowinandroid.core.database" } @@ -34,5 +30,7 @@ dependencies { implementation(libs.kotlinx.datetime) - androidTestImplementation(projects.core.testing) + androidTestImplementation(libs.androidx.test.core) + androidTestImplementation(libs.androidx.test.runner) + androidTestImplementation(libs.kotlinx.coroutines.test) } diff --git a/core/designsystem/build.gradle.kts b/core/designsystem/build.gradle.kts index bbb4ab97b..31635865c 100644 --- a/core/designsystem/build.gradle.kts +++ b/core/designsystem/build.gradle.kts @@ -46,10 +46,7 @@ dependencies { testImplementation(libs.hilt.android.testing) testImplementation(libs.robolectric) - testImplementation(libs.roborazzi) testImplementation(projects.core.screenshotTesting) - testImplementation(projects.core.testing) - androidTestImplementation(libs.androidx.compose.ui.test) - androidTestImplementation(projects.core.testing) + androidTestImplementation(libs.bundles.androidx.compose.ui.test) } diff --git a/core/screenshot-testing/build.gradle.kts b/core/screenshot-testing/build.gradle.kts index fb23cf057..1b816fc67 100644 --- a/core/screenshot-testing/build.gradle.kts +++ b/core/screenshot-testing/build.gradle.kts @@ -24,11 +24,10 @@ android { } dependencies { + api(libs.bundles.androidx.compose.ui.test) api(libs.roborazzi) implementation(libs.androidx.compose.ui.test) implementation(libs.androidx.activity.compose) - implementation(libs.androidx.compose.ui.test) implementation(libs.robolectric) - implementation(projects.core.common) implementation(projects.core.designsystem) } diff --git a/core/testing/build.gradle.kts b/core/testing/build.gradle.kts index 02729ceff..90f2405a4 100644 --- a/core/testing/build.gradle.kts +++ b/core/testing/build.gradle.kts @@ -15,7 +15,6 @@ */ plugins { alias(libs.plugins.nowinandroid.android.library) - alias(libs.plugins.nowinandroid.android.library.compose) alias(libs.plugins.nowinandroid.android.hilt) } @@ -24,19 +23,15 @@ android { } dependencies { - api(kotlin("test")) - api(libs.androidx.compose.ui.test) + api(libs.kotlinx.coroutines.test) api(projects.core.analytics) + api(projects.core.common) api(projects.core.data) api(projects.core.model) api(projects.core.notifications) - debugApi(libs.androidx.compose.ui.testManifest) implementation(libs.androidx.test.rules) implementation(libs.hilt.android.testing) - implementation(libs.kotlinx.coroutines.test) implementation(libs.kotlinx.datetime) - implementation(projects.core.common) - implementation(projects.core.designsystem) } diff --git a/core/ui/build.gradle.kts b/core/ui/build.gradle.kts index 5d8a65d44..5606cb5d1 100644 --- a/core/ui/build.gradle.kts +++ b/core/ui/build.gradle.kts @@ -20,9 +20,6 @@ plugins { } android { - defaultConfig { - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - } namespace = "com.google.samples.apps.nowinandroid.core.ui" } @@ -36,5 +33,6 @@ dependencies { implementation(libs.coil.kt) implementation(libs.coil.kt.compose) + androidTestImplementation(libs.bundles.androidx.compose.ui.test) androidTestImplementation(projects.core.testing) } diff --git a/docs/images/graphs/dep_graph_core_screenshot_testing.svg b/docs/images/graphs/dep_graph_core_screenshot_testing.svg index 997654f40..a7d58b0ea 100644 --- a/docs/images/graphs/dep_graph_core_screenshot_testing.svg +++ b/docs/images/graphs/dep_graph_core_screenshot_testing.svg @@ -1,25 +1,17 @@ - + - + - - :core:screenshot-testing + + :core:screenshot-testing - - :core:common + + :core:designsystem - - - - - - :core:designsystem - - - - + + diff --git a/docs/images/graphs/dep_graph_core_testing.svg b/docs/images/graphs/dep_graph_core_testing.svg index 9dfc695e1..d441858e5 100644 --- a/docs/images/graphs/dep_graph_core_testing.svg +++ b/docs/images/graphs/dep_graph_core_testing.svg @@ -1,129 +1,121 @@ - + - + - - :core:testing + + :core:testing - - :core:analytics + + :core:analytics - - + + - - :core:data - - - - - - - - :core:model + + :core:common - - + + - - :core:notifications + + :core:data - - - + + + - - :core:common + + :core:model - - + + - - :core:designsystem + + :core:notifications - - + + - - + + - - + + - - + + - - :core:database + + :core:database - - + + - - :core:datastore + + :core:datastore - - + + - - :core:network + + :core:network - - + + - - + + - - + + - - + + - - + + - - + + - - :core:datastore-proto + + :core:datastore-proto - - + + - - + + - - + + diff --git a/feature/bookmarks/build.gradle.kts b/feature/bookmarks/build.gradle.kts index 4e97176a2..51a15ce7a 100644 --- a/feature/bookmarks/build.gradle.kts +++ b/feature/bookmarks/build.gradle.kts @@ -29,5 +29,6 @@ dependencies { testImplementation(projects.core.testing) + androidTestImplementation(libs.bundles.androidx.compose.ui.test) androidTestImplementation(projects.core.testing) } diff --git a/feature/foryou/build.gradle.kts b/feature/foryou/build.gradle.kts index fd41d9a13..004fe8ad6 100644 --- a/feature/foryou/build.gradle.kts +++ b/feature/foryou/build.gradle.kts @@ -33,8 +33,8 @@ dependencies { testImplementation(libs.hilt.android.testing) testImplementation(libs.robolectric) testImplementation(projects.core.testing) - testImplementation(projects.core.screenshotTesting) - testDemoImplementation(libs.roborazzi) + testDemoImplementation(projects.core.screenshotTesting) + androidTestImplementation(libs.bundles.androidx.compose.ui.test) androidTestImplementation(projects.core.testing) } diff --git a/feature/interests/build.gradle.kts b/feature/interests/build.gradle.kts index ee6aaf122..ca91ba2c4 100644 --- a/feature/interests/build.gradle.kts +++ b/feature/interests/build.gradle.kts @@ -29,5 +29,6 @@ dependencies { testImplementation(projects.core.testing) + androidTestImplementation(libs.bundles.androidx.compose.ui.test) androidTestImplementation(projects.core.testing) } diff --git a/feature/search/build.gradle.kts b/feature/search/build.gradle.kts index 98052e9ab..c5f1f6ad0 100644 --- a/feature/search/build.gradle.kts +++ b/feature/search/build.gradle.kts @@ -31,6 +31,7 @@ dependencies { testImplementation(projects.core.testing) + androidTestImplementation(libs.bundles.androidx.compose.ui.test) androidTestImplementation(projects.core.testing) } diff --git a/feature/settings/build.gradle.kts b/feature/settings/build.gradle.kts index 4b9a72bdd..15d65204d 100644 --- a/feature/settings/build.gradle.kts +++ b/feature/settings/build.gradle.kts @@ -31,5 +31,5 @@ dependencies { testImplementation(projects.core.testing) - androidTestImplementation(projects.core.testing) + androidTestImplementation(libs.bundles.androidx.compose.ui.test) } diff --git a/feature/topic/build.gradle.kts b/feature/topic/build.gradle.kts index d457b2f73..726920af1 100644 --- a/feature/topic/build.gradle.kts +++ b/feature/topic/build.gradle.kts @@ -29,5 +29,6 @@ dependencies { testImplementation(projects.core.testing) + androidTestImplementation(libs.bundles.androidx.compose.ui.test) androidTestImplementation(projects.core.testing) } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c35d756da..9fe235681 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -60,6 +60,9 @@ secrets = "2.0.1" truth = "1.4.2" turbine = "1.1.0" +[bundles] +androidx-compose-ui-test = ["androidx-compose-ui-test", "androidx-compose-ui-testManifest"] + [libraries] accompanist-permissions = { group = "com.google.accompanist", name = "accompanist-permissions", version.ref = "accompanist" } android-desugarJdkLibs = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "androidDesugarJdkLibs" }