mercredi 6 mai 2015

is there any way to run an Appium automation test on specific device which using Selenium Grid?

is there any way to run an Appium automation test on specific devices which is using Selenium Grid as the hub?

For example, I have several Appium server attached to a Selenium Grid hub. each appium server assigned to several devices with mixed phone and tablet.

I want to test an application which is specified for tablet only, and the ID's of these tablet is known.

My current setup is (the position of these devices is in random):

 +-----------------------------+
 |Phone A  --- Appium Server A |
 |Phone B  --- Appium Server B |
 | ...          ...            | ---> [Selenium Grid] <--- [Test Scripts]
 |Tablet M --- Appium Server M |
 |Device N --- Appium server N |
 +-----------------------------+

At this time, when I am running a test not in parallel (for example I want to run the test on only on Tablet M), the test will be run on the first Appium server which is for Phone A, even thought on the DesiredCapability is pointed into Tablet M.

Here is my Node configuration for Tablet M and the other devices with different only on deviceName and port.

Tablet M

{
 "capabilities": [
     {
         "browserName": "Android",
         "version": "4.4",
         "maxInstances": 1,
         "platform": "ANDROID",
         "deviceName": "08e1cfd3"
     }
 ],
 "configuration": {
     "cleanUpCycle": 2000,
     "timeout": 300,
     "browserTimeout": 300,
     "hub": "http://localhost:4444/grid/register",
     "host": "localhost",
     "maxSession": 1,
     "port": 4752,
     "hubPort": 4444,
     "hubHost": "localhost",
     "url": "http://localhost:4752/wd/hub",
     "register": true,
     "registerCycle": 5000,
     "role": "node"
 }
}

Phone A

{
 "capabilities": [
     {
         "browserName": "Android",
         "version": "4.4",
         "maxInstances": 1,
         "platform": "ANDROID",
         "deviceName": "23a823e1d45f"
     }
 ],
 "configuration": {
     "cleanUpCycle": 2000,
     "timeout": 300,
     "browserTimeout": 300,
     "hub": "http://localhost:4444/grid/register",
     "host": "localhost",
     "maxSession": 1,
     "port": 4733,
     "hubPort": 4444,
     "hubHost": "localhost",
     "url": "http://localhost:4733/wd/hub",
     "register": true,
     "registerCycle": 5000,
     "role": "node"
 }
}

and in DesiredCapability:

protected DesiredCapabilities getDesiredCapabilities() {
    DesiredCapabilities cap = new DesiredCapabilities();
    cap.setCapability(CapabilityType.BROWSER_NAME, "");
    cap.setCapability("platformName", "ANDROID");
    cap.setCapability("deviceName", "08e1cfd3"); // Tablet ID
    cap.setCapability("platformVersion", "4.4");
    cap.setCapability("app", apkPath);
    cap.setCapability("appPackage", APP_PACKAGE);
    cap.setCapability("noSign", true);
    cap.setCapability("fullReset", false);
    cap.setCapability("intent-action", "android.intent.action.MAIN");

    return cap;
 }

any clue are really helpful. Thank you.

Aucun commentaire:

Enregistrer un commentaire