I am picking up a project generated by Claude Code and I try to make the tests work.
I have an issue with the tests of the app module. The androidTest folder isn't recognized as a test folder, there is no green indicator on it and there is no launch icon next to the tests.
I have precised:
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
in the defaultConfig.
I have also tried to set the sourcesets manually:
sourceSets {
named("test") {
java.srcDirs("src/test/kotlin")
}
named("androidTest") {
java.srcDirs("src/androidTest/kotlin")
}
getByName("androidTest") {
kotlin.srcDirs("src/androidTest/kotlin")
java.srcDirs("src/androidTest/kotlin")
}
}
I have added the test dependencies:
androidTestImplementation("androidx.test:runner:1.7.0")
androidTestImplementation("androidx.test:rules:1.7.0")
androidTestImplementation("androidx.test.ext:junit:1.2.1")
// Optional -- UI testing with UI Automator
androidTestImplementation("androidx.test.uiautomator:uiautomator:2.4.1")
// Optional -- UI testing with Compose
androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.12.1")
Any idea how to get it recognized ? A hack using the .idea folder maybe ?
I also tried to delete the .idea folder and resync, invalidate caches and restart.
Any help is appreciated !