react-nativemocha.jsjestjsdetox

detox app could not be found, did you run './gradlew assembleAndroidTest'?


I am doing detox test for react native android version 0.57. I am getting this error.

Error is

Error: 'D:\folder\android\app\build\outputs\apk\androidTest\dev\debug\app-dev-debug-androidTest.apk' could not be found, did you run './gradlew assembleAndroidTest' ?

Package.json

"android.emu.debug": {
"binaryPath": "android/app/build/outputs/apk/dev/debug/app-dev-debug.apk",
"build": "cd android && .\\gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
"type": "android.attached",
"name": "192.168.83.101:5555"

}

Error picture enter image description here


Solution

  • This error is usually caused but not having built the test apk. It can usually be resolved by running

    detox build -c android.emu.debug
    

    If you make changes to your application you should always run the above script before running any test.

    I usually run the following script to make sure that the build is uptodate before testing.

    detox build -c android.emu.debug && detox test -c android.emu.debug