Quamotion provides a Java library as an extension of the selenium Java library. This document describes how to write your tests as JUnit tests.

Create a new JUnit project

The project requires following dependencies which are available in the maven repository:

Write your tests

JUnit tests allow you to write @Before methods, which are executed before your test launch. Use the @Before method to create a new session, which will start the application on your device.

To create a new session, you create a new instance of the AppDriver class. To create a new instance of this class, you need to provide an AppCapabilities object which specifies which application you want to start, and on which device you want to start the application.

Once you’ve created a @Before method, you also need to make sure your session is closed when your test completes. You can do this by adding an @After method, which runs after your test has completed. In this @After method, you’ll stop the application on the device by removing the session you’ve created in the @Before method. You can do so by calling the quit() method on the AppDriver class.

  1. Right-click a package and select New and Java Class

  2. Provide a name for your test, such as AcquaintTest

  3. Add the code which will initialize your session:

    AppDriver driver = null;
    public void setUp2() throws Exception
        AppCapabilities capabilities =
           new AppCapabilities("deviceId", "AppId", "AppVersion");
        driver = new AppDriver(capabilities);
  4. Add the code which will clean up your session:

    public void tearDown() {
  5. Add tests:

    public void FirstTest() throws IOException {
Last modified October 25, 2019: Add redirect URLs (da422fd)