Arquillian Droidium Platform


License

License

Categories

Categories

Arquillian Application Testing & Monitoring ORM Data
GroupId

GroupId

org.arquillian.extension
ArtifactId

ArtifactId

arquillian-droidium-platform
Last Version

Last Version

1.0.1.Final
Release Date

Release Date

Type

Type

jar
Description

Description

Arquillian Droidium Platform
Arquillian Droidium Platform
Project URL

Project URL

http://www.jboss.org/arquillian-droidium-platform
Project Organization

Project Organization

JBoss by Red Hat

Download arquillian-droidium-platform

How to add to project

<!-- https://jarcasting.com/artifacts/org.arquillian.extension/arquillian-droidium-platform/ -->
<dependency>
    <groupId>org.arquillian.extension</groupId>
    <artifactId>arquillian-droidium-platform</artifactId>
    <version>1.0.1.Final</version>
</dependency>
// https://jarcasting.com/artifacts/org.arquillian.extension/arquillian-droidium-platform/
implementation 'org.arquillian.extension:arquillian-droidium-platform:1.0.1.Final'
// https://jarcasting.com/artifacts/org.arquillian.extension/arquillian-droidium-platform/
implementation ("org.arquillian.extension:arquillian-droidium-platform:1.0.1.Final")
'org.arquillian.extension:arquillian-droidium-platform:jar:1.0.1.Final'
<dependency org="org.arquillian.extension" name="arquillian-droidium-platform" rev="1.0.1.Final">
  <artifact name="arquillian-droidium-platform" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.arquillian.extension', module='arquillian-droidium-platform', version='1.0.1.Final')
)
libraryDependencies += "org.arquillian.extension" % "arquillian-droidium-platform" % "1.0.1.Final"
[org.arquillian.extension/arquillian-droidium-platform "1.0.1.Final"]

Dependencies

compile (3)

Group / Artifact Type Version
org.arquillian.extension : arquillian-droidium-platform-spi jar 1.0.1.Final
org.jboss.arquillian.core : arquillian-core-spi jar
org.jboss.arquillian.config : arquillian-config-api jar

Project Modules

There are no modules declared in this project.

Arquillian Droidium - ftesting of Android done right

This is the home of the following extensions for Arquillian testing platform:

Arquillian Droidium container

Implementation of Arquillian container abstraction for Android devices. By this Arquillian container adapter, you can execute tests dealing with Android devices where Android device is considered to be just another Arquillian container.

Arquillian Droidium platform

This tiny extension provides core Android platform configuration on which Droidium container depends.

Arquillian Droidium Native

Extension for supporting testing of native applications for Droidium container. You need this extension when you want to functionally test your native Android application. Native extension relies on Selendroid project from where it takes Selendroid server APK.

Arquillian Droidium Recorder

By this extension, you can make videos of Android devices while you are executing tests.

Arquillian Droidium Screenshooter

By this extension, you can take screenshots of Android devices while you are executing tests.

Examples

Note
You are welcome to look at intensive test scenarios in tests directory in this repository where every possible scenario Droidium is able to do is shown with fully runnable examples.
@RunWith(Arquillian.class)
@RunAsClient
public class AndroidContainerTest {

    // injected abstraction of your Android device
    @ArquillianResource
    AndroidDevice android;

    // APK will be deployed to android device
    // upon Android container startup
    @Deployment
    public static Archive<?> createAndroidDeployment() {
        return ShrinkWrap.createFromZipFile(
            JavaArchive.class, new File(my.apk));
    }

    @Test
    public void test01() {
        assertTrue(android != null);

        String sn = android.getSerialNumber();
        String avdName = android.getAvdName();

        Assert.assertTrue(android.isOnline());
        Assert.assertFalse(android.isOffline());

        boolean emulator = android.isEmulator();

        // command and package management
        android.executeShellCommand("execute on android");
        android.createPortForwarding(localPort,remotePort);
        android.installPackage();
        android.uninstallPackage();
        android.isPackageInstalled("package name");

        // taking screenshots and record videos
        Screenshot screenshot = android.getScreenshot();

        android.startRecording(remoteFilePath, options);
        Video video = android.stopRecording(localFilePath);

        // push, pull and remove file to and from device
        android.push(localFilePath, remoteFilePath);
        android.pull(remoteFilePath, localFilePath);
        android.remove(remoteFilePath);
    }
}

Complete information how to use Android container can be found here.

@RunAsClient
@RunWith(Arquillian.class)
public class NativeAndroidTestCase {

    @Drone
    AndroidDriver mobile;

    @Deployment
    @Instrumentable // instruments APK by Selendroid server
    public static Archive<?> getDeployment() {
        return ShrinkWrap.createFromZipFile(JavaArchive.class,
            new File("my.apk"));
    }

    @Test
    public void test() {
        mobile.startActivity("my.fqcn.of.activity");
    }
@RunAsClient
@RunWith(Arquillian.class)
public class MultipleContainersTest {

    @Drone
    @FirstApp
    AndroidDriver mobile_1;

    @Drone
    @SecondApp
    AndroidDriver mobile_2;

    @Deployment
    @Instrumentable // instruments APK by Selendroid server
    @TargetsContainer("android-1")
    public static Archive<?> getDeployment_1() {
        return ShrinkWrap.createFromZipFile(JavaArchive.class,
            new File("my_first.apk"));
    }

    @Deployment
    @Instrumentable(port = 8081) // instruments APK by Selendroid server
    @TargetsContainer("android-2")
    public static Archive<?> getDeployment_2() {
        return ShrinkWrap.createFromZipFile(JavaArchive.class,
            new File("my_second.apk"));
    }

    @Test
    @InSequence(1)
    public void test() {
        mobile_1.startActivity("my.fqcn.of.activity");
    }

    @Test
    @InSequence(2)
    public void test_2() {
        mobile_2.startActivity("my.fqcn.of.activity");
    }

In your arquillian.xml, you just specify two containers and two Drones.

<arquillian>
    <group qualifier="containers" default="true">
        <container qualifier="android_1" default="true">
            <configuration>
                <property name="avdName">my_first_avd</property>
            </configuration>
        </container>
        <container qualifier="android_2">
            <configuration>
                <property name="avdName">my_second_avd</property>
            </configuration>
        </container>
    </group>

    <extension qualifier="webdriver-firstapp">
        <property name="browser">android</property>
        <property name="remoteAddress">http://localhost:8080/wd/hub</property>
    </extension>

    <extension qualifier="webdriver-secondapp">
        <property name="browser">android</property>
        <property name="remoteAddress">http://localhost:8081/wd/hub</property>
    </extension>
</arquillian>

Lastly you have to create two annotations - FirstApp and SecondApp. You find information how to create them here

What we done in the example above is that you deploy my_first.apk to my_first_avd, my_second.apk to my_second_avd, and you have two Drones hence you control my_first.apk by Drone annotated with FirstApp and you control the second app by SecondApp Drone. Class scoped Drones can be used in one test method together. Note that in case you do these Drones class scoped, Selendroids are deployed only once for the whole test case. However in case you inject them as method scoped, underlying Selendroid server would be deployed and undeployed every test method hence performance-wise it would be little bit slower.

Complete information how to use Android Native plugin for ftesting can be found here.

Arquillian Recorder integration

This extension builds on top of Arquillian Recorder so by using above recorder and screenshooter extensions, these resources will appear in resulting exporter report in e.g. html file.

Cordova tests

Droidium can run Cordova tests as well. Droidium is able to test everything Selendroid is able to test since it is based on it.

Runtime dependencies

You have to have installed Android SDK locally on your machine and you have to set it up fully.

Be sure you set all environment properties like ANDROID_HOME and ANDROID_SDK_HOME+m +JAVA_HOME and HOME.

You have to have Java installed locally as well. Droidium is developed against Java 1.6.

Example projects

Example project which show various usecases of Droidium are the part of this project and can be found here:

You can generate your own project via archetypes. They can be found here

How to install Arquillian Droidium?

mvn clean install

How to use Android container native application testing?

Please find respective README and configuration documentation in its respective directory. You can find archetypes for native testing in archetype directory so you can boostrap your testing process significantly faster. You can also take a look into tests directory. There is bunch of example projects how to use it with very deep documentation.

How to generate Javadoc?

mvn javadoc:aggregate

JIRA & Issue tracker

You are welcome to raise your issues at JBoss JIRA for Droidium component:

org.arquillian.extension

An Innovative Testing Platform for the JVM

Versions

Version
1.0.1.Final
1.0.0.Final
1.0.0.Alpha6