Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Add current AllureAndroidListener to other listeners in bundle #4

Conversation

Grigory-Rylov
Copy link
Contributor

Don't clear other listeners in bundle.

@@ -12,7 +13,14 @@ import android.support.test.runner.AndroidJUnitRunner
@Keep
open class AllureAndroidRunner : AndroidJUnitRunner() {
override fun onCreate(arguments: Bundle) {
arguments.putCharSequence("listener", AllureAndroidListener::class.java.name)
val oldListeners: String? = arguments.getString("listener")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

usage of getString is not so universal as getCharSequence

Copy link
Contributor Author

@Grigory-Rylov Grigory-Rylov Mar 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you look at source code in AOSP, they used bundle.getString(ARGUMENT_LISTENER) in listeners parsing

listenersStringBuilder.append(",")
}
listenersStringBuilder.append(AllureAndroidListener::class.java.name)
arguments.putCharSequence("listener", listenersStringBuilder.toString())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can be written more kotlin-way, e. g:

arguments.putCharSequence("listener", arguments.getCharSequence("listener")
        ?.let {
            "$it,${AllureAndroidListener::class.java.name}"
        }
        ?: AllureAndroidListener::class.java.name)

@Grigory-Rylov Grigory-Rylov force-pushed the dont_clear_old_run_listeners branch from 70857b3 to 2b5ec67 Compare March 1, 2018 05:06
Copy link
Contributor

@Badya Badya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contribution, great improvement!

@andrushsha andrushsha merged commit 208fb5e into allure-framework:master Mar 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants