Appium prallel device execution in multiple machines

@serdaraytac
from what i’m seeing, however you were able to run tests on multiple devices, it is not happening in parallel, is it?

Hi,

Please share the steps, How did you set up all the things, Since I am new to appium.

Thanks in advance!
Astha

Messaging Applications Test

1 Like

You should start an appium per real device. Appium nodes should register to your selenium grid.
Android apps can be controlled by starting activity but for iphone you must sign app or ipa with your apple developer certificate.
And it should be generated for debug on real device.

And also you can start multiple appiums on a pc no need to use virtualization.
Connect all real devices to your mac android or iphone it does not matter.

You should start appium nodes with different ports.
Android: start with different bootstrap port
IOS : start with different --tmp folder parameter

Dont use virtualbox for multiple iphones because it causes log capture deviceconsole error. Virtualbox has some usb issues. You can test multiple iphone devices on the same MAC by giving --tmp parameter.

1 Like

Hi @suayipozmen, please share the steps.

@pr4bh4sh it is just simple as you will add only tmp parameter your appium command.

appium -p 6000 --nodeconfig /Users/testinium/iphone6.json -U SDFD43523SDF --tmp /tmp/iphone6
appium -p 7000 --nodeconfig /Users/testinium/iphone5c.json -U RG435G4J6535 --tmp /tmp/iphone5c

2 Likes

You sure about this? For me the test runs are not parallel but concurrent.

All devices are connected to same machine and junit tests are started at the same time.
What do you mean by concurrent?

Sorry I meant to say sequential. I’m using parametrized junit runner (separate thread for each device), and it works perfectly for android but not ios (using your example).
Whats happening is that while tests are started at the same time, its only one test actually running at the time - the other threads are paused.

Hi All,

I am trying to run parallel test on different OS by connecting to selenium Hub.
Here is my scenario:

Hub: On Windows machine
Node1: On same window machine as HUB
Node2: On Mac Machine.

I am trying to run on Android devices connected to both the OS.
I am able to run on Windows but on MAC appium is throwing an error "Unable to load node configuration file to register with grid"

Here is my both Node files:

