Allurе-android isn't supported anymore. Please, use allure-kotlin instead. For migration on allure-kotlin, please follow the guide.
Allure adapter for Android, which is written on Kotlin.
New version with support AndroidX, available here.
Add to: app/build.gradle
apply plugin: 'kotlin-android'
repositories {
mavenCentral()
maven { url 'https://dl.bintray.com/qameta/maven' }
}
dependencies {
androidTestCompile "io.qameta.allure:allure-android-commons:2.0.0"
androidTestCompile "io.qameta.allure:allure-android-model:2.0.0"
androidTestCompile "io.qameta.allure:allure-espresso:2.0.0"
androidTestCompile "org.jetbrains.kotlin:kotlin-stdlib:1.2.51"
androidTestCompile "junit:junit:4.12"
androidTestCompile "androidx.test.uiautomator:uiautomator:2.2.0"
}
android {
defaultConfig {
testInstrumentationRunner "io.qameta.allure.espresso.AllureAndroidRunner"
}
}
But be aware that new version isn't backward compatible with older versions.
Old version, without AndroidX, now not supported Add to: app/build.gradle
apply plugin: 'kotlin-android'
dependencies {
androidTestCompile "ru.tinkoff.allure:allure-android:2.5.1@aar"
androidTestCompile "ru.tinkoff.allure:allure-common:2.5.1"
androidTestCompile "ru.tinkoff.allure:allure-model:2.5.1"
androidTestCompile "org.jetbrains.kotlin:kotlin-stdlib:1.1.51"
androidTestCompile "junit:junit:4.12"
androidTestCompile "com.android.support.test.uiautomator:uiautomator-v18:2.1.2"
}
android {
defaultConfig {
testInstrumentationRunner "ru.tinkoff.allure.android.AllureAndroidRunner"
}
}
Just use comandline tools from Android sdk:
adb pull /sdcard/allure-results
You can use allure-commandline
for that, see Allure Docs for details, or generate report with allure-gradle plugin.
Look at #12 (comment) for more information.
Original Steps were improved:
- No more aspects required,
step
is an expression - Name required, but not limited with const value as in annotations
You can use DSL-style steps anywhere in test method:
@Test
fun test() {
step("First Step") {
...
}
step("Second Step") {
...
myStep("Param") // Steps can be nested
}
}
// Steps are expressions
fun myStep(param: String) = step("Do something with $param") {
...
}
Soft Assertion can be used to continue test execution in case of minor assertion.
SoftAssert
reports assertion inside Step
in which it raised.
SoftAssert marks test passed, result could be found only in report
DSL-style:
fun myStep() = step("MyStep") {
softly {
checkThat("FirstAssert", true, IsEqual(false))
}
}
Screenshot uses UIautomator and appends it to step, in which it was executed
@Test
fun test() {
deviceScreenshot("screenshot_name")
}
You can use FailshotRule
to capture a screenshot in case of Throwable
during test
class MyTest {
@get:Rule
val failshot = FailshotRule()
// ...
}
You can use LogcatDumpRule
, LogcatClearRule
to clear and capture a device logs in case of Throwable
during test
class MyTest {
@get:Rule
val ruleChain = RuleChain.outerRule(LogcatClearRule()).around(LogcatDumpRule())
// ...
}
You can use WindowHierarchyRule
to capture a window hierarchy via UIautomator in case of Throwable
during test
class MyTest {
@get:Rule
val windowHierarchyRule = WindowHierarchyRule()
// ...
}
You can use some allure annotation, like @DisplayName
, @Link
, @Issue
, @Owner
(only in new version), @SeverityLevel
(only in new version) and others.
Thanks to all people who contributed. Especially Tinkoff and @Badya who started and maintaining allure-android.
Allure Android is released under version 2.0 of the Apache License