Automation tests for the mobile apps base on Python + Appium + BrowserStack
Note! It's just a template of mobile project with empty variables and test. To make it work need to specify all needed fields, tests, screen, locators and configs.
Brave yourself and read small instruction below. I do not guarantee that you will understand something cause there are a lot of pitfalls with XCode and Appium versions. At first, make sure that you have a Developer provision profile and account from the app you gonna test. Then you need all the latest versions of:
- XCode;
- Android Studio;
- Appium;
- MacOS;
- iOS;
After that open
WebDriverAgent
project using XCode and add sign all WebDriverAgent in this project with your dev profile. And set the target version needed to your app.
Mobile tests project which supports iOS and Android using Appium.
This project is Python based, so you will need Python to work with it. For reports generation Allure is used. Install it as well.
brew install python3
brew install Allure
In Terminal from the main project, folder do the following
- Setup the local virtual env
python3 -m virtualenv venv
- Install all the requirements
source venv/bin/activate
pip install -r requirements.txt
deactivate
Also, you can run the next script:
sh scripts/venv.sh
brew install node || apt-get install nodejs # get node.js
npm install -g appium # get appium
npm install wd # get appium client
Also the desktop version - https://github.com/appium/appium-desktop/releases
- Install JAVA
brew cask install java
- Install android sdk
- Set correct Android path link:
nano ~/.bash_profile
export ANDROID_HOME=/YOUR_PATH_TO/android-sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools:$PATH
- RESTART MAC!
- Create emulator
sdkmanager "system-images;android-28;google_apis;x86"
avdmanager create avd -n test_emu -k "system-images;android-28;google_apis;x86" --device "pixel_xl"
avdmanager list avd
emulator -avd test_emu
It can be automated only on Mac.
brew install libimobiledevice
brew install ios-deploy
- Install Xcode
- Get the dev permissions to the iOS developer group
- Use guide to setup WebAgentRunner in the Xcode http://appium.io/docs/en/drivers/ios-xcuitest-real-devices/
Go to scripts
dir. Execute the following script
execute_tests.sh
Android
{
"platformName": "android",
"deviceName": "Pixel 2",
"app": "test.apk",
"autoGrantPermissions": true,
"appPackage": "com.test.test.QA",
"appActivity": "com.test.test.activities.TestLauncherActivity"
}
iOS
{
"platformName": "iOS",
"platformVersion": "13.3",
"deviceName": "iPhone 7",
"app": "test.ipa",
"udid": "auto",
"xcodeOrgId": "123123",
"xcodeSigningId": "iPhone Developer",
"autoAcceptAlerts": false,
"noReset": true,
"automationName": "XCUITest",
"waitForQuiescence": false,
"useNewWDA": true
}
KEY | VALUE | Desc |
---|---|---|
DEVICE | pixel_device | Key of devices from mobile_framework/mobile/devices.py |
app_path | test.apk; | ABS path to the application |
PLATFORM | android | android or ios |
You can easily setup those variables using PyCharm: Run/Debug Configurations -> Edit Configurations -> Templates -> Python tests -> pytest -> Environment -> Environment variables
- Try to use Appium Desktop cause it would be faster for you and you could easily setup correct desired capabilities;
- Creating a Test Automation Framework using Appium with Python
- Appium XCUITest Driver Real Device Setup
/usr/bin/killall -KILL node