Node1: {
“capabilities”:
[
{
“browserName”: “Android”,
“version”:“5.1.1”,
“udid”:“052d6d76002e47df”,
“maxInstances”: 1,
“platform”:“ANDROID”,
“deviceName”:“google Nexus 5”
}],
“configuration”:

{
“nodeTimeout”:120,
“port”:4740,
“hubPort”:4444,
“proxy”: “org.openqa.grid.selenium.proxy.DefaultRemoteProxy”,
“url”:“http://127.0.0.1:4740/wd/hub”,
“hub”: “127.0.0.1:4444/grid/register”,
“hubHost”:“127.0.0.1”,
“nodePolling”:2000,
“registerCycle”:10000,
“register”:true,
“cleanUpCycle”:2000,
“timeout”:30000,
“maxSession”:1

Node2: {
“capabilities”:
[
{
“browserName”: “Android”,
“version”:“4.3”,
“udid”:“4df742b317683077”,
“maxInstances”: 1,
“platform”:“ANDROID”,
“deviceName”:“samsung GT-N7100”
}],
“configuration”:

{
“nodeTimeout”:120,
“port”:4728,
“hubPort”:4444,
“proxy”: “org.openqa.grid.selenium.proxy.DefaultRemoteProxy”,
“url”:“http://127.0.0.1:4728/wd/hub”,
“hub”: “10.123.23.123:4444/grid/register”,
“hubHost”:“10.123.23.123”,
“nodePolling”:2000,
“registerCycle”:10000,
“register”:true,
“cleanUpCycle”:2000,
“timeout”:30000,
“maxSession”:1
}
}

Could some please add a proper tutorial for connecting an appium hub to a selenium grid to the appium docs. Hunting around Stackoverflow for hints of how to get it working is not optimal.

Heres how I got my set up working.

{
  "capabilities":
  [
    {
      "browserName": "iPhone 4s"
    , "platform": "MAC"
    , "version": "7.1"
    ,  "maxInstances": 1
    }
  ],
  "configuration":
  {
    "cleanUpCycle":2000,
    "timeout":30000,
    "hub": "http://<selenium_hub:ip_or_hostname>:<selenium_hub:port>/grid/register",
    "url": "http://<appium_hub:ip_or_hostname>:<appium_hub:port>/wd/hub",
    "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
    "host": "<appium_hub:ip_or_hostname>",
    "port": <appium_hub:port>,
    "maxSession": 1,
    "register": true,
    "registerCycle": 5000,
    "hubPort": <selenium_hub:port>,
    "hubHost": "<selenium_hub:ip_or_hostname>"
    }
}

note the use of hub and url to bind the appium hub and the selenium hub to one another

start the service

appium --nodeconfig ~/appium/nodeconfig.json --tmp /tmp/iphone4s -p 4725

the ruby script

require 'selenium-webdriver'

selenium_hub_url = 'http://<selenium_hub:ip_or_hostname>:<selenium_hub:port>'

caps = Selenium::WebDriver::Remote::Capabilities.iphone
caps.browser_name = "iPhone 4s"
caps[:device] = 'iPhone 4s'
caps[:app] = 'safari'
caps[:deviceName] = 'iPhone 4s'
caps[:platformName] = 'iOS'
caps[:platformVersion] = '7.1'
caps[:browserName] = "iPhone 4s"

driver = Selenium::WebDriver.for(:remote, desired_capabilities: caps, url: selenium_hub_url)
driver.navigate.to("http://www.google.com")

Hi Suayipozmen,

The parallel execution is working without any issues for native application.

But my application is combination of both native and hybrid. To access the hybrid pages we have to use the ios_webkit_debug_proxy with 27753 port number, to run the test parallely I tried to started the ios_webkit_debug_proxy with different port number it’s not working.

The reason is not able to override the default port number.

Kindly help me to overcome the issue.

@chelladurai
Happy to hear you have successfully run multiple tests in a mac.

I haven’t tried browser testing on multiple ios devices. But i have read some issues on github it is not as simple as native application because of ios_webkit_debug_proxy port problem.

See this comment it may help you.

@suayipozmen

Thanks for sharing that link.

It resolves my issue. Now am able to execute the test parallely for ios Hybrid application’s also.

Guys,

Check this out. we have shared a framework in https://github.com/appium/appium/issues/273#issuecomment-162822796 that supports parallel execution on iOS and android using TestNG and no selenium grid concepts.

Framework URL: https://github.com/saikrishna321/AppiumTestDistribution

Let me or @saikrishna321know if you face any issues.

1 Like

@suayipozmen Nice Post. Please help me in the below scenario.

i am able to start appium with different nodes on my MAC machine.

Problem is, i am not able to point to the remote server and run my tests from eclipse.

Please help me how to run my appium tests against the remote server.

thanks,
Gopi

Hello,

Can any one please help me ,
My nodes are working on hub but when i run my script it shows on hub
13:16:06.657 INFO - Available nodes: [http://0.0.0.0:4725]
13:16:06.657 INFO - Trying to create a new session on node http://0.0.0.0:4725
13:16:06.657 INFO - Trying to create a new session on test slot {maxInstance=1, browserName=Android, version=5.0 .2 , platform=ANDROID}

but in node shows error missing plateformName and shows version name blank i can not recognize that node picking desired capabilities from where
[HTTP] --> POST /wd/hub/session {“desiredCapabilities”:{“browserName”:“android”,“version”:"",“platform”:“ANDROID”}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{“browserName”:“android”,“version”:"",“platform”:“ANDROID”},null,null,null,null,null,null,null,null,null,null,null,null,null]
[MJSONWP] Encountered internal error running command: Error: You must include a platformName capability
at AppiumDriver.getDriverForCaps (lib/appium.js:40:13)
at AppiumDriver.createSession$ (lib/appium.js:91:28)

Hi @Srikanth_Katakam: Did you get the solution for the issue? I am facing exactly same issue

http://techqarifad.blogspot.com/ follow the steps