A professional, reusable automation framework that creates independent test automation projects for iOS and Android mobile applications.
Features โข Quick Start โข Documentation โข Examples โข Contributing
This framework solves a critical problem in mobile test automation: reusability without code duplication.
Instead of creating a framework tied to a single app (or duplicating code for each new app), this framework acts as a template system that deploys complete, independent automation projects for unlimited applications.
Traditional Approach:
โ Framework tied to one app
โ Duplicate entire framework for each new app
โ Maintenance nightmare with N copies
โ Manual setup for each project
โ No platform abstraction
This Framework:
โ
One reusable template โ unlimited apps
โ
Each deployment creates independent project
โ
Single source of truth for framework updates
โ
Automated deployment with one command
โ
Built for iOS and Android from day one
- One-command project creation - Deploy complete automation project in < 2 minutes
- Validates prerequisites - Checks for Appium, Xcode/Android SDK, Python
- Builds apps automatically - Compiles iOS apps (or Android APKs when implemented)
- Extracts metadata - Bundle ID (iOS), Package name (Android)
- Generates starter code - Page objects, tests, configurations
- iOS (XCUITest) - โ Fully implemented and production-ready
- Android (UIAutomator2) - ๐ง Architecture ready, implementation planned
- Platform-agnostic base classes - Write once, run on both (future)
- Cross-platform test support - Shared test scenarios when applicable
- Page Object Model (POM) - Clean separation of test logic and UI
- Platform abstraction - Base classes handle platform differences
- Pytest-based - Industry-standard test framework
- Type hints throughout - Modern Python 3.8+ practices
- Comprehensive error handling - Clear, actionable error messages
- Performance optimized - 40-60% faster execution with configurable wait times
- Fast mode - Enable via
FAST_MODE=truefor rapid development cycles - Parallel execution - pytest-xdist for concurrent test runs
- Robust element finding - Multi-strategy fallback for iOS sheet/modal handling
- Diagnostic tools - Built-in utilities for troubleshooting test failures
- Multiple locator strategies - Accessibility ID, XPath, iOS Predicates, Class Chains
- Smart wait mechanisms - Configurable, context-aware wait times
- Screenshot on failure - Automatic capture with clear naming
- HTML & Allure reports - Professional test reporting
- Pytest markers - Organize tests by platform, suite, feature
- Colored terminal output - Clear, readable deployment messages
- Verbose mode - Debug deployment issues easily
- Flexible configuration - JSON-based capabilities, environment variables
- Virtual environment management - Isolated dependencies per project
- Comprehensive documentation - Guides, examples, troubleshooting
# Required
โ
Python 3.8+
โ
Node.js & npm
โ
Appium 2.x
# For iOS
โ
Xcode 14.0+
โ
iOS Simulators
โ
XCUITest driver
# For Android (when implemented)
โ
Android Studio
โ
Android SDK
โ
Android Emulator
โ
UIAutomator2 driver# Install Appium
npm install -g appium
# Install iOS driver
appium driver install xcuitest
# Clone this repository
git clone https://github.com/jbcrane13/appium-multiplatform-framework.git
cd appium-multiplatform-framework
# Install framework dependencies (optional, for development)
pip install -r requirements.txt# Deploy iOS automation project
python deploy/deploy_ios.py --app-path ~/Projects/YourApp
# This creates: ~/Projects/YourApp-Automation/# Navigate to deployed project
cd ~/Projects/YourApp-Automation
# Set up virtual environment
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Start Appium (separate terminal)
appium
# Run smoke tests
pytest tests/ios/ -m smoke -v
# Run all tests
pytest tests/ios/ -v
# Generate HTML report
pytest tests/ios/ --html=reports/ios/report.htmlappium-multiplatform-framework/
โโโ deploy/ # ๐ Deployment Scripts
โ โโโ deploy_ios.py # iOS deployment (READY)
โ โโโ deploy_android.py # Android deployment (COMING SOON)
โ โโโ deploy_both.py # Multi-platform orchestrator
โ โโโ common.py # Shared deployment utilities
โ
โโโ templates/ # ๐ Project Templates
โ โโโ common/ # Shared templates
โ โ โโโ pytest.ini.template
โ โ โโโ requirements.txt.template
โ โ โโโ gitignore.template
โ โโโ ios/ # iOS-specific templates
โ โ โโโ base_page.py.template
โ โ โโโ conftest.py.template
โ โ โโโ test_smoke.py.template
โ โ โโโ capabilities.json.template
โ โโโ android/ # Android templates (future)
โ โโโ README.md
โ
โโโ examples/ # ๐ก Usage Examples
โ โโโ github-actions-multiplatform.yml
โ
โโโ docs/ # ๐ Documentation
โ โโโ (additional documentation)
โ
โโโ README.md # This file
โโโ QUICKSTART.md # 5-minute getting started guide
โโโ FRAMEWORK_SUMMARY.md # Detailed framework overview
โโโ CHANGELOG.md # Version history
โโโ requirements.txt # Framework dependencies
When you run deploy_ios.py, a complete automation project is created:
YourApp-Automation/
โโโ config/
โ โโโ ios/
โ โ โโโ capabilities.json # โ
iOS device configurations
โ โโโ android/ # ๐ง Ready for Android
โ โโโ common.json # Shared settings
โ
โโโ tests/
โ โโโ ios/
โ โ โโโ conftest.py # iOS pytest fixtures
โ โ โโโ test_smoke.py # โ
Ready-to-run smoke tests
โ โโโ android/ # ๐ง Placeholder
โ โโโ cross_platform/ # ๐ง Cross-platform tests
โ
โโโ pages/
โ โโโ base_page.py # โ
Platform-agnostic base (480+ lines)
โ โโโ ios/
โ โ โโโ home_page.py # iOS page object example
โ โโโ android/ # ๐ง Placeholder
โ
โโโ utils/
โ โโโ debug_helpers.py # โ
Diagnostic utilities (page source, element inspection)
โ โโโ wait_helper.py # โ
Configurable wait time management
โโโ data/ # Test data files
โโโ reports/ # Test reports (ios/, android/)
โโโ screenshots/ # Failure screenshots (ios/, android/)
โโโ logs/ # Test execution logs
โโโ debug/ # Debug output (page source XML)
โ
โโโ venv/ # Virtual environment (auto-created)
โโโ pytest.ini # โ
Configured with markers
โโโ requirements.txt # โ
All dependencies
โโโ .gitignore # โ
Proper ignores
โโโ README.md # โ
Project-specific docs
โโโ TROUBLESHOOTING.md # โ
Diagnostic workflow guide
โโโ CLAUDE.md # โ
AI development guidelines
โโโ README_PERFORMANCE.md # โ
Performance optimization guide
Everything you need to start testing immediately!
# Deploy to iOS app
python deploy/deploy_ios.py --app-path ~/Projects/AppJubilee
# Creates: ~/Projects/AppJubilee-Automation/# Custom output directory
python deploy/deploy_ios.py \
--app-path ~/Projects/MyApp \
--output-dir ~/Automation
# Override app name
python deploy/deploy_ios.py \
--app-path ~/Projects/MyApp \
--app-name "CoolApp"
# Skip building (use existing .app)
python deploy/deploy_ios.py \
--app-path ~/Projects/MyApp \
--skip-build
# Skip virtual environment
python deploy/deploy_ios.py \
--app-path ~/Projects/MyApp \
--skip-venv
# Verbose output for debugging
python deploy/deploy_ios.py \
--app-path ~/Projects/MyApp \
--verbose# The framework is reusable!
python deploy/deploy_ios.py --app-path ~/Projects/App1 # โ App1-Automation/
python deploy/deploy_ios.py --app-path ~/Projects/App2 # โ App2-Automation/
python deploy/deploy_ios.py --app-path ~/Work/App3 # โ App3-Automation/
# Each project is independent and isolated# In your deployed project
cd ~/Projects/YourApp-Automation
# Activate virtual environment
source venv/bin/activate
# Run smoke tests
pytest tests/ios/ -m smoke -v
# Run all iOS tests
pytest tests/ios/ -v
# Run with HTML report
pytest tests/ios/ --html=reports/ios/report.html --self-contained-html
# Run in parallel (requires pytest-xdist)
pytest tests/ios/ -n auto
# Run specific test
pytest tests/ios/test_smoke.py::TestiOSSmoke::test_app_launches -v
# Run with different markers
pytest tests/ios/ -m "smoke or functional" -vFast Mode (50% faster execution):
# Enable via environment variable
FAST_MODE=true pytest tests/ios/ -v
# Or edit config/common.json and set "fast_mode": { "enabled": true }Parallel Execution (60-70% faster):
# Install pytest-xdist
pip install pytest-xdist
# Run with auto-detected workers
pytest tests/ios/ -n auto
# Or specify worker count
pytest tests/ios/ -n 2Time Savings:
- Standard Mode: ~40% faster (optimized wait times)
- Fast Mode: ~50% faster (minimal wait times)
- Parallel Mode: ~60-70% faster (concurrent execution)
See README_PERFORMANCE.md in your deployed project for detailed optimization guide.
When tests fail, use built-in diagnostic utilities:
# Run diagnostic tests to inspect app state
pytest tests/ios/test_diagnostic.py -v -s
# Available diagnostics:
# - test_dump_page_source: Saves complete XML to debug/
# - test_find_tab_bar_elements: Prints tab structure
# - test_print_all_buttons: Lists all clickable elements
# - test_try_navigation_strategies: Tests navigation methodsDebug workflow:
- Check screenshot in
screenshots/ios/ - Run
test_dump_page_sourceto save XML - Inspect
debug/*.xmlfor element structure - Update locators based on findings
See TROUBLESHOOTING.md in your deployed project for complete diagnostic workflow.
The framework is designed for multi-platform from day one:
# All page objects inherit from this
class BasePage:
def __init__(self, driver):
self.driver = driver
self.platform = driver.capabilities['platformName'].lower()
# Methods that work on both iOS and Android
def find_element(self, locator):
return self.driver.find_element(*locator)
# Platform-specific methods
def by_ios_predicate(self, predicate):
if self.platform != 'ios':
raise ValueError("iOS predicates only work on iOS")
return ('-ios predicate string', predicate)
def by_android_uiautomator(self, uia_string):
if self.platform != 'android':
raise ValueError("UIAutomator only works on Android")
return ('-android uiautomator', uia_string)@pytest.mark.cross_platform
def test_login(driver):
"""This test will run on both iOS and Android."""
login_page = LoginPage(driver) # Works on both platforms
login_page.login("user@example.com", "password")
home_page = HomePage(driver)
assert home_page.is_displayed()Tests are organized with markers for flexible execution:
@pytest.mark.ios # iOS platform
@pytest.mark.android # Android platform
@pytest.mark.cross_platform # Both platforms
@pytest.mark.smoke # Smoke test suite
@pytest.mark.functional # Functional tests
@pytest.mark.regression # Full regressionRun specific subsets:
pytest tests/ -m smoke # Smoke tests only
pytest tests/ -m "ios and smoke" # iOS smoke tests
pytest tests/ -m functional # Functional tests
pytest tests/ -m "not slow" # Exclude slow testsEasy to add new devices - just edit JSON:
{
"iPhone_15_Pro": {
"platformName": "iOS",
"appium:platformVersion": "17.0",
"appium:deviceName": "iPhone 15 Pro",
"appium:automationName": "XCUITest",
"appium:app": "/path/to/app.app",
"appium:bundleId": "com.company.app"
}
}{
"app_name": "YourApp",
"appium_url": "http://127.0.0.1:4723",
"implicit_wait": 10,
"explicit_wait": 30,
"screenshot_on_failure": true,
"log_level": "INFO",
"wait_times": {
"after_navigation": 0.2,
"after_modal_dismiss": 0.1,
"after_gesture": 0.1,
"app_launch": 0.5
},
"fast_mode": {
"enabled": false,
"after_navigation": 0.1,
"after_modal_dismiss": 0.05,
"after_gesture": 0.05,
"app_launch": 0.2
}
}Performance tuning:
- Adjust
wait_timesfor your app's performance characteristics - Enable
fast_modefor rapid development cycles - Use environment variable
FAST_MODE=trueto override config
- README.md - This comprehensive overview
- QUICKSTART.md - Get started in 5 minutes
- FRAMEWORK_SUMMARY.md - Detailed framework architecture
- Deployed Project README - Generated per project
@pytest.mark.ios
@pytest.mark.smoke
class TestiOSSmoke:
def test_app_launches(self, driver):
"""Test that app launches successfully."""
page_source = driver.page_source
assert page_source is not None
assert len(page_source) > 0class HomePage(BasePage):
@property
def welcome_text_locator(self):
return self.by_accessibility_id("welcome_text")
def get_welcome_message(self):
return self.get_text(self.welcome_text_locator)
def is_displayed(self):
return self.is_element_visible(self.welcome_text_locator)See examples/github-actions-multiplatform.yml for a complete GitHub Actions workflow.
The framework is designed to be extended:
Add new page objects:
# In your deployed project
pages/ios/my_new_page.pyAdd new test suites:
# In your deployed project
tests/ios/test_my_feature.pyAdd utilities:
# In your deployed project
utils/my_helper.pyAdd test data:
# In your deployed project
data/my_test_data.jsonSee CONTRIBUTING.md for guidelines on:
- Adding new features
- Improving deployment scripts
- Creating new templates
- Adding Android support
- Improving documentation
- โ iOS Support - Fully implemented with robust element finding
- โ Performance Optimization - 40-60% faster execution
- โ iOS Sheet Handling - Multi-strategy dismissal for modals/sheets
- โ Diagnostic Tools - Built-in troubleshooting utilities
- โ Deployment Automation - Complete with best practices
- โ Multi-platform Architecture - Ready for Android
- โ Documentation - Comprehensive (includes performance & troubleshooting)
- โ CI/CD Examples - Provided
-
๐ง Android Support - Architecture ready, implementation planned
- UIAutomator2 driver integration
- Android page objects
- Cross-platform test examples
-
๐ฎ Future Enhancements
- Data-driven testing utilities
- API testing integration
- Visual regression testing
- Performance testing support
- Cloud platform integration (BrowserStack, Sauce Labs)
- Advanced reporting dashboards
- Test data factories
Contributions are welcome! Here's how you can help:
- Android Implementation - Help implement deploy_android.py
- Template Improvements - Enhance existing templates
- Documentation - Improve guides, add examples
- Bug Fixes - Report and fix issues
- Features - Propose and implement new capabilities
# 1. Fork the repository
# 2. Create a feature branch
git checkout -b feature/amazing-feature
# 3. Make your changes
# 4. Test thoroughly
# 5. Commit with clear messages
git commit -m "Add amazing feature"
# 6. Push to your fork
git push origin feature/amazing-feature
# 7. Open a Pull Request- Python 3.8+
- Appium 2.x
- Node.js & npm
iOS:
- macOS
- Xcode 14.0+
- iOS Simulators
- XCUITest driver:
appium driver install xcuitest
Android (when implemented):
- Android Studio
- Android SDK (API 28+)
- Android Emulator or physical device
- UIAutomator2 driver:
appium driver install uiautomator2
"Appium not found"
npm install -g appium
appium --version"XCUITest driver not installed"
appium driver install xcuitest
appium driver list"Build failed"
- Open project in Xcode and build manually
- Or use
--skip-buildand provide .app path
"Tests fail to run"
- Ensure Appium server is running:
appium - Check app path in config/ios/capabilities.json
- Verify bundle ID is correct
"Element not found"
- Run diagnostic tests:
pytest tests/ios/test_diagnostic.py::TestDiagnostic::test_dump_page_source -v -s - Check XML in
debug/folder for actual element structure - Update locators to match actual app state
- Use robust multi-strategy element finding (see
CLAUDE.md)
"iOS sheet/modal blocking navigation"
- Framework includes automatic sheet dismissal via swipe-down gesture
- Use
dismiss_modal_if_present(),dismiss_sheet_by_swipe(), ortap_outside_sheet() - See
TROUBLESHOOTING.mdfor complete diagnostic workflow
"Tests are too slow"
- Enable Fast Mode:
FAST_MODE=true pytest tests/ios/ -v - Use parallel execution:
pytest tests/ios/ -n auto - See
README_PERFORMANCE.mdfor optimization strategies
For complete troubleshooting workflow, see TROUBLESHOOTING.md in deployed projects.
This project is licensed under the MIT License - see the LICENSE file for details.
- Appium - For the excellent mobile automation framework
- Pytest - For the robust testing framework
- Python Community - For amazing tools and libraries
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: See docs/ directory
If you find this framework useful, please consider giving it a star! โญ
Built with โค๏ธ for the mobile test automation community