# Implement Parallel Testing for Mobile device for appium

**URL:** <https://discuss.appium.io/t/implement-parallel-testing-for-mobile-device-for-appium/40947>\
**Category:** Support\
**Created:** [November 30, 2023, 9:25am UTC](https://discuss.appium.io/t/implement-parallel-testing-for-mobile-device-for-appium/40947 "2023-11-30T09:25:51Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sarangi](https://discuss.appium.io/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@Sarangi](https://discuss.appium.io/u/Sarangi)\
**Post date:** [November 30, 2023, 9:25am UTC](https://discuss.appium.io/t/implement-parallel-testing-for-mobile-device-for-appium/40947/1 "2023-11-30T09:25:51Z")

</div>

Hello,  
I’m currently exploring parallel testing with Appium as well. I was wondering if you could guide me through the precise steps you’ve taken.

I’ve set up the server to start and stop programmatically, and all my capabilities are defined within a dedicated class.

I’d appreciate any insights that can provide regarding the involvement of capabilities, the instantiation of drivers in tests, and any other crucial details.

below is the details of the configuration used.

 ![21%20PM](https://discuss.appium.io/uploads/default/original/2X/4/49dd8678f5a7cba072461ab5efc35ef504a2c5af.png)

Testcase that runs looks like

public class login extends MasterTest1 {

```
@Test
public voidLogin() throws IOException {

    AndroidDriver<AndroidElement> driver = Capabilities("androidapp");

```

/Code for Tests (I am using hash maps for the mappings  
}

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![wreed](https://discuss.appium.io/letter_avatar_proxy/v4/letter/w/919ad9/32.png) [@wreed](https://discuss.appium.io/u/wreed)\
**Post date:** [November 30, 2023, 5:03pm UTC](https://discuss.appium.io/t/implement-parallel-testing-for-mobile-device-for-appium/40947/2 "2023-11-30T17:03:50Z")

</div>

Are you just going to run just 2 parallel tests? To me, if more than that you should take a serious look at Selenium Grid:

[https://appiumpro.com/editions/54-using-appium-with-selenium-grid](https://appiumpro.com/editions/54-using-appium-with-selenium-grid)

---

<div class="post-metadata">

**Author:** ![Aleksei](https://discuss.appium.io/user_avatar/discuss.appium.io/aleksei/32/6267_2.png) [@Aleksei](https://discuss.appium.io/u/Aleksei)\
**Post date:** [November 30, 2023, 6:22pm UTC](https://discuss.appium.io/t/implement-parallel-testing-for-mobile-device-for-appium/40947/3 "2023-11-30T18:22:19Z")

</div>

> [@wreed](#):
>
> should take

`Should` hardly. `May` better.

We used ONE macMini with 16 phones connected to it for 2 years. Now two macMinis with ios and android phones. Each 12-14 phones. While one macMini enough to handle 30 phones, we decided to use two - just in case. No grid.

But grid can give better benefit if you need manual QA access each phone remotedly and execute manually there anything

So at least two choices now 🙂

---

<div class="post-metadata">

**Author:** ![wreed](https://discuss.appium.io/letter_avatar_proxy/v4/letter/w/919ad9/32.png) [@wreed](https://discuss.appium.io/u/wreed)\
**Post date:** [November 30, 2023, 7:02pm UTC](https://discuss.appium.io/t/implement-parallel-testing-for-mobile-device-for-appium/40947/4 "2023-11-30T19:02:50Z")

</div>

> [@Aleksei](#):
>
> While one macMini enough to handle 30 phones

Question for you. What kind of usb hub are you using for this? Do you need to use multiple hubs?

---

<div class="post-metadata">

**Author:** ![Aleksei](https://discuss.appium.io/user_avatar/discuss.appium.io/aleksei/32/6267_2.png) [@Aleksei](https://discuss.appium.io/u/Aleksei)\
**Post date:** [November 30, 2023, 9:23pm UTC](https://discuss.appium.io/t/implement-parallel-testing-for-mobile-device-for-appium/40947/5 "2023-11-30T21:23:34Z")

</div>

Hubs with power supply like

 ![image](https://discuss.appium.io/uploads/default/original/2X/9/979eda847504a2442eb161dd3ed9a089d598827d.jpeg)

M2pro macMini i believe can hold easy 50 phones. Just need 32Gb ram machine. We did upgrade month ago one. 12 iphones running cause CPU usage about 10-15% while also running mpeg video of all phones. We record all tests. Even successful.

---

<div class="post-metadata">

**Author:** ![Sarangi](https://discuss.appium.io/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@Sarangi](https://discuss.appium.io/u/Sarangi)\
**Post date:** [December 1, 2023, 6:35am UTC](https://discuss.appium.io/t/implement-parallel-testing-for-mobile-device-for-appium/40947/7 "2023-12-01T06:35:06Z")

</div>

Thank you, @wreed!

Currently, I’m working on implementing the solution on at least two devices. My initial strategy was to succeed with this configuration, and if successful, I planned to extend it to include a greater number of devices or emulators.  
I appreciate your suggestion regarding Selenium Grid. I will delve into it more deeply. However, I was exploring alternative solutions that would allow me to bypass the grid and instead utilize TestNG parameterization or a similar approach.

I have successfully initiated an app on two emulators. However, a notable issue has arisen: only one test case executes as expected on device 2, while on device 1, after launching the app, nothing occurs. Upon reviewing the logs, I observed that when test case 2 on device 2 is running, test case 1 is also using device 2’s port, as defined in the properties file.

Key modifications made in the files to achieve this include:

1. Utilizing `@Parameters` from TestNG, I defined a set of parameters (such as `udid` , `platformname` , and port number) inside the global properties file. These parameters are then read in the capabilities.
2. Appium is automatically initiated using **AppiumDriverLocalService**.  
For detailed information, please refer to the attached Appium logs in the.

Additionally, the “Sample code(1).txt” file contains the code used for this implementation, including the MasterTest class, details of the global.properties file, and the TestNG file.  
[Sample code (1).txt](https://discuss.appium.io/uploads/short-url/mIJmCSYowx8MDOMhdnXXNOF9xvT.txt) (5.5 KB) file named

[Appium Logs - Final.txt](https://discuss.appium.io/uploads/short-url/7ESzBMRwPwYc7w3eNVVvDheGrZY.txt) (315.8 KB)

---

<div class="post-metadata">

**Author:** ![Sarangi](https://discuss.appium.io/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@Sarangi](https://discuss.appium.io/u/Sarangi)\
**Post date:** [December 1, 2023, 6:38am UTC](https://discuss.appium.io/t/implement-parallel-testing-for-mobile-device-for-appium/40947/8 "2023-12-01T06:38:48Z")

</div>

Thank you@Aleksei for the solution of hubs for the devices.

---

<div class="post-metadata">

**Author:** ![Sarangi](https://discuss.appium.io/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@Sarangi](https://discuss.appium.io/u/Sarangi)\
**Post date:** [December 1, 2023, 6:53am UTC](https://discuss.appium.io/t/implement-parallel-testing-for-mobile-device-for-appium/40947/9 "2023-12-01T06:53:53Z")

</div>

I also tried Using **`builder.withCapabilities(Capabilities("deviceconfig"))`** within the **`AppiumDriverLocalService startServer()`**  
it results in a “Connection refused” error.

The line number mentioned in error points to **`builder.withCapabilities(Capabilities(“deviceconfig”))** in startserver() and  
**appiumDriver = new AndroidDriver(new URL(“[http://127.0.0.1:4723/wd/hub](http://127.0.0.1:4723/wd/hub)”), Capabilities);** in Capabilities()  
[Using builder.capability.txt](https://discuss.appium.io/uploads/short-url/vFj3oSxJ96mxG3ivX706OgMyT0T.txt) (12.9 KB)

---

<div class="post-metadata">

**Author:** ![Sarangi](https://discuss.appium.io/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@Sarangi](https://discuss.appium.io/u/Sarangi)\
**Post date:** [December 4, 2023, 4:46am UTC](https://discuss.appium.io/t/implement-parallel-testing-for-mobile-device-for-appium/40947/10 "2023-12-04T04:46:45Z")

</div>

Hello @Aleksei @wreed Could you help me with the latest implementation that I have tried and is it the feasible way ?

---

<div class="post-metadata">

**Author:** ![Aleksei](https://discuss.appium.io/user_avatar/discuss.appium.io/aleksei/32/6267_2.png) [@Aleksei](https://discuss.appium.io/u/Aleksei)\
**Post date:** [December 4, 2023, 9:12am UTC](https://discuss.appium.io/t/implement-parallel-testing-for-mobile-device-for-appium/40947/11 "2023-12-04T09:12:47Z")

</div>

you use SAME appium port while number of appium servers should = number of devices you using.  
some examples:  
[https://www.headspin.io/blog/running-multiple-appium-tests-in-parallel](https://www.headspin.io/blog/running-multiple-appium-tests-in-parallel)  
[https://www.swtestacademy.com/appium-paralllel-testing/](https://www.swtestacademy.com/appium-paralllel-testing/)  
…

---

<div class="post-metadata">

**Author:** ![sridhar](https://discuss.appium.io/user_avatar/discuss.appium.io/sridhar/32/11437_2.png) [@sridhar](https://discuss.appium.io/u/sridhar)\
**Post date:** [December 13, 2023, 11:50am UTC](https://discuss.appium.io/t/implement-parallel-testing-for-mobile-device-for-appium/40947/12 "2023-12-13T11:50:48Z")

</div>

I am using Python , Can you please help me to find the right test script to use on mutiple ios devices to perform parrallel execution

---

<div class="post-metadata">

**Author:** ![Amir\_Zarbakhsh](https://discuss.appium.io/user_avatar/discuss.appium.io/amir_zarbakhsh/32/12030_2.png) [@Amir\_Zarbakhsh](https://discuss.appium.io/u/Amir_Zarbakhsh)\
**Post date:** [February 2, 2024, 5:42pm UTC](https://discuss.appium.io/t/implement-parallel-testing-for-mobile-device-for-appium/40947/13 "2024-02-02T17:42:32Z")

</div>

Are you running 16 devices in parallel on the system (I mean android virtual machine)!?

Because my system specifications are as follows:  
MacBook Pro (Retina, 15-inch, Mid 2014)  
2.5 GHz quad-core Intel Core i7  
16 GB DDR3 1600 MHz

But when I run 3 devices, just 3 devices in parallel, the system becomes very heavy and the programs don’t work properly and usually crash after a few minutes!!

---

<div class="post-metadata">

**Author:** ![Aleksei](https://discuss.appium.io/user_avatar/discuss.appium.io/aleksei/32/6267_2.png) [@Aleksei](https://discuss.appium.io/u/Aleksei)\
**Post date:** [February 2, 2024, 5:56pm UTC](https://discuss.appium.io/t/implement-parallel-testing-for-mobile-device-for-appium/40947/14 "2024-02-02T17:56:49Z")

</div>

> [@Amir\_Zarbakhsh](#):
>
> (I mean android virtual machine)

No. Real devices. To run 16 virtual better use several machines. Or some monsters like m2 Ultra. I bet cheap m2pro macMini faster then your similar (by price) x86 machine in times.
