我目前正在尝试让我的Instrumentation tests使用GitHub Actions运行。我的单元测试运行良好,但似乎无法运行Espresso测试。我目前正在尝试:
- name: Run Instrumentation Tests (reactivecircus)
uses: reactivecircus/[email protected]
with:
api-level: 23
target: default
arch: x86
profile: Nexus 6
script: ./gradlew connectedCheck --stacktrace
我得到结果:
com.balsdon.ratesapp.behaviour.RateListActivityEntryBehaviourInstrumentedTest > recyclerViewClickOnItemChangesMain[test(AVD) - 6.0] FAILED
android.content.res.Resources$NotFoundException: Resource ID #0x7f0700d3
at android.content.res.Resources.getValue(Resources.java:1351)
Tests on test(AVD) - 6.0 failed: Instrumentation run failed due to 'android.content.res.Resources$NotFoundException'
> Task :app:connectedOfflinemockDebugAndroidTest FAILED
> Task :app:processOnlineecbDebugAndroidTestResources
> Task :app:processProductionDebugAndroidTestResources
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:connectedOfflinemockDebugAndroidTest'.
> There were failing tests. See the report at: file:///Users/runner/runners/2.165.2/work/currency_list_app/currency_list_app/app/build/reports/androidTests/connected/flavors/OFFLINEMOCK/index.html
以及当我使用时:
- uses: malinskiy/action-android/emulator-run-cmd@release/0.0.5
with:
cmd: ./gradlew integrationTest
api: 23
tag: default
abi: x86
我知道
/Users/runner/android-sdk/platform-tools/adb -s emulator-5554 shell getprop sys.boot_completed
error: device 'emulator-5554' not found
The process '/Users/runner/android-sdk/platform-tools/adb' failed with exit code 1
如果您想查看所有尝试,可以查看所有提交on my pull request
您在本地运行的仿真器版本,它很可能比API 23
android版本新。在github actions script上,您正在使用API 23
运行仿真器:
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 23
target: default
arch: x86
profile: Nexus 6
script: ./gradlew connectedCheck --stacktrace
并且在您的项目中,内部资源为app/src/main/res/drawable-v24
,因此它对于具有< 24 API
版本的模拟器将不可用。您要么必须将该目录更改为drawable-v23
,要么将资源移动到较旧版本可以访问的其他drawable
。
即使您将drawable目录更改为drawable-v23
,Espresso可能仍需要解决该版本的问题,或者您必须为您使用更新的API版本,Github操作模拟器可能与您使用的版本相同您的开发环境。
您在本地运行的仿真器版本,它很可能比API 23
android版本新。在github actions script上,您正在使用API 23
运行仿真器:
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 23
target: default
arch: x86
profile: Nexus 6
script: ./gradlew connectedCheck --stacktrace
并且在您的项目中,内部资源为app/src/main/res/drawable-v24
,因此它对于具有< 24 API
版本的仿真器将不可用。您要么必须将该目录更改为drawable-v23
,要么将资源移动到较旧版本可以访问的其他drawable
。
即使您将drawable目录更改为drawable-v23
,Espresso可能仍需要解决该版本的问题,或者您必须为您使用更新的API版本,Github操作模拟器可能与您使用的版本相同您的开发环境。