forked from MarathonLabs/marathon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
74 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...main/kotlin/com/malinskiy/marathon/android/executor/listeners/CompositeTestRunListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.malinskiy.marathon.android.executor.listeners | ||
|
||
import com.android.ddmlib.testrunner.ITestRunListener | ||
import com.android.ddmlib.testrunner.TestIdentifier | ||
|
||
class CompositeTestRunListener(private val listeners: List<ITestRunListener>) : ITestRunListener { | ||
private inline fun execute(f: (ITestRunListener) -> Unit) { | ||
listeners.forEach(f) | ||
} | ||
|
||
override fun testRunStarted(runName: String?, testCount: Int) { | ||
execute { it.testRunStarted(runName, testCount) } | ||
} | ||
|
||
override fun testStarted(test: TestIdentifier?) { | ||
execute { it.testStarted(test) } | ||
} | ||
|
||
override fun testAssumptionFailure(test: TestIdentifier?, trace: String?) { | ||
execute { it.testAssumptionFailure(test, trace) } | ||
} | ||
|
||
override fun testRunStopped(elapsedTime: Long) { | ||
execute { it.testRunStopped(elapsedTime) } | ||
} | ||
|
||
override fun testFailed(test: TestIdentifier?, trace: String?) { | ||
execute { it.testFailed(test, trace) } | ||
} | ||
|
||
override fun testEnded(test: TestIdentifier?, testMetrics: MutableMap<String, String>?) { | ||
execute { it.testEnded(test, testMetrics) } | ||
} | ||
|
||
override fun testIgnored(test: TestIdentifier?) { | ||
execute { it.testIgnored(test) } | ||
} | ||
|
||
override fun testRunFailed(errorMessage: String?) { | ||
execute { it.testRunFailed(errorMessage) } | ||
} | ||
|
||
override fun testRunEnded(elapsedTime: Long, runMetrics: MutableMap<String, String>?) { | ||
execute { it.testRunEnded(elapsedTime, runMetrics) } | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
.../android/executor/DebugTestRunListener.kt → ...xecutor/listeners/DebugTestRunListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
.../src/main/kotlin/com/malinskiy/marathon/android/executor/listeners/NoOpTestRunListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.malinskiy.marathon.android.executor.listeners | ||
|
||
import com.android.ddmlib.testrunner.ITestRunListener | ||
import com.android.ddmlib.testrunner.TestIdentifier | ||
|
||
open class NoOpTestRunListener : ITestRunListener { | ||
override fun testRunStarted(runName: String, testCount: Int) {} | ||
|
||
override fun testStarted(test: TestIdentifier) {} | ||
|
||
override fun testFailed(test: TestIdentifier, trace: String) {} | ||
|
||
override fun testAssumptionFailure(test: TestIdentifier, trace: String) {} | ||
|
||
override fun testIgnored(test: TestIdentifier) {} | ||
|
||
override fun testEnded(test: TestIdentifier, testMetrics: Map<String, String>) {} | ||
|
||
override fun testRunFailed(errorMessage: String) {} | ||
|
||
override fun testRunStopped(elapsedTime: Long) {} | ||
|
||
override fun testRunEnded(elapsedTime: Long, runMetrics: Map<String, String>) {} | ||
} |