Written: August 22, 2026
Parallel Appium work needs isolation: each session gets its own driver, Appium server port (or node), and device/UDID capabilities. Sharing one driver across threads is the fastest way to flake tests.
Start small — two devices or two emulators — and prove that each test owns its session lifecycle (create in @Before, quit in @After).
What must be unique per session
- deviceName / udid
- systemPort (Android) or wdaLocalPort (iOS)
- Appium server URL/port if you run multiple servers
- Optional: app package/activity or bundleId when apps differ
Java sketch
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("platformName", "Android");
caps.setCapability("udid", System.getenv("DEVICE_UDID"));
caps.setCapability("systemPort", Integer.parseInt(System.getenv("SYSTEM_PORT")));
URL url = new URL("http://127.0.0.1:" + System.getenv("APPIUM_PORT"));
AndroidDriver driver = new AndroidDriver(url, caps);
try {
// test steps
} finally {
driver.quit();
}
Practical tips
Drive parallelism from the build tool (TestNG parallel=”tests” or JUnit with distinct env vars per worker), not from static shared WebDriver fields.
Log udid + ports in every failure screenshot so you can see which device actually failed.
Keep learning
If this walkthrough on multiple appium sessions java helped, open the code again and change one input or assumption. Small experiments beat rereading the same example.
Want more step-by-step tutorials like this? Browse blog.xqa.io — and tell us which topic you want next.