Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does Hilt always execute app module during instrumented test? #4354

Open
ArcherEmiya05 opened this issue Jul 13, 2024 · 3 comments
Open

Does Hilt always execute app module during instrumented test? #4354

ArcherEmiya05 opened this issue Jul 13, 2024 · 3 comments

Comments

@ArcherEmiya05
Copy link

ArcherEmiya05 commented Jul 13, 2024

I just migrated a project from Dagger to Hilt, everything works fine except when executing ./gradlew connectedAndroidTest with AVD running in a CI CD pipeline. There is this bug we are experiencing when running such tests in pipeline that we previously solved by modularizing the project so the app module no longer contains any instrumented test.

However after migrating to Hilt and using it to inject dependency in each module's instrumented test, the bug started to show again. The instrumented test on each modules are success but for some reason the task :app:connectedDebugAndroidTest is also getting executed again despite not having a androidTest.

I also tried to specify which module runs instrumented test yet it keeps running the task for app module. This does not happen when using Dagger.

./gradlew module1:connectedAndroidTest module2:connectedAndroidTest

image

> Task :AndroidCommon:connectedDebugAndroidTest

Starting 3 tests on EMU(AVD) - 6.0


Finished 3 tests on EMU(AVD) - 6.0


> Task :AndroidCommon:connectedAndroidTest


> Task :Messari:connectedDebugAndroidTest

additionalTestOutput is not supported on this device running API level 23 because the additional test output directory could not be found

Starting 29 tests on EMU(AVD) - 6.0


EMU(AVD) - 6.0 Tests 8/29 completed. (0 skipped) (0 failed)

EMU(AVD) - 6.0 Tests 16/29 completed. (0 skipped) (0 failed)

Finished 29 tests on EMU(AVD) - 6.0


> Task :Messari:connectedAndroidTest


> Task :WordPress:connectedDebugAndroidTest

additionalTestOutput is not supported on this device running API level 23 because the additional test output directory could not be found

Starting 10 tests on EMU(AVD) - 6.0


EMU(AVD) - 6.0 Tests 10/10 completed. (0 skipped) (0 failed)

Finished 10 tests on EMU(AVD) - 6.0


> Task :WordPress:connectedAndroidTest


> Task :YouTube:connectedDebugAndroidTest

additionalTestOutput is not supported on this device running API level 23 because the additional test output directory could not be found

Starting 10 tests on EMU(AVD) - 6.0


Finished 10 tests on EMU(AVD) - 6.0


> Task :YouTube:connectedAndroidTest


> Task :app:connectedDebugAndroidTest

additionalTestOutput is not supported on this device running API level 23 because the additional test output directory could not be found


Finished 0 tests on EMU(AVD) - 6.0


> Task :app:connectedDebugAndroidTest

There were failing tests. See the report at: file:///opt/atlassian/pipelines/agent/build/app/build/reports/androidTests/connected/debug/index.html


> Task :app:connectedAndroidTest

Exception thrown during onBeforeAll invocation of plugin AndroidTestApkInstallerPlugin: ErrorName: UNKNOWN

NameSpace: DdmlibAndroidDeviceController

ErrorCode: 1

ErrorType: TEST

Message: Failed to install split APK(s): [/opt/atlassian/pipelines/agent/build/app/build/outputs/apk/debug/app-debug.apk]

Failed to install split APK(s): [/opt/atlassian/pipelines/agent/build/app/build/outputs/apk/debug/app-debug.apk]

Unknown platform error occurred when running the UTP test suite. Please check logs for details.

com.android.ddmlib.ShellCommandUnresponsiveException

	at com.android.ddmlib.internal.DeviceImpl.lambda$executeRemoteCommand$18(DeviceImpl.java:891)

	at com.android.ddmlib.internal.DeviceImpl.logRun1(DeviceImpl.java:1801)

	at com.android.ddmlib.internal.DeviceImpl.executeRemoteCommand(DeviceImpl.java:755)

	at com.android.ddmlib.SplitApkInstallerBase.installCommit(SplitApkInstallerBase.java:154)

	at com.android.ddmlib.SplitApkInstaller.install(SplitApkInstaller.java:85)

	at com.android.ddmlib.IDeviceSharedImpl.installPackages(IDeviceSharedImpl.java:395)

	at com.android.ddmlib.internal.DeviceImpl.lambda$installPackages$34(DeviceImpl.java:1491)

	at com.android.ddmlib.internal.DeviceImpl.logRun3(DeviceImpl.java:1833)

	at com.android.ddmlib.internal.DeviceImpl.installPackages(DeviceImpl.java:1488)

	at com.android.ddmlib.internal.DeviceImpl.lambda$installPackages$35(DeviceImpl.java:1503)

	at com.android.ddmlib.internal.DeviceImpl.logRun3(DeviceImpl.java:1833)

	at com.android.ddmlib.internal.DeviceImpl.installPackages(DeviceImpl.java:1499)

	at com.android.tools.utp.plugins.deviceprovider.ddmlib.DdmlibAndroidDevice.installPackages(DdmlibAndroidDevice.kt:74)

	at com.android.tools.utp.plugins.deviceprovider.ddmlib.DdmlibAndroidDeviceController$executeAsync$deferred$1.invokeSuspend(DdmlibAndroidDeviceController.kt:259)

	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)

	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)

	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)

	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)

	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)

	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
@bcorso
Copy link

bcorso commented Jul 16, 2024

Hmm, I don't know.Since there's nothing in the logs hinting to Hilt or Dagger, I don't think there is anything actionable we can do with this, unfortunately.

@bcorso
Copy link

bcorso commented Jul 16, 2024

Does Hilt always execute app module during instrumented test?

Do you have a Gradle scan? That should tell you why the task is running

@ArcherEmiya05
Copy link
Author

ArcherEmiya05 commented Jul 16, 2024

Does Hilt always execute app module during instrumented test?

Do you have a Gradle scan? That should tell you why the task is running

May I know how to do this part? I am not sure if this is what you are looking for but I saw some hilt task on app module that I just didn't include in the first log.

image image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants