Support for automating multiple devices simultaneously:

appium - 1.2.2
Can we automate multiple android devices in a single session of appium?

was able to automate multiple devices in different sessions i.e., on different ports

by defining two drivers

want to know if there is way to do in a single session so that one statement can be executed on both the device at the same time simultaneously

than having to wait for a statement execution from a different driver

I think you may use Selenium Grid with Appium to run tests in parallel.

Selenium Grid may have some issues I’m about to post some bugs that I have found.

Can you Please suggest how to run multiple device with different session and with different port .
we can’t able to make it .
Please help us to make it possible

Here you can find details about what should be done to run Android devices simultaneously:
http://appium.io/slate/en/master/?java#parallel-android-tests
Unfortunately, it’s not working for iOS devices.

So you could do this manually, via script, CI tool or using java.

My java example, it’s not the best solution ever, however it may helps you:

public void startAppium() {
    //start appium instance
    try {
        Thread.sleep((long)(Math.random() * 10000)); //wait from 0 to 10 sec for parallel process run
        ProcessBuilder builder = new ProcessBuilder(getCmd());
        builder.redirectOutput("path to log file"); //here you can find logs of appium
        builder.redirectErrorStream(true);
        appium = builder.start();
        Thread.sleep(3000); //wait 3 sec until server started
    } catch (Exception e) {
        e.printStackTrace();
    }
}

private List getCmd(){
//create cmd by adding each param
List cmd = new ArrayList();
cmd.add(“node”);
cmd.add(“path to appium folder”);
cmd.add("-a");
cmd.add(“ip address”);
cmd.add("-p");
cmd.add(“appium port”);
cmd.add("-bp");
cmd.add(“bootstrap port”);
cmd.add("-U");
cmd.add(“udid”);
cmd.add("–chromedriver-port");
cmd.add(“chrome port”);
return cmd;
}

public void stopAppium(){
//stop appium instance
appium.destroy();
}

Watch my videos. May be it will help you to solve you issues


Hi,

If you don’t want to set up (and administrate) different appium endpoints in your test project, you may want to give a try to this tool I wrote: Appium Proxy.

Basically, it’s a python script that starts a web proxy, hooks to session creation requests and distributes the handling of the sessions among different appium server instances. So you can use a single endpoint in your tests configuration.

It’s just a PoC but works for me (at least for what I need).

Regards!

Seba.

Hi Sendlink,

Can you help me how to run multiple tests on multiple devices with different appium sessions?

It can be great if you can tell me list out the steps you followed?

Thanks,
Uday

Hi @UD,
Were you able to run tests on multiple devices. I need to run mobile web test on android phone as well as on iPhone. So is there any way to do so parallely?

Any help would be appreciated.

Hi,

I am trying to run a test script written in ruby on multiple devices.
I am not able to run the scripts in parallel.

what I have tried:

  1. launch and start multiple appium server isntances with different ports (appium port, chromedriver, bootstrap-port & selendroid-port.
    this works fine and servers have started

  2. however when I create driver, multiple drivers are created, but test script runs on only the first device (first device detected on adb) , it never runs on the second device.

this is how I start the server:
node.exe Appium.js --address 127.0.0.1 --port # {a} --chromedriver-port --bootstrap-port # {} --selendroid-port #{} --device-name F9AZCY00U236 --no-reset --local-timezone"

capabilities:

desired_caps = {
# caps: {
platformName: ‘Android’,
device: ‘Android’,
deviceName:‘F9AZCY00U23’,
app: “#{Dir.pwd}/abc.apk”,
browserName: ‘’,
appWaitActivity: “Activity name”,
newCommandTimeout: 120

}

}

Appium::Driver.new(desired_caps,config).start_driver

Appium::Driver.new({caps: desired_caps,appium_lib: { server_url: ‘http://127.0.0.1:a/wd/hub’ }}).start_driver

Please let me know what I am missing.

have you already resolved this? encountering it currently.

Hi,

You need to make sure that you pass device UDID (or device Id), and not the deviceName property. Appium can distinguish between devices only when you provide UDID. Check the code in the below article. It will give an idea of how this can be done. You can implement it with Java Thread, TestNG or any other way you want.

Appium Parallel Execution on multiple devices

Regards,
Anish