and below is my android-test implementation for running UI test cases
`android-test:
working_directory: ~/code
machine:
image: android:202102-01
resource_class: large
environment:
JVM_OPTS: -Xmx2048m
GRADLE_OPTS: -Xmx1536m -XX:+HeapDumpOnOutOfMemoryError -Dorg.gradle.caching=true -Dorg.gradle.configureondemand=true -Dkotlin.compiler.execution.strategy=in-process -Dkotlin.incremental=false
steps:
- checkout
- *cache_restore
- create-gradle-file
- run:
name: Create avd
command: |
SYSTEM_IMAGES="system-images;android-29;default;x86"
sdkmanager "$SYSTEM_IMAGES"
echo "no" | avdmanager --verbose create avd -n test -k "$SYSTEM_IMAGES"
- run:
name: Launch emulator
command: |
emulator -avd test -delay-adb -verbose -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim
background: true
- *cache_save
- run:
# run in parallel with the emulator starting up, to optimize build time
name: Run assembleDebugAndroidTest task
command: |
./gradlew assembleDebugAndroidTest
- run:
name: Wait for emulator to start
command: |
circle-android wait-for-boot
- run:
name: Disable emulator animations
command: |
adb shell settings put global window_animation_scale 0.0
adb shell settings put global transition_animation_scale 0.0
adb shell settings put global animator_duration_scale 0.0
- run:
name: Run UI tests (with retry)
command: |
MAX_TRIES=2
run_with_retry() {
n=1
until [ $n -gt $MAX_TRIES ]
do
echo "Starting test attempt $n"
./gradlew connectedDebugAndroidTest && break
n=$[$n+1]
sleep 5
done
if [ $n -gt $MAX_TRIES ]; then
echo "Max tries reached ($MAX_TRIES)"
exit 1
fi
}
run_with_retry
- store_artifacts: # for display in Artifacts: https://circleci.com/docs/2.0/artifacts/
path: app/build/reports
destination: reports
- store_test_results: # for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/
path: app/build/test-results`
I am getting below error in circleci when running testcases everything is fine in android studio
`
<============-> 98% EXECUTING [1m 4s]> IDLE> IDLE> :app:connectedDebugAndroidTest> IDLE<============-> 98% EXECUTING [1m 5s]
> Task :app:connectedDebugAndroidTest FAILED
<=============> 100% EXECUTING [1m 5s]> IDLE> IDLE> IDLE> IDLE
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:connectedDebugAndroidTest'.
> There were failing tests. See the report at: file:///home/circleci/code/app/build/reports/androidTests/connected/index.html
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 6s
74 actionable tasks: 21 executed, 53 up-to-date`
I am using
And inside job specified
and below is my android-test implementation for running UI test cases
I am getting below error in circleci when running testcases everything is fine in android studio