This project contains examples for testing Android, iOS applications using the appium testing framework.
To run these samples you need to install the core components like Android SDK, Xcode( for iOS ) on your machine along with the following tools:
- Appium
npm install -g appium
- Python
brew install python
- Appium Python Client
pip install Appium-Python-Client
- PyTest
pip install -U pytest
- Carthage ( for iOS )
brew install carthage
To prepare the app for testing, build it with a specific SDK using XcodeBuild
. Assuming you’ve changed to your Xcode project folder, type the following command to create the build:
xcodebuild -sdk iphonesimulator12.2
This will compile the project and create the build under the build folder. You can find a build/Release-iphonesimulator
directory that contains the .app
package that you’ll need to communicate with the Appium server.
To prepare the app for testing, build it using gradlew. Assuming you’ve changed to your android project folder, type the following command to create the build:
./gradlew assemble
This will compile the project and create the build under the build/outputs/apk
folder. You can find the .apk
package that you’ll need to communicate with the Appium server.
Now is the moment to run the tests but you need to start appium
server first. In Terminal, execute the command below:
appium
To execute the following tests ( Android/iOS ) switch to the /Tests
directory of the project and type the following command to execute the tests:
-
iOS
pytest test_ios.py
-
Android
Make sure to set
ANDROID_HOME
environment variable pointing to theAndroid SDK
and then start the emulator which you've specified in thetest_android.py
file before executing the command below.pytest test_android.py
You should see a message specifying the time taken to execute the test and how many of the test cases passed/failed.
You deserve a pat on your back for following through this lengthy process to get your appium tests running!