Skip to content

jpita/appium-parallel-execution

 
 

Repository files navigation

NOTE: this is a fork from @eliasnogueira's repo, give him a high five or mention if you use this!

Test framework

This repo holds a test framework that allows you to execute tests in parallel using Appium and TestNG. Currently only has support for android tests. In the future I'll try to add support for:

What you need to have installed

  1. Java JDK (with JAVA_HOME and PATH configured)
  2. IDE (and import this project using Gradle)
  3. Android Studio (with ANDROID_HOME and PATH configured)
  4. Android AVD created
  5. XCode and an iPhone Simulator (for iOS execution)
  6. Appium installed through npm
  7. Gradle

About the apps used for the tests

The Fastip app can be found in the app folder. It was built from ptraeg's repo.

Inspect elements on Android

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

iOS

Configurations

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

  • MacOS machine
  • Xcode installed
  • iPhone simulator
  • Follow all the steps on appium's docs

Inspect elementos on iOS

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

Appium

Try to always have Appium and libraries updated.

Project execution

First you'll need to start the hub and the nodes.

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

This parameters are linked to the test files using TestNG, so when you execute the suite.xml file all these parameter will be used on test file.

About the test

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

Have trouble?

CapabilityNotPresentOnTheGridException

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

Any question, error or feedback?

Please fill an issue ;-)

Learnings

When working with appium in parallel you need to pay attention to a few simple but very important things.

If you take a look at the start-commands.txt file and the json files for appium, you need to set different ports for a few different things:

  • wda
  • systemPort
  • boostrapPort

I lost many hours of trial and error until I finally got a working solution with 2 devices, despite the fact that I had 3 devices configured but only 2 were running the tests.

Another thing, I could never point my tests to the exact device I wanted, even though I put the exact udid and android version on the capabilities when running the tests locally ,for some reason the tests always run on different devices.