我有一个运行在MAC中的自动化框架,它打开一个模拟器槽Appium。我想打开多个iOS模拟器来同时运行不同的测试用例,我有哪些选择?使用appium在多个iOS模拟器上并行执行
1
A
回答
0
1 mac中1设备appium的技术限制可以通过使用Sauce Lab's移动云来解决,该设备同时运行多个模拟器/设备。你需要注册/注册使用它们
0
检查这个库https://github.com/facebook/FBSimulatorControl,它会让你能够在同一个主机上运行多个IOS模拟器。
1
由于Xcode 9和Appium 1.7,现在可以实现了。关键是wdaLocalPort
的能力。每个模拟器都需要自己的端口。
下面是一个例子,我使用的红宝石,但它会在其他语言的相似,以及:
require 'appium_lib'
opts = {
caps: {
automationName: 'XCUITest',
platformName: 'iOS',
deviceName: 'iPhone 7',
wdaLocalPort: 8001,
app: 'Example.app',
},
}
10.times do
driver = Appium::Driver.new(opts, true)
driver.start_driver.manage.timeouts.implicit_wait = 10
driver.find_element(:name, 'Button').click
driver.driver_quit
end
我不能打扰实现并发,所以你必须手动执行下一个脚本与第一个脚本同时发生。
require 'appium_lib'
opts = {
caps: {
automationName: 'XCUITest',
platformName: 'iOS',
deviceName: 'iPhone 8',
wdaLocalPort: 8002,
app: 'Example.app',
},
}
10.times do
driver = Appium::Driver.new(opts, true)
driver.start_driver.manage.timeouts.implicit_wait = 10
driver.find_element(:name, 'Button').click
driver.driver_quit
end
我还没有玩过这个太多,但是当我用了两个模拟器,我在同一时间跑了两次测试的量。看看它的规模会不会很有趣。
编辑:证明,我可以不屑于实现并发:
require 'appium_lib'
device_names = [
'iPhone 6',
'iPhone 6s',
'iPhone 7',
'iPhone 8',
]
def test(device_name, port)
opts = {
caps: {
automationName: 'XCUITest',
platformName: 'iOS',
deviceName: device_name,
wdaLocalPort: port,
app: 'Example.app',
},
}
driver = Appium::Driver.new(opts, true)
driver.start_driver.manage.timeouts.implicit_wait = 10
driver.find_element(:name, 'Button').click
driver.driver_quit
end
device_names.each_with_index do |device_name, i|
fork {
10.times do
test(device_name, 8000+i)
end
}
end
Process.waitall
以上将启动你的device_names
数组中指定,并运行在每个10个测试尽可能多的模拟器其中。我还写了一个更复杂的基准脚本。在3到4个模拟器之间,我的性能提升不到10%,所以运行超过4个似乎并不值得,但我想这取决于你的系统。
随着您启动越来越多的模拟器,您可能会用完系统资源。以下是你如何处理:https://stackoverflow.com/a/46819409/310121
相关问题
- 1. 在appium上使用IOS模拟器并行执行ios测试用例
- 2. 同一个Appium Session上的多个iOS模拟器
- 3. 在iOS模拟器上使用selenium启用/禁用Wifi/Appium
- 4. 如何使用Appium执行在iOS设备上左滑动使用Appium
- 5. Appium - 并行执行(Grid)
- 6. driver.setLocation()不适用于iOS appium模拟器
- 7. 如何使用Python和Monkeyrunner在AVD上执行并行测试Android模拟器
- 8. 开放Firefox浏览器在IOS模拟器使用Appium
- 9. 使用Jenkins Android模拟器插件运行多个模拟器
- 10. 使用React Native运行多个iOS模拟器?
- 11. 如何针对Appium/iOS模拟器运行Intern?
- 12. 运行Appium并行 - 多个Chromedrivers
- 13. 多个并发的iOS模拟器
- 14. 使用Jenkins在模拟器上运行iOS应用程序
- 15. Appium的iOS模拟器安装错误
- 16. 如何设置iOS模拟器的appium?
- 17. 试图通过genymotion模拟器运行appium时Appium错误
- 18. 我如何在Android模拟器上启动并执行Vending.apk adb
- 19. 使用CUDA并行执行多个SVD
- 20. 滚动不适用于使用appium的iOS模拟器
- 21. iOS模拟器不运行
- 22. 如何在linux机器上并行执行多个perl脚本?
- 23. 如何自动执行iPhone模拟器上执行的操作?
- 24. Appium - 并行多个Android设备
- 25. 用于在iOS模拟器上测试浏览器的Nightwatch/Appium配置
- 26. iOS应用在设备上运行,但不在模拟器中
- 27. 在iOS 10上运行Appium 1.6测试
- 28. 并行执行多个AsyncTask
- 29. 并行执行多个NSOperation
- 30. Appium并行执行不同的服务器
你可以做到这一点,但在多台Mac不在同一台Mac! –