最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

kotlin - Android UI automation test cases specific to background task are failing in emulator created by command-line tools - St

programmeradmin1浏览0评论

I have a set of UI test cases in my project. If I run the test case in emulator (created from android studio) or device via gradlew command or android studio run configuration, all test cases are passed.

If I run the same test case in emulator (created from command-line tools), background related test cases are failing.

Command used to create emulator

cd $ANDROID_HOME/tools/bin
echo no | avdmanager create avd --force --name pixel_test_device --abi arm64-v8a --device pixel_7 --package 'system-images;android-34;google_apis_playstore;arm64-v8a'

Command to run the test case from project folder

./gradlew :app:connectedDebugAndroidTest

config.ini file of emulator created above

AvdId=pixel_test_device
PlayStore.enabled=true
abi.type=arm64-v8a
avd.ini.displayname=pixel test device
avd.ini.encoding=UTF-8
disk.dataPartition.size= 6G
fastboot.chosenSnapshotFile=
fastboot.forceChosenSnapshotBoot=no
fastboot.forceColdBoot=no
fastboot.forceFastBoot=yes
hw.accelerometer=yes
hw.arc=false
hw.audioInput=yes
hw.battery=yes
hw.camera.back=virtualscene
hw.camera.front=emulated
hw.cpu.arch=arm64
hw.cpu.ncore=4
hw.dPad=no
hw.device.hash2=MD5:3db3250dab5d0d93b29353040181c7e9
hw.device.manufacturer=Google
hw.device.name=pixel_7
hw.gps=yes
hw.gpu.enabled=yes
hw.gpu.mode=auto
hw.initialOrientation=portrait
hw.keyboard=yes
hw.lcd.density=420
hw.lcd.height=2400
hw.lcd.width=1080
hw.mainKeys=no
hw.ramSize=1536
hw.sdCard=yes
hw.sensors.orientation=yes
hw.sensors.proximity=yes
hw.trackBall=no
image.sysdir.1=system-images/android-34/google_apis_playstore/arm64-v8a/
runtimework.latency=none
runtimework.speed=full
sdcard.size=0 TB
showDeviceFrame=yes
skin.dynamic=yes
skin.name = 1080x2400
skin.path = _no_skin
skin.path.backup = ###################
tag.display=Google Play
tag.displaynames=Google Play
tag.id=google_apis_playstore
tag.ids=google_apis_playstore
vm.heapSize=228

Errors I am getting below errors for background test cases.

androidx.test.espresso.NoActivityResumedException: No activities in stage RESUMED. Did you fet to launch the activity. (test.getActivity() or similar)?
at dalvik.system.VMStack.getThreadStackTrace(Native Method)

.awaitility.core.ConditionTimeoutException: Assertion condition '(view is an instance of android.view.ViewGroup and has descendant matching an instance of android.widget.TextView and view.getText() with or without transformation to match: is "Track 1")' doesn't match the selected view.
Expected: (view is an instance of android.view.ViewGroup and has descendant matching an instance of android.widget.TextView and view.getText() with or without transformation to match: is "Track 1")
Got: no descendant matching an instance of android.widget.TextView and view.getText() with or without transformation to match: is "Track 1" was found
View Details: LibraryItemsRecyclerView{id=2131362513, res-name=library_items_recycler_view, visibility=VISIBLE, width=1080, height=1892, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@YYYYYY, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=3}
within 5 seconds.
at .awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167)
at .awaitility.core.AssertionCondition.await(AssertionCondition.java:119)
at .awaitility.core.AssertionCondition.await(AssertionCondition.java:31)
at .awaitility.core.ConditionFactory.until(ConditionFactory.java:1006)

Only background related test cases are failing. I think I missed something in emulator config set up from command-line tools, can you please help me in resolving the issue?

I tried comparing the config.ani file of emulator created from command-line tools with emulator created from android studio. But couldn't find any difference.

Also tried to run the failing test case separately instead of running all together, but still it fails.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论