我有一个带有selenium hub的selenium配置,这是我通过Nightwatch.js启动的firefox / chrome桌面测试的入口点。
现在我想为移动设备添加测试,所以,经过一些搜索后,我在Mac上配置了一个Appium,插入我的集线器,如下所示:
{
"capabilities": [
{
"browserName": "Safari",
"platformName": "iOS",
"platformVersion": "9.3",
"maxInstances": 1,
"platform": "MAC"
}
],
"configuration": {
"cleanUpCycle": 2000,
"timeout": 30000,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://192.168.24.222:4723/wd/hub",
"host": "192.168.24.222",
"port": 4723,
"maxSession": 1,
"register": true,
"registerCycle": 5000,
"hubPort": 4444,
"hubHost": "selenium-hub-host"
}
}
现在我想:
欢迎任何帮助,谢谢
编辑:我通过增强夜间计划任务def和appium功能的能力来实现1.和2.
On Nightwatch.js:
"ios": {
"desiredCapabilities" : {
"browserName" : "Safari",
"deviceName": "iPhone Simulator",
"platformName" : "iOS",
"platform" : "MAC",
"javascriptEnabled" : true,
"acceptSslCerts" : true
}
}
在Appium nodeconf.json上:
"capabilities": [
{
"browserName": "Safari",
"platformName": "iOS",
"platformVersion": "9.3",
"deviceName": "iPhone Simulator",
"maxInstances": 1,
"platform": "MAC"
}
]
但现在我坚持使用真正的设备,它不想在selenium hub上注册我的nodeconf(显然是无效的param):
{
"browserName": "Safari",
"platformName": "iOS",
"platformVersion": "8.1",
"deviceName": "testmac’s iPad",
"udid": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"maxInstances": 1,
"platform": "MAC"
}
答案 0 :(得分:0)
要连接多个iOS设备,您必须使用here所述的解决方法。启动Appium时必须提供其他参数:
.node -p 6001 -U --tmp /temp/dir1 &
.node -p 6002 -U --tmp /temp/dir2 &
运行Android设备不受此限制。我不知道这是不是正确的态度,但几周前它对我有用。配置文件 - huaweiG6.json:
{
"capabilities":
[
{
"browserName": "HuaweiG6",
"deviceName":"8c34fd0c5a94",
"version":"4.3",
"maxInstances": 1,
"platform":"ANDROID",
"newCommandTimeout":"30",
"deviceReadyTimeout":5
}
],
"configuration":
{
"cleanUpCycle":2000,
"timeout":10800,
"url":"http://127.0.0.1:4727/wd/hub",
"host": "127.0.0.1",
"port": 4727,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"maxSession": 1,
"register": true,
"registerCycle": 5000,
"hubPort": 4444,
"hubHost": "172.17.0.232"
}
}
用命令启动Appium:
appium --nodeconfig huaweiG6.json -p 4727 -cp 4727 -U 8c34fd0c5a94
-U参数等同于描述here的-udid。您可以通过运行来获取ID:
adb devices
安装Android SDK后可以实现。您的deviceName参数应具有相同的值。如果您在连接集线器时遇到问题,请尝试更改hubHost参数 - 它应该是正在运行的集线器实例的域或IP。
我已经通过使用来自https://github.com/michaeltamm/junit-toolbox的参赛者进行了并行测试。 Java用户的替代方案是使用Maven surefire插件http://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html
祝你好运