This testing framework is developed for mobile application testing, utilizing Python, Behave, Allure Reporting, and Appium with the Page Object Model (POM) design principles.
It's designed to provide a pretty simple, scalable, and easy-to-maintain testing solution for mobile applications.
It has two features that were automated to test the James Rider app. Due to time restrictions, this framework only supports Android devices.
It's highly not recommended to test apps on emulated devices, but for practical and time reasons, and only for demo, these instructions are made to run project Tests on emulators.
- Python >= 3.x installed
- Node/npm installed
- Java installed with
JAVA_HOME
added to PATH (Java 8-202 is recommended for this project) - Android Studio installed with
ANDROID_HOME
added to PATH - Appium installed
- UIAutomator2 driver installed
- Allure Report installed
- Mobile device must have installed the James Rider application version 1.22.0 (3416)
- User must be logged once to the James Rider application. App can be closed if needed.
-
Clone repository to your local system.
-
Navigate to the project directory.
-
Run this command in order to install all project python dependencies:
pip install -r requirements.txt
It's highly recommended to use python virtual environments
-
Connect to your machine the mobile device with the James Rider app installed on it. You can use en Android Studio Emulator to load an emulated device. App can be closed if needed.
-
Run this command to get the emulated device name:
emulator -list-avds
-
Modify
appium:deviceName": "Pixel_3a"
in/src/features/environment.py
according to your device name. -
Run this command to load device:
emulator @'device_name' -no-snapshot-load
- Add app page elements and methods under pages directory. Use classes.
- Add BDD features under
features/
. The steps corresponding to these features must be located under/steps
folder. - Ensure python naming standards are followed.
There are 2 features already automated for the James Rider app.
- Profile Changes
- Logout
On Profile Changes there are 2 scenarios (Test Cases). One of them uses the Examples Table. On Logout there is only 1 scenario.
Both features were tagged with @android tag since these scripts were only developed for this platform.
Behave supports several ways to run tests.
- Be sure to locate under
/src
directory. - Run all features at the automation project:
behave ./features
- Run only a specific feature:
behave ./features/profile_change_profile.feature
- Run tagged features or scenarios:
In this case just one scenario will be executed.
behave --tags="@names"
This framework uses Allure Report library to produce an HTML Test Report.
- Run features with any of the previous commands.
- Run this command to process the test results and save an HTML report into the
allure-report
directory.allure generate --clean
- Run this command to view Test Report in system default browser:
allure open
allure-report
: Stores the test run report (index.html
) and related files and directories.allure-results
: Stores result artifacts in json format used to generate the Allure report.data
: Centralized storage for test data.features
: Contains test definitions in Gherkin language features.features/steps
: Contains test steps.features/environment
: Contains configuration for the Appium driver.pages
: Central repository for all page objects of the application.resources
: Stores the application under test.utils
: Holds custom actions.behave.ini
: Behave-specific configuration.requirements.txt
: Framework dependencies.