
This repo is a modified version of the official Appium TestNG repo. We have modified the repo for handling alerts (particulalry 'location preference alerts') that are triggered when web tests are triggered with Appium on the Safari browser.

For demonstration, we are using Appium 2.x, Selenium 4.x, and TestNG v7.7.0. Follow the steps along for package installation & test execution:
Step 1
Create a virtual environment by triggering the virtualenv venv command on the terminal
virtualenv venv

Step 2
Navigate the newly created virtual environment by triggering the source venv/bin/activate command on the terminal
source venv/bin/activate
Step 3
Procure the LambdaTest User Name and Access Key by navigating to LambdaTest Account Page. You might need to create an an account on LambdaTest since it is used for running tests on the cloud Grid.

Set LambdaTest Username and Access Key in environment variables.
- For Linux/macOS:
export LT_USERNAME="LT_USERNAME"
export LT_ACCESS_KEY="LT_ACCESS_KEY"
- For Windows:
set LT_USERNAME="LT_USERNAME"
set LT_ACCESS_KEY="LT_ACCESS_KEY"
Step 4
Run the command mvn install
(or mvn clean install
) for installing the project dependencies (i.e. Appium, TestNG, SureFire plugin, etc.)
With this, all the dependencies and environment variables are set. Let's run the tests in serial and parallel modes.
Serial test execution
Trigger the command mvn test -P ios-single
for running the Appium Java tests on iPhone 13 (v15).
Shown below is the terminal screenshot of the test execution:

As seen below, the test execution was successful and the status is "Completed". You can find the status of test execution in the LambdaTest Automation Dashboard.

Parallel test execution
Trigger the command mvn test -P ios-parallel
for running the Appium Java tests on Safari browser installed on two different iPhone devices (located on LambdaTest cloud grid).
Shown below is the terminal screenshot of the test execution:

As seen below, the test execution was successful and the status is "Completed". You can find the status of test execution in the LambdaTest Automation Dashboard.

Feel free to fork the repo and contribute to make it better! Email to himanshu[dot]sheth[at]gmail[dot]com for any queries or ping me on the following social media sites:
LinkedIn: @hjsblogger
Twitter: @hjsblogger