steps-virtual-device-testing-for-android icon indicating copy to clipboard operation
steps-virtual-device-testing-for-android copied to clipboard

support for library projects

Open trevjonez opened this issue 7 years ago • 8 comments

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.

trevjonez avatar Aug 08 '18 20:08 trevjonez

Hi @trevjonez !

Thanks for the request. I have made a ticket for the Tooling Team. They will check it.

BirmacherAkos avatar Aug 16 '18 09:08 BirmacherAkos

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

tir38 avatar Aug 31 '18 05:08 tir38

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.

GEllickson-Hover avatar May 12 '20 21:05 GEllickson-Hover

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.

bitrise-coresteps-bot avatar Sep 24 '21 08:09 bitrise-coresteps-bot

This issue is still unresolved and should not be marked as stale automatically.

koral-- avatar Sep 24 '21 10:09 koral--

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'

hb0 avatar Sep 27 '21 09:09 hb0

I also am having this issue. The step looks for an apk in a library project, I think it should be fixed.

DevDema avatar Nov 24 '21 08:11 DevDema

@mateherber do you have any news on this? I see that @tothszabi already fixed the problem, but the change was never released ☹️

jac-usai avatar Mar 29 '23 09:03 jac-usai