Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
428 views
in Technique[技术] by (71.8m points)

react native - Testing an Android .apk that's built from Expo's Turtle CLI with Detox

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

question from:https://stackoverflow.com/questions/65928667/testing-an-android-apk-thats-built-from-expos-turtle-cli-with-detox

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...