Skip to content

A lean, up-to-date, and cross-platform solution to run your mobile tests into a Selenium Grid using Appium.

License

Notifications You must be signed in to change notification settings

eliasnogueira/appium-parallel-execution

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Appium parallel test execution

A lean, up-to-date, and cross-platform solution to run your mobile tests into a Selenium Grid using Appium.

How you can use this repo

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.

Technical Decisions

This section will show to you the libraries, frameworks and design decisions that made a lean architecture possible.

Languages and Frameworks

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

Test architecture

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

Pre-conditions

What you need

  1. Java JDK 11 installed and configured (with JAVA_HOME and PATH configured)
  2. IDE (to import this project using Maven)
  3. Android SDK (for Android execution | with ANDROID_HOME and PATH configured)
  4. Android AVD created (or Genymotion)
  5. XCode and the iPhone Simulator (for iOS execution)
  6. Appium installed through npm

Android specific

Configurations

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
Inspect elements on Android

You can use the uiautomatorviewer to inspect elements on Android devices. or you can use Appium Desktop

iOS specific

Configurations

To execute the examples over the iOS platform you'll need:

Inspect elements on iOS

You also can use Appium Desktop or you can use the Macaca App Inspector

About the apps

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.

How to run the tests

Pre-conditions

On a MacOs machine give write access to node_modules: sudo chmod -R 777 /usr/local/lib/node_modules

Appium

Try to always have Appium and libraries updated.

Project execution

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.

About the test

On the package com.eliasnogueira you'll find the test script TipTest.java that uses the information on config.properties and suite.xmlto execute the tests in Android or iOS

Having trouble?

CapabilityNotPresentOnTheGridException

Please, read this post: https://medium.com/@eliasnogueira/got-capabilitynotpresentonthegridexception-66cbc1aa06b7

Any question, error or feedback?

Please fill an issue

About

A lean, up-to-date, and cross-platform solution to run your mobile tests into a Selenium Grid using Appium.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Languages