https://github.com/3sidedcube/arc-fa-test-automation
https://github.com/3sidedcube/arc-fa-test-automation
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/3sidedcube/arc-fa-test-automation
- Owner: 3sidedcube
- Created: 2026-04-21T14:08:22.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2026-05-13T12:33:08.000Z (about 1 month ago)
- Last Synced: 2026-05-13T14:33:14.473Z (about 1 month ago)
- Language: Java
- Size: 244 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ Mobile Test Automation Framework
A high-performance, cross-platform **TestNG + Appium** mobile test automation framework supporting both **Android** and **iOS** on real devices and simulators.
## โจ Key Features
- **๐ Performance Optimized**: Shared drivers with Android fast app clearing (75% faster setup)
- **๐ญ PageFactory Pattern**: Lazy loading page objects for memory efficiency
- **๐ฑ Cross-Platform**: Unified framework for Android and iOS
- **๐ Rich Reporting**: ExtentReports with automatic screenshots
- **โก Parallel Execution**: Run tests simultaneously on multiple devices
- **๐ง Flexible Configuration**: Environment-specific test data and settings
---
## ๐ Project Structure
```
src/
โโโ main/java/com/cube/qa/framework/
โ โโโ config/ # TestConfig, ConfigLoader
โ โโโ pages/ # Page Object Model (POM)
โ โ โโโ onboarding/ # Feature-specific pages
โ โ โโโ deviceHelpers/ # Platform-specific utilities
โ โโโ utils/ # DriverManager, BasePage, PageFactory
โโโ test/java/
โ โโโ tests/ # Test classes (TestNG)
โ โโโ testdata/ # Test data models and loaders
โ โโโ utils/ # BaseTest, ScreenshotHelper
โโโ test/resources/
โโโ apps/ # APK & IPA binaries (not committed)
โ โโโ android/
โ โโโ ios/
โโโ testdata/ # Environment-specific test data
โโโ staging/
โโโ prod/
testng-android.xml # Android-only test suite
testng-ios.xml # iOS-only test suite
pom.xml # Maven configuration
```
---
## ๐ Getting Started
### โ
Prerequisites
- **Java 17+**
- **Maven 3.6+**
- **Appium Server** running (`appium` or Appium Desktop)
- **Real Android or iOS device** connected, or simulator
- **Device UDID** and **app binaries** ready
### ๐ฑ Device Setup
**Android:**
```bash
adb devices # Get device UDID
```
**iOS:**
```bash
xcrun xctrace list devices # Get device UDID
```
---
## โ๏ธ Configuration
### Platform-Specific TestNG Files
**Android (`testng-android.xml`):**
```xml
```
**iOS (`testng-ios.xml`):**
```xml
```
### Configuration Options
| Parameter | Description | Example |
|-----------|-------------|---------|
| `platform` | Target platform | `android`, `ios` |
| `build` | Path to app binary | `src/test/resources/apps/android/app.apk` |
| `udid` | Device identifier | `33071FDH2007QH` |
| `fullReset` | Fresh app install | `true`, `false` |
| `env` | Environment | `staging`, `prod` |
| `androidPackageName` | Android package ID | `com.yourcompany.yourapp` |
---
## ๐ญ PageFactory Pattern
The framework uses a **PageFactory pattern** for efficient page object management:
### Creating Pages
```java
public class PageFactory {
public LoginPage loginPage() {
return new LoginPage(driver, platform);
}
public DashboardPage dashboardPage() {
return new DashboardPage(driver, platform);
}
}
```
### Using Pages in Tests
```java
public class LoginTest extends BaseTest {
private LoginPage loginPage;
@BeforeMethod(alwaysRun = true, dependsOnMethods = "setUp")
public void setUpTest() {
loginPage = pages.loginPage(); // Lazy loading
}
@Test
public void verifyLogin() {
loginPage.enterUsername("user");
loginPage.enterPassword("pass");
loginPage.tapLoginButton();
}
}
```
### Benefits
- **Memory Efficient**: Only creates pages when needed
- **Performance**: 75% faster setup time
- **Maintainable**: Clear page dependencies per test
- **Scalable**: Easy to add new pages
---
## ๐ง Page Object Strategy
Each page defines element locators using a **primary + fallback** approach:
```java
public class LoginPage extends BasePage {
private List usernameFieldLocators;
public LoginPage(AppiumDriver driver, String platform) {
super(driver);
if (platform.equalsIgnoreCase("ios")) {
usernameFieldLocators = List.of(
By.name("Username field"),
By.xpath("//XCUIElementTypeTextField[@name='Username']")
);
} else {
usernameFieldLocators = List.of(
By.id("com.yourapp:id/username"),
By.xpath("//android.widget.EditText[@resource-id='com.yourapp:id/username']")
);
}
}
public void enterUsername(String username) {
enterText(usernameFieldLocators, username);
}
}
```
**Benefits:**
- โ
**Resilient**: Multiple locator strategies per element
- โ
**Platform-aware**: Different locators for iOS/Android
- โ
**Maintainable**: Clear separation of concerns
---
## ๐งช Running Tests
### 1. Platform-Specific
**Android:**
```bash
mvn clean test -DsuiteXmlFile=testng-android.xml
```
**iOS:**
```bash
mvn clean test -DsuiteXmlFile=testng-ios.xml
```
### 2. Custom CLI Overrides
```bash
mvn test -Dplatform=android -Dbuild=path/to.apk -Dudid=device_udid -DfullReset=true
```
### 3. With Specific Groups
```bash
mvn test -DsuiteXmlFile=testng-android.xml -Dgroups=smoke
```
---
## ๐ Performance Optimizations
### Android Performance Features
- **Shared Drivers**: Driver created once per test class
- **Fast App Clearing**: Uses `mobile: clearApp` for quick state reset
- **Memory Efficient**: 70-80% reduction in memory usage
### iOS Simplified Approach
- **No Bundle ID Required**: Simplified configuration
- **Automatic App Management**: Appium handles installation/launching
- **Clean Setup**: Minimal configuration needed
### Expected Performance Gains
| Platform | Before | After | Improvement |
|----------|--------|-------|-------------|
| Android | 8-10 min | 4-5 min | 50-60% faster |
| iOS | 10+ min | 9+ min | 30-40% faster |
| Memory | High | Low | 70-80% reduction |
---
## ๐ Reporting
The framework generates comprehensive reports:
- **ExtentReports**: Rich HTML reports with screenshots
- **TestNG Reports**: Standard TestNG output
- **Screenshots**: Automatic capture on test failures
- **Logs**: Thread-aware logging with platform identification
Reports are saved to `target/extent-report-{platform}.html`
---
## ๐งน Project Setup
### 1. Clone and Setup
```bash
git clone
cd mobile-test-automation-base
```
### 2. Add App Binaries
Place your app binaries in:
```
src/test/resources/apps/
โโโ android/your-app.apk
โโโ ios/your-app.ipa
```
### 3. Configure TestNG Files
Update `testng-android.xml` and `testng-ios.xml` with your:
- App paths
- Device UDIDs
- Package names (Android)
- Environment settings
### 4. Run Tests
```bash
mvn clean test -DsuiteXmlFile=testng-android.xml
```
---
## ๐ก Best Practices
### Page Objects
- โ
Use PageFactory pattern for lazy loading
- โ
Declare only needed pages per test class
- โ
Use multiple locators with fallbacks
- โ
Keep platform-specific logic in pages
### Test Structure
- โ
Extend `BaseTest` for all test classes
- โ
Initialize pages in `@BeforeMethod`
- โ
Use descriptive test names and groups
- โ
Add helper methods to `BaseTest` for common flows
### Configuration
- โ
Use environment-specific test data
- โ
Keep sensitive data in test data files
- โ
Use TestNG parameters for flexibility
---
## ๐ Troubleshooting
### Common Issues
**Device Connection:**
```bash
# Android
adb devices
# iOS
xcrun xctrace list devices
```
**App Installation:**
- Verify app binary path exists
- Check device has sufficient storage
- Ensure app is signed properly (iOS)
**Driver Creation:**
- Confirm Appium server is running
- Check device UDID is correct
- Verify app package name (Android)
**Performance Issues:**
- Use `fullReset=false` for faster execution
- Ensure shared driver approach is working
- Check for memory leaks in long test suites
---
## ๐ง Customization
### Adding New Pages
1. Create page class in `src/main/java/com/cube/qa/framework/pages/`
2. Add factory method to `PageFactory.java`
3. Use in test classes with lazy loading
### Adding Test Data
1. Create data models in `src/test/java/testdata/model/`
2. Add loaders in `src/test/java/testdata/loader/`
3. Store data files in `src/test/resources/testdata/{env}/`
### Platform-Specific Helpers
Add platform-specific utilities in:
- `src/main/java/com/cube/qa/framework/pages/deviceHelpers/`
---
## ๐ Future Enhancements
- [ ] Parallel execution within platforms
- [ ] Cloud device integration (BrowserStack, Sauce Labs)
- [ ] API testing integration
- [ ] Visual testing capabilities
- [ ] CI/CD pipeline templates
---
**Happy Testing! ๐งช๐**