parallel test with appium & selenium grid

前端 未结 2 1203
孤街浪徒
孤街浪徒 2021-01-21 23:24

I\'m trying to run parallel test on 2 devices using appium & selenium grid but for some reason it runs only on the first node server (and first device) but nothing happen on

相关标签:
2条回答
  • 2021-01-21 23:28

    The problem is because neither have you provided anything that is unique in your DesiredCapabilities nor have you added a custom CapabilityMatcher. By default the Grid uses only the browserName, version and platform to decide which node a test is to be routed to.

    Here's one way of fixing the problem. Add a new key named "applicationName" to your nodeConfig.json and set the values of "OnePlusOne" and "SamsungS6" respectively. You then add a new capability named "applicationName" to your desired capability in your test and then set the value of "OnePlusOne" and "SamsungS6" respectively. After this your test would be routed to the correct device.

    You can read more about this in my blog post here.

    0 讨论(0)
  • 2021-01-21 23:48

    i also faced the same issue but got resolved by

    Step1: add the appium (.. \Appium\node_modules.bin) in you environment variable Step2: make the differen json for the each node.

    for node 1

     {   "capabilities":
        [
          {
            "version":"6.0",
            "maxInstances": 1,
            "platform":"ANDROID",
            "newCommandTimeout":"30",
            "deviceReadyTimeout":5
          }
        ],   "configuration":   {
        "cleanUpCycle":2000,
        "timeout":10800,
        "url":"http://127.0.0.1:4723/wd/hub",
        "host": "127.0.0.1",
        "port": 4723,
        "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
        "maxSession": 1,
        "register": true,
        "registerCycle": 5000,
        "hubPort": 4444,
        "hubHost": "127.0.0.1"   } }
    

    for node 2

     {
      "capabilities":
        [
          {
            "version":"5.0.2",
            "maxInstances": 1,
            "platform":"ANDROID",
            "newCommandTimeout":"30",
            "deviceReadyTimeout":5
          }
        ],
      "configuration":
      {
        "cleanUpCycle":2000,
        "timeout":10800,
        "url":"http://127.0.0.1:4733/wd/hub",
        "host": "127.0.0.1",
        "port": 4733,
        "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
        "maxSession": 1,
        "register": true,
        "registerCycle": 5000,
        "hubPort": 4444,
        "hubHost": "127.0.0.1"
      }
    }
    

    now for to run the hub i have made that in a batch file

    java -jar %cd%\selenium-server-standalone-2.52.0.jar -role hub http://127.0.0.1:4444/grid/console
    

    and

    for node1

    appium -a 127.0.0.1 -p 4723 --no-reset --bootstrap-port 4728 -U 192.168.56.101:5555 --nodeconfig %cd%\5555appium1.json
    

    and node 2

    appium -a 127.0.0.1 -p 4733 --no-reset --bootstrap-port 4738 -U 4d00af03525c80a1 --nodeconfig %cd%\4d00appium2.json
    

    and in you code add the deviceName:'your device name which comes on adb devices in cmd'

    This really worked for me.

    0 讨论(0)
提交回复
热议问题