A lean, up-to-date, and cross-platform solution to run your mobile tests into a Selenium Grid using Appium.
You can use this repo as a start point to implement your own cross-platform parallel execution in a grid. It uses different libraries and design pater to make it lean, easy to maintain and extend.
This section will show to you the libraries, frameworks and design decisions that made a lean architecture possible.
This project using the following languages and frameworks:
- Java 11 as the programming language
- TestNG as the UnitTest framework to support the test creation
- Appium as the mobile test automation framework
- Seleium Grid as the grid and paralellism solution
- AsseertJ as the fluent assertion library
- Allure Report as the testing report strategy
- Log4J2 as the logging manage strategy
- Owner to minimize the code to handle the properties file
We know that any automation project starting with a good test architecture. This project can be your initial test architecture for a faster start. You will see the following items in this architecture:
- Page Objects pattern
- Factory
- BaseTest
- Logging
- Configuration files
- Parallel execution
- Java JDK 11 installed and configured (with
JAVA_HOME
andPATH
configured) - IDE (to import this project using Maven)
- Android SDK (for Android execution | with
ANDROID_HOME
andPATH
configured) - Android AVD created (or Genymotion)
- XCode and the iPhone Simulator (for iOS execution)
- Appium installed through npm
To execute the examples over the Android platform you'll need:
- Android SDK
- Updated Build Tools, Platform Tools and, at least, one System Image (Android Version)
- Configure Android Path on your environment variables
- ANDROID_HOME: root android sdk directory
- PATH: ANDROID_HOME + the following paths = platform-tools, tools, tools/bin
- And Android Virtual Device
- AVD or Genymotion
You can use the uiautomatorviewer to inspect elements on Android devices. or you can use Appium Desktop
To execute the examples over the iOS platform you'll need:
- MacOS machine :-)
- Xcode installed
- iPhone simulator (I recommend, for these tests iOS version > 10)
- Follow all the steps on https://github.com/appium/appium-xcuitest-driver
You also can use Appium Desktop or you can use the Macaca App Inspector
The Fastip app can be downloaded by this repository https://github.com/ptraeg/mobile-apps-4-ways
I have built the apps for Android and iOS platform, and these are located in app folder.
On a MacOs machine give write access to node_modules:
sudo chmod -R 777 /usr/local/lib/node_modules
Try to always have Appium and libraries updated.
- verify the core Appium version on npm appium site. To see your Appium version run
appium --version
on the Terminal/Command Prompt - verify the Appium library version on https://github.com/appium/java-client
- if it differs from
pom.xml
file, update it!
- if it differs from
First you'll need to start the hub and the nodes. Please read the Start commands to lear now to start it.
Each node is configured through a json file in json folder.
Remember you gonna need to change some values, like browserName
, version
, platform
, url
, host
, port
, hubPort
and hubHost
.
The port information is also linked on launch_grid.sh
file, that pass this and other informations by parameter.
After change all this information for your execution, execute the suite.xml file. Each test have 3 parameters:
- platform
- udid
- platformVersion
These parameters are linked to the test files using TestNG, so when you execute the suite.xml file all these parameters will be used on test file.
On the package com.eliasnogueira
you'll find the test script TipTest.java
that uses the information on config.properties
and suite.xml
to execute the tests in Android or iOS
Please, read this post: https://medium.com/@eliasnogueira/got-capabilitynotpresentonthegridexception-66cbc1aa06b7
Please fill an issue