Skip to content

Commit 9fea826

Browse files
author
artyomcool
committed
Ability to add test listener
1 parent a66df6e commit 9fea826

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/main/kotlin/com/jaredsburrows/spoon/SpoonExtension.kt

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.jaredsburrows.spoon
22

3+
import com.android.ddmlib.testrunner.ITestRunListener
4+
35
/**
46
* Variables based on the following documentation:
57
* - https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner.html
@@ -78,7 +80,8 @@ open class SpoonExtension { // Extensions cannot be final
7880
/** Toggle sharding. (false by default) */
7981
var shard: Boolean = false
8082

81-
// TODO testRunListener
83+
/** Add listener for tests execution */
84+
var testRunListener: ITestRunListener? = null
8285

8386
// TODO terminateAdb
8487

src/main/kotlin/com/jaredsburrows/spoon/SpoonTask.kt

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.jaredsburrows.spoon
22

33
import com.android.ddmlib.testrunner.IRemoteAndroidTestRunner.TestSize
4+
import com.android.ddmlib.testrunner.ITestRunListener
5+
import com.android.ddmlib.testrunner.TestIdentifier
46
import com.squareup.spoon.SpoonRunner
57
import org.gradle.api.DefaultTask
68
import org.gradle.api.GradleException
@@ -55,6 +57,10 @@ open class SpoonTask : DefaultTask() {
5557
.setSingleInstrumentationCall(extension.singleInstrumentationCall)
5658
.setClearAppDataBeforeEachTest(extension.clearAppDataBeforeEachTest)
5759

60+
if (extension.testRunListener != null) {
61+
builder.addTestRunListener(extension.testRunListener)
62+
}
63+
5864
// APKs
5965
if (!testing) {
6066
builder.setTestApk(instrumentationApk)

0 commit comments

Comments
 (0)