[Appium Parallel Testing] Using Grid4 [Part-3] — “Test Scripting and Parallel Execution Across Multiple Devices”
Get a step-by-step walkthrough in the video below!
In this article, Learn how to configure test scripts for parallel execution across multiple devices with Appium and Selenium Grid.
π§© Topics Covered:
Topic 1: Setting Up Your Test Script for Appium Grid Execution
Topic 2: Designing a TestNG XML Suite for Parallel Device Testing
Topic 3: Running Tests Concurrently on Multiple Android/iOS Devices
Topic 4: Live Demo — Real-Time Parallel Execution in Action
Topic 1: Setting Up Your Test Script for Appium Grid Execution
For SampleTest1:
Add/Change Capability :
.setUdid → emulator-5554
Change hostip address:

For SampleTest2:
Add/Change Capability :
.setUdid → emulator-5556
Change hostip address:

Topic 2: Designing a TestNG XML Suite for Parallel Device Testing
Design a TestNG XML suite that defines separate test blocks for each device, enabling parallel execution
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite parallel="classes" name="Suite">
<test thread-count="5" parallel="classes" name="Test">
<classes>
<class name="paralleltesting.SampleTest1"/>
<class name="paralleltesting.SampleTest2"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->Topic 3: Running Tests Concurrently on Multiple Android/iOS Devices
Run your test suite across multiple devices/emulators concurrently using Appium Grid, ensuring proper port and device management to avoid conflicts.
“node.toml” file configuration:
#for server configuration
[server]
port = 4444
#for node configuration
[node]
detect-drivers = false
#for relay node configuration
[relay]
url = "http://localhost:4723/wd/hub"
status-endpoint = "/status"
#Stereotypes supported by the service
configs = [
"1", "{\"browserName\": \"chrome\", \"platformName\": \"android\", \"appium:udid\": \"emulator-5554\", \"appium:platformversion\": \"13\"}",
"1", "{\"browserName\": \"chrome\", \"platformName\": \"android\", \"appium:udid\": \"emulator-5556\", \"appium:platformversion\": \"16\"}"
]Register the grid4:
java -jar selenium-server-4.34.0.jar standalone --config node.tomlexample:

Topic 4: Live Demo — Real-Time Parallel Execution in Action
Watch a live demonstration of parallel execution in action — two devices running the same test suite simultaneously via Appium and TestNG.

GitHub Link:
π¬ Explore More! Watch My Latest Videos on YouTube!

No comments:
Post a Comment