Selendroid's Architecture

Overview about the selendroid

Selendroid is based on the Android instrumentation framework, and therefore only testing one app is supported. Selendroid contains four major components:

  • Selendroid-Client - the java client library (based on the selenium java client).
  • Selendroid-Server - that is running beside your app on the Android device.
  • AndroidDriver-App - a built in Android driver webview app to test the mobile web.
  • Selendroid-Standalone - manages different Android devices by installing the selendroid-server and the app under test.

Below you can see an overview about the architecture:

The selendroid-standalone-0.17.0.jar contains the standalone-server, selendroid-server and the selendroid-client driver.

Selendroid-server is the main component responsible for the app automation.

Selendroid-Server

The central driver class is DefaultSelendroidDriver. This class is responsible for doing the common activities (like taking screenshots) for both contexts NATIVE_APP and WEBVIEW.

The web view related driver class is SelendroidWebDriver and native class is SelendroidNativeDriver.

SelendroidWebDriver is using Automation Atoms of the selenium project to interact with the elements in the web view. For details about how to generate the atoms for selendroid please check our wiki.

Selendroid-Standalone

Central driver class is SelendroidStandaloneDriver that acts as a proxy between the selendroid-client and the selendroid-server and starts e.g. an Android emulator, creates for the app under test a customized selendroid-server and installs everything on the device. After the session is initialized on the device, subsequent requests are directly forwarded to the server on the device and the response routed back to the client.

How to build selendroid

For building Selendroid from scratch (only needed for commiters!) we use Maven 3.1.1 and you have to follow the following steps:

git clone https://github.com/selendroid/selendroid.git
cd selendroid/
# this is needed to install manually the third party libs locally in your Maven repo.
third-party/mvnInstall.sh
mvn package

You will then be able to get your version of the standalone-server in selendroid-standalone/target/

Testing Selendroid itself

To test selendroid there is a special app that we use to verify that everything is working as expected. The end-to-end tests for this application are called large tests are are located here.

The main tests for verifying selendroid are:

  • ElementFindingTest
  • ChildElementFindingTest
  • ElementInteractionTest

Selendroid's native focused tests are located here whereas the hybrid (web view) focused test are located here.

Testing selendroid requires following steps:

  • Clone the project
  • Build it via mvn clean install
  • Run the end-to-end tests by ./runEnd2EndTests.sh. By default platform version 18 is used. But when starting the test script, the platform version can be be specified: e.g.: ./runEnd2EndTests.sh 19

CI Infrastructure

We use travis-ci for building selendroid: https://travis-ci.org/selendroid/selendroid.

Contributing code

If you want to contribute to Selendroid, please fork the project and create pull requests. We will then evaluate the code and whether the contribution is suitable for merging into the main project. Please make sure that your code is formatted according to the Google Styleguide.

[IMPORTANT] We are only able to merge code into the code base, if you as a contributor have signed the Contributor License Agreement (CLA).

Debugging of the selendroid-server component is possible, please read the following instructions to setup your IDE.

If you have questions about your contribution, please join us on IRC: #selendroid on freenode.net.