嗨,任何人都可以帮助我在并行执行中启动测试脚本吗?
我应该如何在脚本中配置 Desire 功能和 webdriver 实例?
我有用 Python 和 unittest 编写的 appium 测试脚本。
我的网格已启动并正在运行,但测试脚本仅在一台设备上启动:/(如果我更改设备名称,它将在另一台设备上启动,但如何在两台设备上同时启动它?)
步骤1:
java -jar selenium-server-standalone-3.0.1.jar -role hub -hubConfig C:\selenium\hubconfig.json
第2步:
appium --nodeconfig C:\selenium\nodeconfig1.json -p 4732 -bp 5724
第 3 步:
appium --nodeconfig C:\selenium\nodeconfig3.json -p 4743 -bp 5744
ad1 - 我的 hubconfig.json:
{
"host": "127.0.0.1",
"port": 4444,
"newSessionWaitTimeout": 1,
"servlets" : [],
"prioritizer": null,
"capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
"throwOnCapabilityNotPresent": true,
"nodePolling": 5000,
"cleanUpCycle": 5000,
"timeout": 300000,
"maxSession": 4
}
ad2 - 我的 nodeconfig1.json:
{
"capabilities":
[
{
"browserName": "Samsung Galaxy S7",
"version":"6.0.1",
"maxInstances": 1,
"platform":"ANDROID"
}
],
"configuration":
{
"cleanUpCycle":2000,
"timeout":30000,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://127.0.0.1:4732/wd/hub",
"host": "127.0.0.1",
"port": 4732,
"maxSession": 1,
"register": true,
"registerCycle": 5000,
"hubPort": 4444,
"hubHost": "127.0.0.1"
}
}
ad3 - 我的 nodeconfig3.json:
{
"capabilities":
[
{
"browserName": "QUANTUM_2_400",
"version":"4.4.2",
"maxInstances": 1,
"platform":"ANDROID"
}
],
"configuration":
{
"cleanUpCycle":2000,
"timeout":30000,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://127.0.0.1:4743/wd/hub",
"host": "127.0.0.1",
"port": 4743,
"maxSession": 1,
"register": true,
"registerCycle": 5000,
"hubPort": 4444,
"hubHost": "127.0.0.1"
}
}
之后,我的 selenium 网格启动并运行两个 appium 节点和两个 android 设备,但是我应该在测试脚本中包含什么来并行运行它?
目前我正在尝试这样的事情:
self.driver = webdriver.Remote(
command_executor="http://localhost:4444/wd/hub",
desired_capabilities={
"platformName": "ANDROID",
"platformVersion": "4.4.2",
"deviceName": "QUANTUM_2_400",
"app": PATH("...apk"),
"appPackage": "",
"appActivity": ""
})