问题描述
我想simultaneosly运行在两台设备在Android Robotium测试。我找不到任何解决方案现在...
I want to run an Android Robotium test on two devices simultaneosly. I couldn't find any solution by now...
要更precise,我有一个应用程序,test.apk至极包含多个仪器仪表类。我想运行相同的测试APK,但两者的设备在不同的测试类。我知道,我可以运行测试,只有在串行模式,与亚洲开发银行。
To be more precise, I have an application-test.apk wich contains multiple instrumentation classes. I want to run the same test apk, but different test classes on both devices. I know that I can run the tests only in serial mode, with adb.
推荐答案
您可以使用-s标志指向亚行命令到一个特定的设备。这意味着,你可以打开两个终端和使用-s标志同时运行不同的命令,他们将在这两个同时运行。这显然是那么容易改变到脚本这使它成为一个更加可扩展的解决方案。
You can use the -s flag to point an adb command to a specific device. This means that you can just open up two terminals and using the -s flag run both different commands and they will both run in parallel. It is obviously then easy to change this into a script to make it a more scaleable solution.
实例时间...
您有两个设备连接到您的计算机和两个不同的测试类要在运行运行(每):
You have two devices connected to your machine and two different test classes you want to run (one on each) on running:
adb devices
您看到
List of devices attached
SERIALOFDEVICE1 device1
SERIALOFDEVICE2 device2
然后用连续显示,那么你可以运行一个命令:
then using the serials shown you can then run a command:
adb -s SERIALOFDEVICE1 shell am instrument -w -e class com.android.foo.FooTest1 com.android.foo/android.test.InstrumentationTestRunner
adb -s SERIALOFDEVICE2 shell am instrument -w -e class com.android.foo.FooTest2 com.android.foo/android.test.InstrumentationTestRunner
其中
com.android.foo.FooTest1
com.android.foo.FooTest2
您想要的每个设备上运行的类。
Are the classes you want to run on each device.
这篇关于Java的Robotium Android的 - 在两个不同的设备上运行相同的测试simultaneosly的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!