How to run parallel test on multiple ios physical device

I try to create new sessions with different port to run parallel test on two ios physical devices with testng. But it always happen that, when the first device starts the second one will crash on starup, or when the second one starts the first one does not act any more, it shows the instrument never checked in… I really want to run parallel test on multiple devices on one mac, but I still can not find out what’s wrong.
My environment:
mac: mac os x 10.12.1
iphones: iphone6(ios 9.2) iphone6s(ios 9.3)
appium: 1.5.3

I think IOS Parellel execution is not possible (limitation from Apple) :disappointed:

Correct me If I am wrong

@SireeshaSimakurthy Nope we can run do parallel execution on real devices with appium/selenium
Limitation is you cant run ios simulators in parallel.

@Sethu, Thanks for correcting me… Can you please share details on how to do parallel execution on IOS Real device using appium / Selenium.

Hi, I made it with testng and start different appium services. Below is how I implement it.
@Parameters({ “tempDir” })
public void setup(final String tempDir) {
this.service = AppiumDriverLocalService.buildService(new AppiumServiceBuilder()
.withAppiumJS(new File("/Applications/"))
.withArgument(GeneralServerFlag.TEMP_DIRECTORY, tempDir)
.withArgument(GeneralServerFlag.LOG_LEVEL, “info”));

@Parameters({ "udid", "deviceName", "platformVersion" })
public void beforeMethod(final String udid, final String deviceName, final String platformVersion) {
	this.driver = new AppiumIOSDriver(service.getUrl().toExternalForm(), udid,
			deviceName, platformVersion);

you need to start appium with tmp folder for each device for example:
appium … /tmp/iphone6
appium … /tmp/ipad

Yes. But it still will crash after running a few test cases. When I run the code with testng, the error will occur: abnormal instrument termination.

  1. Write how you start appium with different devices
  2. Need to see logs

logs only output the error: abnormal instrument termination(the server did not provide any trace information)…
I have set show ios system log flag.

One tweek that you do is…You can Have your Appium Server started on different port & bootstrap ports inside your test beforetest annotations. Therafter you can initialize Appium Driver instance inside beforemethod annotation. Use can make use of Observer & Protype patterns to facilitate use & upgrade configurations inside beforemethod. Also use different test tag for each device ios/android devices. You need not use Appium Grid but still you will be able to execute test suite in parallel. Do revert in case of any ambiguity, will post working code if required.

Vibhu Kinger

Thanks. I made it work with testng and started different appium service. I’ve my code. And I want to know how you figure it out. Could you post part of your code?

Idea is to execute objects in different appium threads. Once using different Test tags from your TestNG & set parallel="“test” in your testng. Initialize complete objects of classes that you use in your framework & store them in a key value pair data structure. Hence for every test tag in testng xml you will end having objects for that configuration stored. Therafter your Observer Design Pattern takes over as inside every before method annotation you use updateconfiguration & load objects for that configuration from key-value pair. I hope this solves your problem!

Hi @Vibhu_Kinger,

Is it possible for you to provide step by step guidance on how to achieve this ? Basically I want to run more than one iOS devices in parallel.

Inside @BeforeTest annotation create objects for all of your framework classes inside code below i have a class named automationdriver inside constructor of which i initialize objects of all of my framework class
public class AutomationFactory
HashMap<String, Object> hmConfiguration=new HashMap<String, Object>();
public AppiumDriver driver;
public BaseInitializerHub objBaseInitializerHub;
public ObserverSubject objSubject;
public AutomationDriver automationDriver;

@BeforeTest//Here you create objects of framework classes, store them in a hashmap also here you attach objects with the resp. subject using observer pattern
public void beforeTest()
new AppiumSessionManager().startAppiumServer(IP,PORT,deviceName,logfilepath,bootstrapport);

AutomationDriver automationDriver=initializeAutomationDriver(os,logpath, PORT,appendername,configurationMap.get(InitializerConfig_),UDID_,deviceGroup,InitializerConfig_);
hmConfiguration.put(configuration, automationDriver);

public void attachSubjects(ITestContext testContext)
objSubject=new ObserverSubject();//make these global
for (ITestNGMethod method : testContext.getAllTestMethods()) {
method.setRetryAnalyzer(new MyRetryAnalyzer(objSubject));
new AppiumHelper(objSubject);//make these global
new Log(objSubject);//make these global}


@BeforeMethod**//Here you load the configuration which you want to use**
public void beforemethod()
automationDriver=(AutomationDriver) hmConfiguration.get(confiration);
driver=new AppiumSessionManager().initializeAppiumDriver(deviceName_, UDID_, platformVersion_, URL_,hubHost,hubPort,os,bundleId);


In case you create all framework objects in your test scripts than you do not need these but in case you have helpers which internally use appiumdriver than this way you can achieve parallel execution.

Hi All,

Can i Start 2 instance of iOS appium Desktop application on same MAC?

You can watch this

Please share relevant things …the video doesnt help for parallel ios device testing.