【问题标题】:Detox - Android / iOS - Cannot run the same test on androidDetox - Android / iOS - 无法在 android 上运行相同的测试
【发布时间】:2020-08-24 09:33:36
【问题描述】:

我一直在尝试查找将在下面发布的有关此错误的信息,我进行了所有配置并进行了研究,我正在使用所有内容的最新版本。 但由于我是 Detox 的新手,我假设为 iOS 编写的测试适用于 Android,如果是,请忽略并提供有关如何适应的详细信息。

基本上我得到的错误是这样的:

detox[40905] INFO:  [test.js] configuration="android.emu.debug" reportSpecs=true readOnlyEmu=false useCustomLogger=true forceAdbInstall=false DETOX_START_TIMESTAMP=1588961953280 node_modules/.bin/jest --config e2e/config.json '--testNamePattern=^((?!:ios:).)*$' --maxWorkers 1 "e2e"
detox[40909] INFO:  [DetoxServer.js] server listening on localhost:49577...
detox[40909] ERROR: [DetoxExportWrapper.js/DETOX_INIT_ERROR]
 DetoxRuntimeError: Failed to run application on the device

HINT: Most likely, your tests have timed out and called detox.cleanup() while it was waiting for "ready" message (over WebSocket) from the instrumentation process.
    at EmulatorDriver._getInstrumentationCrashError (/Users/brunosoko/Documents/appExam/node_modules/detox/src/devices/drivers/android/AndroidDriver.js:165:12)
    at EmulatorDriver.instrumentationCloseListener (/Users/brunosoko/Documents/appExam/node_modules/detox/src/devices/drivers/android/AndroidDriver.js:128:67)
    at EmulatorDriver._terminateInstrumentation (/Users/brunosoko/Documents/appExam/node_modules/detox/src/devices/drivers/android/AndroidDriver.js:156:12)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at ChildProcess.<anonymous> (/Users/brunosoko/Documents/appExam/node_modules/detox/src/devices/drivers/android/AndroidDriver.js:274:7) {
  name: 'DetoxRuntimeError'
}
detox[40909] INFO:  Example: should show login screen after tap on Sign in button

我不知道这是一个错误还是我做错了什么。

这是我的package.json

  "detox": {
    "specs": "",
    "configurations": {
      "ios.sim.debug": {
        "binaryPath": "/Users/brunosoko/Library/Developer/Xcode/DerivedData/AppExam-cwpqhbjlywwwihfaazprzmynvoym/Build/Products/Debug-iphonesimulator/appExam.app",
        "type": "ios.simulator",
        "name": "iPhone 11"
      },
      "android.emu.debug": {
        "binaryPath": "/Users/brunosoko/Documents/AppExam/android/app/build/outputs/apk/debug/app-debug.apk",
        "type": "android.emulator",
        "name": "Pixel_3_API_R_2"
      }
    },
    "test-runner": "jest"
  },

【问题讨论】:

  • 这里要添加的另一个细节是,正如您所看到的,我将它用作黑盒测试工具,我没有应用程序的源代码与测试在同一个存储库中跨度>
  • 能否提供模拟器设备的日志?
  • 您的应用程序的包名是什么(例如 com.android.test)?另外,你能用最新的排毒重试吗?我们已经应用了一项与权限相关的重要修复,您的日志暗示了这一点。
  • 对不起!我犯了一个巨大的错误!我没有正确设置 android 应用程序,之后我没有使用 ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=debug 构建它!谢谢@d4vidi

标签: android ios react-native detox


【解决方案1】:

就我而言,问题是 DetoxTest.java 文件的路径错误。 '/com' 子目录丢失。包名:

de.dummy.example

应该是

android\app\src\androidTest\java\com\de\dummy\example

而不是:

android\app\src\androidTest\java\de\dummy\example

【讨论】:

    猜你喜欢
    • 2019-05-17
    • 2021-05-10
    • 2020-11-04
    • 2018-12-22
    • 2018-05-06
    • 1970-01-01
    • 1970-01-01
    • 2019-06-24
    • 1970-01-01
    相关资源
    最近更新 更多