Skip to content

Integration

Requirements

  • Android SDK: API 21

Gradle

AppeliumTests SDK can be found in the Appelium Maven repository. Add this line to your build.gradle file to access the Maven repository:

1
2
3
4
5
repositories {
    maven { 
        url 'https://maven.appelium.com/release' 
    }
}

To use the AppeliumTests SDK, add this line to your build.gradle file:

androidTestImplementation('com.appelium:appelium-tests:5.1.0:release@aar') {
    transitive = true
}

Usage

Since the UI Tests on Android are not a self-contained app, they don't have such an obvious entry point for doing initialization as using an Application class.

To workaround this limitation, you can create a base test class and initialize AppeliumTests in init.

Info

The AppeliumTests is built to accept only the first initialization call will, therefore it is safe to have multiple subclasses of BaseTest without worrying about creating many instances of AppeliumTests.

open class BaseTest {

    @Rule
    @JvmField
    val appeliumTestWatcher = AppeliumTestWatcher()

    init {
        AppeliumTests.Builder(apiKey = <#api key#>).build()

        // Optionally set the name and/or the version of the backend environment
        AppeliumTests.setTestExecutionEnvironment(name = "STAGING", version = "2.4.0")

        // Optionally set the name of the test plan (for example: Complete, Smokes, PR etc.)
        AppeliumTests.testPlanName = "Complete"
    }

}

You can create a new app token or find an existing one here.

Tests execution on multiple devices in parallel or using Test Orchestrator

Info

If you are running your UI tests in parallel on a single device or not using Test Orchestrator, you can skip this part - there is nothing more you need to set up.

If you are running tests on multiple devices or if each test is part of its own test execution, you would need to pass a UUID into your tests and then forward it to AppeliumTests.Builder. The UUID will then be used for grouping all tests together into one execution. The UUID can be generated in your Gradle scripts and then passed into your test as build config.

AppeliumTests.Builder(apiKey = <#api key#>)
    .setTestExecutionUuid(uuid = BuildConfig.getTestExecutionUuid())
    .build()

You can leverage the UUID described above for generating direct URLs to your test executions.

Using the uuid variable from the code snippet above, and WORKSPACE_NAME which you can find by navigating to your home page on Dashboard (the path component after https://dashboard.appelium.com ), you can construct the following URL:

https://dashboard.appelium.com/${WORKSPACE_NAME}/resolve?testsCorrelationUuid=${UUID}