Connect to project
The framework has three libraries that could be added as dependencies.
com.atiurin:ultron-compose- could be used both for Android application and Compose Multiplatform UI testscom.atiurin:ultron-android- native Android UI tests based on Espresso(including web part) and UI Automatorcom.atiurin:ultron-allure- Allure report support for Android application UI tests and for Compose Multiplatform tests (desktop, iOS, macOS, js, wasmJs); see Allure for Compose Multiplatform
You need mavenCentral repository.
repositories {
mavenCentral()
}
Android application instrumented UI tests
dependencies {
androidTestImplementation("com.atiurin:ultron-compose:<latest_version>")
androidTestImplementation("com.atiurin:ultron-android:<latest_version>")
androidTestImplementation("com.atiurin:ultron-allure:<latest_version>")
}
ultron-allure is a Kotlin Multiplatform artifactSince 2.7.0, when it gained Compose Multiplatform support, com.atiurin:ultron-allure is published like ultron-common and ultron-compose: a root module with Gradle module metadata, and the Android AAR in the com.atiurin:ultron-allure-android artifact. Gradle consumers need no change, the declaration above resolves the Android variant. Notations that address the file directly, such as com.atiurin:ultron-allure:<latest_version>@aar, and build tools that read only the POM (Maven, Bazel rules_jvm_external) must reference com.atiurin:ultron-allure-android:<latest_version> instead.
Upgrading from 2.6.x to 2.7.0
New in 2.7.0: Allure for Compose Multiplatform — the same ultron-allure module now reports desktop, iOS, macOS, js and wasmJs tests.
Code compiled against 2.6.x links without a rebuild. What can change for an existing Android project:
- Artifact layout.
com.atiurin:ultron-allureis now a Kotlin Multiplatform root module, the AAR iscom.atiurin:ultron-allure-android(see the note above). Gradle dependencies need no change;@aarnotations, Maven and Bazel do. UltronTest.testgot an optionalnameparameter in third position.test { },test(true) { }andtest(true, false) { }compile as before; a lambda passed positionally inside the parentheses,test(false, false, { }), does not — use a trailing lambda. Java callers usetest(false, false, null, block).- A failing
beforeTestnow fails the test without running its blocks, andafterTeststill runs. Before, the exception escaped beforeafterTest. An exception ofafterTestis dropped when the test has already failed. beforeFirstTestruns once per class identified by its qualified name, so two classes with the same simple name in different packages each run it. See UltronTest.AllureAttachStrategy.TEST_FINISHis a new value. An exhaustivewhenoverAllureAttachStrategyneeds a branch for it.
Compose Multiplatform UI tests
kotlin {
sourceSets {
commonTest.dependencies {
implementation("com.atiurin:ultron-compose:<latest_version>")
implementation("com.atiurin:ultron-allure:<latest_version>") // optional, 2.7.0+: Allure reports, see Allure for Compose Multiplatform
}
}
}
Since Multiplatform support in alpha state it's possible to have some problems with commonTest usage.
In this case you can specify dependencies in relevant part.
kotlin {
androidTarget {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
instrumentedTestVariant {
...
dependencies {
implementation("com.atiurin:ultron-compose:<latest_version>")
}
}
}
sourceSets {
val desktopTest by getting {
dependencies {
implementation("com.atiurin:ultron-compose:<latest_version>")
}
}
}
}