2

I'm hoping to confirm my thought process when trying to test an Android application that's built with Expo's Turtle-CLI tool. I've got iOS running well, just need help getting Android working.

I have a build process that will spit out an .apk to build/android.apk. Here's the command that does that

turtle build:android \
       --output $BUILD_DIR/android.apk \
       --username $EXPO_USERNAME \
       --password $EXPO_PASSWORD \
       --config app.config.ts \
       --release-channel $RELEASE_CHANNEL \
       --type apk \
       --mode debug

This successfully outputs the .apk in build.

Here is my detoxrc.json configuration

{
  "testRunner": "jest",
  "runnerConfig": "e2e/config.json",
  "configurations": {
    "ios": {
      "type": "ios.simulator",
      "binaryPath": "build/app-native.app",
      "build": "./scripts/build_test_app ios",
      "device": {
        "type": "iPhone 11"
      }
    },
    "android": {
      "type": "android.attached",
      "binaryPath": "build/android.apk",
      "testBinaryPath": "build/android.apk",
      "build": "./scripts/build_test_app android",
      "device": {
        "adbName": "059aaa47"
      }
    }
  }
}

I then attempt to run my tests with

detox test --configuration android --loglevel trace

Which then yields (more logs at the bottom of this post)

No instrumentation runner found on device 059aaa47 for package com.foobar.mobilern

      at ADB.getInstrumentationRunner (../node_modules/detox/src/devices/drivers/android/exec/ADB.js:250:13)
      at Instrumentation.launch (../node_modules/detox/src/devices/drivers/android/tools/Instrumentation.js:19:24)
      at MonitoredInstrumentation.launch (../node_modules/detox/src/devices/drivers/android/tools/MonitoredInstrumentation.js:18:5)
      at AttachedAndroidDriver._launchInstrumentationProcess (../node_modules/detox/src/devices/drivers/android/AndroidDriver.js:284:5)
      at AttachedAndroidDriver._launchApp (../node_modules/detox/src/devices/drivers/android/AndroidDriver.js:267:7)
      at AttachedAndroidDriver._handleLaunchApp (../node_modules/detox/src/devices/drivers/android/AndroidDriver.js:120:7)
      at AttachedAndroidDriver.launchApp (../node_modules/detox/src/devices/drivers/android/AndroidDriver.js:91:12)
      at Device._doLaunchApp (../node_modules/detox/src/devices/Device.js:85:19)
      at traceCall (../node_modules/detox/src/utils/trace.js:41:20)

If I omit the testBinaryPath key from .detoxrc.json, then I get this result.

Running adb -s 059aaa47 shell pm list instrumentation on the test device yields an empty response, so I'm inclined to believe that some testing setup isn't being completed thoroughly and/or perhaps I'm thinking about this wrong.

I guess the gist of my question is, is it possible to test one .apk without having to make use of some sort of testing harness / binary?

Full Log Output

Alex_Faber
  • 117
  • 1
  • 8
  • This SO answer (https://stackoverflow.com/questions/56212792/what-is-the-gradlew-task-assembleandroidtest-and-what-are-the-test-applications) was helpful in understanding that Detox (on Android) needs an .apk for the app and an .apk for the tests. Now I just have to figure out if I can output a test .apk from Turtle-CLI (I'm not optimistic) – Alex_Faber Jan 28 '21 at 17:07
  • Hello there ... Did you managed to get this working ? I'm trying to do EXACTLY the same without luck ... At least your question point me to the parameter ``--mode debug`` of the turtle-cli which is mandatory (I think ?) for the apk to be tested by detox... Any advice is welcome ! – Seba99 May 12 '21 at 08:02
  • Unfortunately, I've not gotten this working @Seba99. I haven't gotten any responses from the team. It seems that `turtle-cli` may not be meant to do such a thing. I've decided to focus on testing iOS in the meantime. – Alex_Faber May 13 '21 at 19:42
  • Would you mind explain a bit how you would execute automated test on iOS ? You didn't build it with turtle-cli ? ( I'll start soon the worflow to deploy on iOS ... Wish me luck x) ) – Seba99 May 26 '21 at 13:01
  • I used Turtle CI to build the iOS app (since using Expo Go made detox hang from the onset of the test), and then detox to load that newly built app into the simulator for testing. – Alex_Faber May 27 '21 at 14:13

0 Answers0