Using Appium to Run Tests on multiple physical devices at once?

Hey Guys -

I have been working on an SDK that uses BTLE to communicate with other devices. We are currently exploring testing solutions to test the matrix of communication possibilities between devices. A former engineer on the project set up his own system using Avro to control multiple devices & check their output.

I am wondering if there’s a way for me to use Appium to fire up tests on multiple physical devices at once. Any thoughts on that?

Thanks again for all that you’ve done w/ Appium. I really love working with it. I am really hoping that we can make use of it for this case.

-Tim

4 Likes

Hey,
You should setup one appium server per each device.
Here is a full explanation: http://stackoverflow.com/questions/18719755/multi-devices-support-in-android

Thank You so much for the reply. This thread was very informative : https://github.com/appium/appium/issues/462

It sounds like you can spawn multiple Appium servers on different ports connected to different devices, then have multiple capabilities in our test scripts for each device.
If I want multiple test commands running on various devices at once, I can just multi-thread them. Sounds plausible.

Thanks for the heads up!

1 Like

@vfxdrummer do you know if the same is possible for iOS devices or is it Android only?

Thanks

http://blog.zymr.com/configuring-appium-node-servers-with-selenium-grid

If you want to run automation for Android and iOS at once. Do the below setup.

Just run ur appium.js with different different address and port.

node appium.js -a 127.0.0.1 -p 8080

And

node appium.js -a 0.0.0.0 -p 4723

Set the same Address and Port in your Test Automation Script as well. And it is Done.

hello guys,

i finally achieved multi device high speed automation.

I used self developed automation server and UIAutomator handles for android and xctest handles for iOS inside device! I must say it is awesome! you may automate your device from anywhere just connect to automation server from your device!

Features achieved for iOS and Android

  1. multi device ,multi platform automation! you may automate n number of iOS and android devices at the very same time!
  2. 10 times speed achieved as compared to simple appium automation scripts!
  3. Device reset and restart achieved
  4. Intra-device(swarm) test case for multi device test cases! e.g. trading application (test includes multiple users at same time!)

Right now I am working on making this Architecture generic to use on any project and I am working on making P2P architecture.Currently it is server client architecture!

tell me if anyone need any help!

4 Likes

refer my reply I achieved this!

Hi PositiveCrux,

I am new for Appium. Please provide the setup and sample code for run Multiple devices at time.

Thanks,
Nagendar

Hi Nagendar,

Please check the below link. It provides a very basic implementation of parallel execution using Java Thread and Runnable interface. This is a very simple approach, and you would need to modify the logic if you want to hook it up with some frameworks.

Can you please tell me that maximum number of devices we can connect with appium through 1 test

@Raj_Kumar YOU CAN AUTOMATE ONE DEVICE WITH ONE SERVER OF APPIUM.
@nagendaredi If you want multiple device you need to start multiple appium servers with different PORTS and you need to create multiple clients(java threads) to support that each of the server!
I would used AKKA library to achieve this over java multithreading. you can even communicate between threads very easily and synchronize multiple test runs for even inter-device (swarm)test runs!(i.e. Device1 you do something and see its effect on Device 2!)

1 Like

Theoretically - no limitation, practically - after 6 devices we experienced problems with ADB: it starts disconnect devices, shut down, etc. Also, you need good USB hub for that thing as bad hub is a bottleneck there.

But again, one appium server - one device. so 6 devices - 6 servers.

Yeah I am also facing same problem after 4 devices some devices get disconnect.
I have a task to connect 30 devices. what can I do let me know

We can create more adb server with different port number. So can we Perform with that regarding with different adb server

Really? Did you start several ADB servers on one PC and connect devices on each one?

no but i run multiple adb server with different port number lyk ANDROID_ADB_SERVER_PORT=6789

Thanks Anish for your response.

Hi PositiveCrux,
Can you please tell me how you have setup the automation server and the setup
so that we can run multiple devices at once.

my email is [email protected].

Hi All,

Tried configuring multiple android devices getting following error message:-

org.testng.TestNGException: org.xml.sax.SAXParseException; lineNumber: 12; columnNumber: 12; The content of elements must consist of well-formed character data or markup.
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:325)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:109)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:236)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:81)
Caused by: org.xml.sax.SAXParseException; lineNumber: 12; columnNumber: 12; The content of elements must consist of well-formed character data or markup.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.startOfMarkup(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.testng.xml.XMLParser.parse(XMLParser.java:39)
at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:16)
at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:9)
at org.testng.xml.Parser.parse(Parser.java:170)
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:305)
… 3 more