diff --git a/allure-android-commons/src/main/kotlin/io/qameta/allure/android/AllureRunListener.kt b/allure-android-commons/src/main/kotlin/io/qameta/allure/android/AllureRunListener.kt index 2b8f8ad..d3205b6 100644 --- a/allure-android-commons/src/main/kotlin/io/qameta/allure/android/AllureRunListener.kt +++ b/allure-android-commons/src/main/kotlin/io/qameta/allure/android/AllureRunListener.kt @@ -54,8 +54,8 @@ open class AllureRunListener(private val lifecycle: AllureLifecycle = AllureComm * @param result the summary of the test run, including all the tests that failed */ @Throws(Exception::class) - override fun testRunFinished(result: Result) { - // do nothing + override fun testRunFinished(result: Result?) { + testRunFinished() } fun testRunFinished() { @@ -118,12 +118,7 @@ open class AllureRunListener(private val lifecycle: AllureLifecycle = AllureComm */ @Throws(Exception::class) override fun testFailure(failure: Failure) { - if (failure.description.isTest) { - val uuid = getUUIDTestResult(failure.description) - testWithException(uuid, failure) - } else { - suiteWithException(failure) - } + testWithException(failure) } /** @@ -135,7 +130,16 @@ open class AllureRunListener(private val lifecycle: AllureLifecycle = AllureComm */ @Throws(Exception::class) override fun testAssumptionFailure(failure: Failure) { - testFailure(failure) + testWithException(failure) + } + + private fun testWithException(failure: Failure) { + if (failure.description.isTest) { + val uuid = getUUIDTestResult(failure.description) + testWithException(uuid, failure) + } else { + suiteWithException(failure) + } } /** @@ -159,6 +163,14 @@ open class AllureRunListener(private val lifecycle: AllureLifecycle = AllureComm } } + private fun getIgnoredMessage(description: Description): StatusDetails { + val ignore = description.getAnnotation(Ignore::class.java) + val message = if (ignore?.value?.isNotEmpty() == true) + ignore.value else "Test ignored (without reason)!" + + return StatusDetails(message = message) + } + protected open fun finalizeContainer(container: String?) { with(lifecycle) { stopTestContainer(container) @@ -181,14 +193,6 @@ open class AllureRunListener(private val lifecycle: AllureLifecycle = AllureComm return container } - private fun getIgnoredMessage(description: Description): StatusDetails { - val ignore = description.getAnnotation(Ignore::class.java) - val message = if (ignore?.value?.isNotEmpty() == true) - ignore.value else "Test ignored (without reason)!" - - return StatusDetails(message = message) - } - private fun createTestResult(description: Description): TestResult = TestResult( uuid = getUUIDTestResult(description), historyId = getHistoryId(description), @@ -210,8 +214,6 @@ open class AllureRunListener(private val lifecycle: AllureLifecycle = AllureComm status = Status.fromThrowable(failure.exception) statusDetails = StatusDetails.fromThrowable(failure.exception) } - stopTestCase(uuid) - writeTestCase(uuid) } } diff --git a/allure-espresso/src/main/kotlin/io/qameta/allure/espresso/AllureAndroidListener.kt b/allure-espresso/src/main/kotlin/io/qameta/allure/espresso/AllureAndroidListener.kt index 9ae10a7..fc271f9 100644 --- a/allure-espresso/src/main/kotlin/io/qameta/allure/espresso/AllureAndroidListener.kt +++ b/allure-espresso/src/main/kotlin/io/qameta/allure/espresso/AllureAndroidListener.kt @@ -33,7 +33,7 @@ class AllureAndroidListener : InstrumentationRunListener() { } override fun testRunFinished(result: Result?) { - allureListenerDelegate.testRunFinished() + allureListenerDelegate.testRunFinished(result) } override fun testIgnored(description: Description) {