0

我正在使用下面的代码在 AVD(Android 模拟器)上使用 monkeyrunner 按顺序执行脚本测试,我想知道是否可以在所有模拟器上并行执行脚本测试。

*listADVtotest是一个文本文件,其中包含在线模拟器的名称,对于每个模拟器,我都会调用 monkeyrunner 来执行测试。

for index, line in enumerate(listAVDtotest):
     emulatorid = listdevtotest[index][0]
     deviceid = listdevtotest[index][1]
     print "Identified device %s" % deviceid
#Execute test with monkeyrunner for each AVD
     subprocess.call('monkeyrunner -v ALL Test1.py ' + emulatorid + ' ' + deviceid + ' ' + str(index), shell=True)
4

1 回答 1

1

AndroidViewClient/culebra可以,但monkeyrunner.

culebra支持命令行选项

  -m, --multi-device               enables multi-device test generation

这使得测试的生成能够在多个设备上同时运行。例如,当您生成测试并假设单击照片图标时,将生成以下行

[_vc.findViewWithContentDescriptionOrRaise(u'''Photos''').touch() for _vc in allVcs()]

这将在所有设备上执行触摸。

这篇文章 ( http://dtmilano.blogspot.ca/2015/05/android-culebra-multi-device.html ) 有更详细的解释,还提供了一个在 3 台设备上同时运行的计算器测试的视频。此功能的显着之处在于,相同的测试可以在 3 台具有不同屏幕分辨率和不同方向的不同设备上运行。

于 2015-10-29T14:39:05.650 回答