This is a robust and scalable mobile automation testing framework built using Java, Appium, TestNG, and the Page Object Model (POM) design pattern. It supports modular test writing, parallel execution, and easy integration with CI/CD tools.
project-root/
│
├── appfiles/ # APKs or apps under test
├── reports/ # HTML reports after test execution
├── screenshots/ # Screenshots captured on test failure
│
├── src/
│ ├── main/
│ │ ├── java/com/app/
│ │ │ ├── base/ # BasePage class
│ │ │ ├── config/ # Configuration setup
│ │ │ ├── constants/ # Element identifiers or test constants
│ │ │ ├── drivers/ # Appium driver setup and capability reader
│ │ │ ├── pages/ # Page Object Model (POM) classes
│ │ │ └── utils/ # Logger and other utilities
│ │ └── resources/
│ │ ├── config/ # Device and logging config
│ │ ├── logs/ # Generated log files
│ │ └── testdata/ # External test data (JSON, CSV, etc.)
│
│ └── test/
│ ├── java/com/app/
│ │ ├── base/ # BaseTest setup class
│ │ └── tests/ # Test classes
│ └── resources/
│ └── testng.xml # TestNG suite file
│
├── target/ # Maven-generated output files
├── .gitignore # Git ignored files
- Java 11 or later
- Maven
- Android SDK + emulator or real device
- Appium installed and running
- Node.js and npm (for Appium installation)
- IDE: IntelliJ IDEA / Eclipse
# 1. Clone the repository
git clone https://github.com/sandipchopkar95/Java_Appium_TestNG_POM_DemoApp.git
cd Java_Appium
# 2. Install Maven dependencies
mvn clean install
- Install Appium globally:
npm install -g appium
- Start Appium server:
appium
- Verify connected devices:
adb devices
Make sure at least one emulator or real device is connected.
- Open
src/test/resources/testng.xml
in your IDE. - Right-click and select Run.
mvn clean test
This will:
- Read from
testng.xml
- Start Appium driver
- Launch the app on the connected device/emulator
- Run the tests and generate reports
Located in src/main/resources/config/
, this file contains:
{
"platformName": "Android",
"deviceName": "emulator-5554",
"platformVersion": "13.0",
"appPackage": "com.example.app",
"appActivity": ".MainActivity"
}
📌 Update this based on your target app and device.
- Logs:
src/main/resources/logs/
- Screenshots on failure:
screenshots/
- Reports:
reports/
(can be enhanced using extent reports)
This project is CI/CD friendly. You can integrate it with Jenkins, GitHub Actions, or GitLab CI. Here's a basic Jenkins command:
mvn clean test -DsuiteXmlFile=testng.xml
- Page Object Model (POM)
- Data-driven testing (via JSON or external files)
- Driver Factory Pattern
- Keep locators and test logic separated.
- Use constants for identifiers (see
ProductPageConstants.java
). - Create reusable page methods.
- Log every action (see
LoggerUtility.java
). - Keep test data external (JSON/CSV).