A robust, maintainable test automation framework for Android apps using Pytest and Appium. This project follows the Page Object Model (POM) pattern for clear separation of test logic and UI interactions.
- Pytest-based: Simple, powerful test discovery and execution.
- Appium-powered: Automates real Android devices or emulators.
- Page Object Model: Clean, reusable code for UI interactions.
- Fixtures: Easy driver, device, and logger setup with Pytest fixtures.
- End-to-End Tests: Example tests for search and product view flows.
- Logging: Session-based logging to both console and file.
pytest-appium-framework/
├── config/ # Device and environment configuration
├── fixtures/ # Pytest fixtures for driver, pages, and logger
├── pages/ # Page Object Model classes
├── tests/ # Test cases
├── utils/ # Utility functions (waits, scrolling, logging, etc.)
├── logs/ # Log files
├── requirements.txt # Python dependencies
├── pytest.ini # Pytest configuration
def test_search_box_opens_product_view(home_page, product_view, logger):
query = "seiko"
home_page.perform_search(query)
home_page.open_product_view()
assert product_view.is_opened()-
Install dependencies:
pip install -r requirements.txt
-
Configure devices and environment:
- Edit files in
config/as needed. - Set your Appium server URL in
.env.qaor.env.example.
- Edit files in
-
Run tests:
pytest
To specify a device:
pytest --device=<DEVICE_NAME>
- Python 3.7+
- Appium server running
- Android device or emulator
Copy .env.example to .env.qa and set your Appium server URL:
APPIUM_SERVER_URL=http://0.0.0.0:4723
This project supports Allure for advanced test reporting and visualization.
-
Run your tests to generate Allure results:
pytest
-
Generate the Allure HTML report:
allure generate allure-results -o allure-report --clean
-
Open the Allure report in your browser:
allure open allure-report
Note:
Make sure you have the Allure commandline tool installed.
You can install it via Homebrew (brew install allure), Scoop (scoop install allure), or download from the official site.
The report will be available at http://localhost:port after running the allure open command.
Automate. Test. Deliver quality Android apps with confidence!