Open trevjonez opened 6 years ago
Hi @trevjonez !
Thanks for the request. I have made a ticket for the Tooling Team. They will check it.
I don't remember if I read this somewhere but I gave it a try and it has been working for us for about 3-4 months running connectedDebugAndroidTest on a library module. You just have to add a step to actually build the library module test apk. For our api
library module:
- gradle-runner:
inputs:
- mapping_file_include_filter: ''
- apk_file_include_filter: ''
- gradle_task: api:assembleDebugAndroidTest
title: Build api module instrumentation test apk
- virtual-device-testing-for-android:
inputs:
- test_devices: "$INSTRUMENTATION_DEVICE_LIST"
- test_type: instrumentation
title: Run api module instrumentation test on virtual devices
Just know that if you are going to run this for a library module and an app module in the same workflow you may experience the problem I faced in #24
I'm wondering if this is still in consideration or if there's a simple workaround. I see this issue thread relating to the Android Build for UI Testing step.
Hello there, I'm a bot. On behalf of the community I thank you for opening this issue.
To help our human contributors focus on the most relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 90 days, so I marked it as stale.
The community would appreciate if you could check if the issue still persists. If it isn't, please close it. If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me".
If no comment left within 21 days, this issue will be closed.
This issue is still unresolved and should not be marked as stale automatically.
I don't remember if I read this somewhere but I gave it a try and it has been working for us for about 3-4 months running connectedDebugAndroidTest on a library module. You just have to add a step to actually build the library module test apk. For our
api
library module:- gradle-runner: inputs: - mapping_file_include_filter: '' - apk_file_include_filter: '' - gradle_task: api:assembleDebugAndroidTest title: Build api module instrumentation test apk - virtual-device-testing-for-android: inputs: - test_devices: "$INSTRUMENTATION_DEVICE_LIST" - test_type: instrumentation title: Run api module instrumentation test on virtual devices
Just know that if you are going to run this for a library module and an app module in the same workflow you may experience the problem I faced in #24
You also have to link a random apk
next to the test apk generated or else virtual-device-testing-for-android
fails, e.g. this small apk or one you generated from a sample app of yours:
Add this step between assembleDebugAndroidTest
and virtual-device-testing-for-android
:
- script@1:
inputs:
- content: |-
#!/usr/bin/env bash
set -e
set -x
wget https://some_place_you_uploaded_the_apk_to.apk -O $BITRISE_DEPLOY_DIR/dummy.apk
envman add --key BITRISE_APK_PATH --value "$BITRISE_DEPLOY_DIR/dummy.apk"
title: 'workaround: dummy APK'
I also am having this issue. The step looks for an apk in a library project, I think it should be fixed.
@mateherber do you have any news on this? I see that @tothszabi already fixed the problem, but the change was never released ☹️
As far as I can tell this step assumes the typical apk pair or triple that you would see in an application project [main, test] or [main, test, orch]. In and module that uses com.android.library it is possible to build a single test apk which also includes the contents of the AAR library for testing.
Either I am being too lazy about reading the docs or there is not way to do this without some questionable workarounds happening.