diff --git a/composer/src/main/kotlin/com/gojuno/composer/Instrumentation.kt b/composer/src/main/kotlin/com/gojuno/composer/Instrumentation.kt index 7809806..a47c939 100644 --- a/composer/src/main/kotlin/com/gojuno/composer/Instrumentation.kt +++ b/composer/src/main/kotlin/com/gojuno/composer/Instrumentation.kt @@ -33,7 +33,11 @@ enum class StatusCode(val code: Int) { AssumptionFailure(-4) } -data class InstrumentationEntry( +sealed class InstrumentationEntry { + /** + * Corresponds to entries starting with INSTRUMENTATION_STATUS + */ + data class Status( val numTests: Int, val stream: String, val id: String, @@ -43,7 +47,16 @@ data class InstrumentationEntry( val stack: String, val statusCode: StatusCode, val timestampNanos: Long -) + ): InstrumentationEntry() + + /** + * Corresponds to entries starting with INSTRUMENTATION_RESULT + */ + data class Result( + val message: String, + val timestampNanos: Long + ): InstrumentationEntry() +} private fun String.substringBetween(first: String, second: String): String { val indexOfFirst = indexOf(first) @@ -58,15 +71,21 @@ private fun String.substringBetween(first: String, second: String): String { return substring(startIndex, endIndex) } +private fun String.parseInstrumentationResultMessage() = Regex( + pattern = "INSTRUMENTATION_RESULT: (?:stream|shortMsg|longMsg)=(.*?)INSTRUMENTATION_CODE", + option = RegexOption.DOT_MATCHES_ALL +) + .find(this) + ?.groupValues + ?.get(1) + ?.trim() + ?: "" + private fun String.parseInstrumentationStatusValue(key: String): String = this .substringBetween("INSTRUMENTATION_STATUS: $key=", "INSTRUMENTATION_STATUS") .trim() private fun String.throwIfError(output: File) = when { - contains("INSTRUMENTATION_RESULT: shortMsg=") -> { - throw Exception("Application process crashed. Check Logcat output for more details.") - } - contains("INSTRUMENTATION_STATUS: Error=Unable to find instrumentation info for") -> { val runner = substringBetween("ComponentInfo{", "}").substringAfter("/") throw Exception( @@ -80,29 +99,34 @@ private fun String.throwIfError(output: File) = when { else -> this } -private fun parseInstrumentationEntry(str: String): InstrumentationEntry = - InstrumentationEntry( - numTests = str.parseInstrumentationStatusValue("numtests").toInt(), - stream = str.parseInstrumentationStatusValue("stream"), - stack = str.parseInstrumentationStatusValue("stack"), - id = str.parseInstrumentationStatusValue("id"), - test = str.parseInstrumentationStatusValue("test"), - clazz = str.parseInstrumentationStatusValue("class"), - current = str.parseInstrumentationStatusValue("current").toInt(), - statusCode = str.substringBetween("INSTRUMENTATION_STATUS_CODE: ", "INSTRUMENTATION_STATUS") - .trim() - .toInt() - .let { code -> - StatusCode.values().firstOrNull { it.code == code } - } - .let { statusCode -> - when (statusCode) { - null -> throw IllegalStateException("Unknown test status code [$statusCode], please report that to Composer maintainers $str") - else -> statusCode - } - }, - timestampNanos = System.nanoTime() - ) +private fun parseInstrumentationEntry(str: String): InstrumentationEntry = when { + str.startsWith("INSTRUMENTATION_RESULT") -> InstrumentationEntry.Result( + message = str.parseInstrumentationResultMessage(), + timestampNanos = System.nanoTime() + ) + else -> InstrumentationEntry.Status( + numTests = str.parseInstrumentationStatusValue("numtests").toInt(), + stream = str.parseInstrumentationStatusValue("stream"), + stack = str.parseInstrumentationStatusValue("stack"), + id = str.parseInstrumentationStatusValue("id"), + test = str.parseInstrumentationStatusValue("test"), + clazz = str.parseInstrumentationStatusValue("class"), + current = str.parseInstrumentationStatusValue("current").toInt(), + statusCode = str.substringBetween("INSTRUMENTATION_STATUS_CODE: ", "INSTRUMENTATION_STATUS") + .trim() + .toInt() + .let { code -> + StatusCode.values().firstOrNull { it.code == code } + } + .let { statusCode -> + when (statusCode) { + null -> throw IllegalStateException("Unknown test status code [$statusCode], please report that to Composer maintainers $str") + else -> statusCode + } + }, + timestampNanos = System.nanoTime() + ) +} // Reads stream in "tail -f" mode. fun readInstrumentationOutput(output: File): Observable { @@ -111,9 +135,9 @@ fun readInstrumentationOutput(output: File): Observable { return tail(output) .map(String::trim) .map { it.throwIfError(output) } - .takeWhile { + .takeUntil { // `INSTRUMENTATION_CODE: ` is the last line printed by instrumentation, even if 0 tests were run. - !it.startsWith("INSTRUMENTATION_CODE") + it.startsWith("INSTRUMENTATION_CODE") } .scan(Result()) { previousResult, newLine -> val buffer = when (previousResult.readyForProcessing) { @@ -121,70 +145,66 @@ fun readInstrumentationOutput(output: File): Observable { false -> "${previousResult.buffer}${System.lineSeparator()}$newLine" } - Result(buffer = buffer, readyForProcessing = newLine.startsWith("INSTRUMENTATION_STATUS_CODE")) + Result( + buffer = buffer, + readyForProcessing = newLine.startsWith("INSTRUMENTATION_STATUS_CODE") || newLine.startsWith("INSTRUMENTATION_CODE") + ) } .filter { it.readyForProcessing } - .map { it.buffer } + .map { it.buffer.trim() } .map(::parseInstrumentationEntry) } -fun Observable.asTests(): Observable { - data class Result(val entries: List = emptyList(), val tests: List = emptyList(), val totalTestsCount: Int = 0) - - return this - .scan(Result()) { previousResult, newEntry -> - val entries = previousResult.entries + newEntry - val tests: List = entries - .mapIndexed { index, first -> - val second = entries - .subList(index + 1, entries.size) - .firstOrNull { - first.clazz == it.clazz && - first.test == it.test && - first.current == it.current && - first.statusCode != it.statusCode - } - - if (second == null) null else first to second - } - .filterNotNull() - .map { (first, second) -> - InstrumentationTest( - index = first.current, - total = first.numTests, - className = first.clazz, - testName = first.test, - status = when (second.statusCode) { - StatusCode.Ok -> Passed - StatusCode.Ignored -> Ignored() - StatusCode.AssumptionFailure -> Ignored(stacktrace = second.stack) - StatusCode.Failure -> Failed(stacktrace = second.stack) - StatusCode.Start -> throw IllegalStateException( - "Unexpected status code [Start] in second entry, " + - "please report that to Composer maintainers ($first, $second)" - ) - }, - durationNanos = second.timestampNanos - first.timestampNanos - ) - } - - Result( - entries = entries.filter { entry -> tests.firstOrNull { it.className == entry.clazz && it.testName == entry.test } == null }, - tests = tests, - totalTestsCount = previousResult.totalTestsCount + tests.size +fun Observable.asTests(): Observable = buffer(2) + .filter { it.size == 2 } + .map { (first, second) -> + if (first !is InstrumentationEntry.Status) { + throw IllegalStateException( + "Unexpected order of instrumentation entries: encountered Result before a Status? " + + "This should never happen, please report this to Composer maintainers ($first, $second)" + ) + } + + val secondNormalized = second.normalize() + + InstrumentationTest( + index = first.current, + total = first.numTests, + className = first.clazz, + testName = first.test, + status = when (secondNormalized.statusCode) { + StatusCode.Ok -> Passed + StatusCode.Ignored -> Ignored() + StatusCode.AssumptionFailure -> Ignored(stacktrace = secondNormalized.stack) + StatusCode.Failure -> Failed(stacktrace = secondNormalized.stack) + StatusCode.Start -> throw IllegalStateException( + "Unexpected status code [Start] in second entry, " + + "please report that to Composer maintainers ($first, $second)" ) - } - .takeUntil { - if (it.entries.count { it.current == it.numTests } == 2) { - if (it.totalTestsCount < it.entries.first().numTests) { - throw IllegalStateException("Less tests were emitted than Instrumentation reported: $it") - } - - true - } else { - false - } - } - .filter { it.tests.isNotEmpty() } - .flatMap { Observable.from(it.tests) } + }, + durationNanos = secondNormalized.timestampNanos - first.timestampNanos + ) + } + +private data class NormalizedInstrumentationEntry( + val statusCode: StatusCode, + val stack: String, + val timestampNanos: Long +) + +/** + * @return a normalized set of data for this [InstrumentationEntry] + */ +private fun InstrumentationEntry.normalize() = when (this) { + is InstrumentationEntry.Status -> NormalizedInstrumentationEntry( + statusCode = statusCode, + stack = stack, + timestampNanos = timestampNanos + ) + is InstrumentationEntry.Result -> NormalizedInstrumentationEntry( + statusCode = StatusCode.Failure, /* if, after starting, our 2nd instrumentation entry is a Result instead of Status.. + we know the test execution ended prematurely and thus can be considered as a Failure */ + stack = message, + timestampNanos = timestampNanos + ) } diff --git a/composer/src/test/kotlin/com/gojuno/composer/InstrumentationSpec.kt b/composer/src/test/kotlin/com/gojuno/composer/InstrumentationSpec.kt index 430cbc4..4dbd21e 100644 --- a/composer/src/test/kotlin/com/gojuno/composer/InstrumentationSpec.kt +++ b/composer/src/test/kotlin/com/gojuno/composer/InstrumentationSpec.kt @@ -104,9 +104,17 @@ at android.support.test.runner.JunoAndroidRunner.onStart(JunoAndroidRunner.kt:10 at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:1932)""" stream = normalizeLinefeed(stream) + val expectedResultMessage = normalizeLinefeed("""Time: 96.641 +There was 1 failure: +1) test1(com.example.test.TestClass) +$stacktrace + +FAILURES!!! +Tests run: 4, Failures: 1""") + // We have no control over system time in tests. - assertThat(entriesSubscriber.onNextEvents.map { it.copy(timestampNanos = 0) }).isEqualTo(listOf( - InstrumentationEntry( + entriesSubscriber.assertValuesWithZeroedTimestamps(listOf( + InstrumentationEntry.Status( numTests = 4, stream = "com.example.test.TestClass:", id = "AndroidJUnitRunner", @@ -117,7 +125,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 statusCode = StatusCode.Start, timestampNanos = 0 ), - InstrumentationEntry( + InstrumentationEntry.Status( numTests = 4, stream = stream, id = "AndroidJUnitRunner", @@ -128,7 +136,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 statusCode = StatusCode.Failure, timestampNanos = 0 ), - InstrumentationEntry( + InstrumentationEntry.Status( numTests = 4, stream = "", id = "AndroidJUnitRunner", @@ -139,7 +147,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 statusCode = StatusCode.Start, timestampNanos = 0 ), - InstrumentationEntry( + InstrumentationEntry.Status( numTests = 4, stream = ".", id = "AndroidJUnitRunner", @@ -150,7 +158,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 statusCode = StatusCode.Ok, timestampNanos = 0 ), - InstrumentationEntry( + InstrumentationEntry.Status( numTests = 4, stream = "com.example.test.TestClass:", id = "AndroidJUnitRunner", @@ -161,7 +169,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 statusCode = StatusCode.Start, timestampNanos = 0 ), - InstrumentationEntry( + InstrumentationEntry.Status( numTests = 4, stream = ".", id = "AndroidJUnitRunner", @@ -172,7 +180,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 statusCode = StatusCode.Ok, timestampNanos = 0 ), - InstrumentationEntry( + InstrumentationEntry.Status( numTests = 4, stream = "", id = "AndroidJUnitRunner", @@ -183,7 +191,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 statusCode = StatusCode.Start, timestampNanos = 0 ), - InstrumentationEntry( + InstrumentationEntry.Status( numTests = 4, stream = ".", id = "AndroidJUnitRunner", @@ -193,6 +201,10 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 stack = "", statusCode = StatusCode.Ok, timestampNanos = 0 + ), + InstrumentationEntry.Result( + message = expectedResultMessage, + timestampNanos = 0 ) )) } @@ -256,7 +268,7 @@ at android.support.test.runner.JunoAndroidRunner.onStart(JunoAndroidRunner.kt:10 at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:1932)""" stacktrace = normalizeLinefeed(stacktrace) - assertThat(testsSubscriber.onNextEvents.map { it.copy(durationNanos = 0) }).isEqualTo(listOf( + testsSubscriber.assertValuesWithZeroedDurations(listOf( InstrumentationTest( index = 1, total = 4, @@ -312,8 +324,13 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 entriesSubscriber.awaitTerminalEvent(30, SECONDS) } - it("does not emit any entry") { - entriesSubscriber.assertNoValues() + it("emits no statuses, only the final result") { + entriesSubscriber.assertValuesWithZeroedTimestamps(listOf( + InstrumentationEntry.Result( + message = "Time: 0\n\nOK (0 tests)", + timestampNanos = 0 + ) + )) } it("completes stream") { @@ -347,144 +364,6 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 } } - context("read unordered output") { - - val entries by memoized { readInstrumentationOutput(fileFromJarResources("instrumentation-unordered-output.txt")) } - val entriesSubscriber by memoized { TestSubscriber() } - - perform { - entries.subscribe(entriesSubscriber) - entriesSubscriber.awaitTerminalEvent(30, SECONDS) - } - - it("emits expected entries") { - // We have no control over system time in tests. - assertThat(entriesSubscriber.onNextEvents.map { it.copy(timestampNanos = 0) }).isEqualTo(listOf( - InstrumentationEntry( - numTests = 3, - stream = "com.example.test.TestClass:", - id = "AndroidJUnitRunner", - test = "test1", - clazz = "com.example.test.TestClass", - current = 1, - stack = "", - statusCode = StatusCode.Start, - timestampNanos = 0 - ), - InstrumentationEntry( - numTests = 3, - stream = ".", - id = "AndroidJUnitRunner", - test = "test1", - clazz = "com.example.test.TestClass", - current = 1, - stack = "", - statusCode = StatusCode.Ok, - timestampNanos = 0 - ), - InstrumentationEntry( - numTests = 3, - stream = "com.example.test.TestClass:", - id = "AndroidJUnitRunner", - test = "test2", - clazz = "com.example.test.TestClass", - current = 2, - stack = "", - statusCode = StatusCode.Start, - timestampNanos = 0 - ), - InstrumentationEntry( - numTests = 3, - stream = "", - id = "AndroidJUnitRunner", - test = "test3", - clazz = "com.example.test.TestClass", - current = 3, - stack = "", - statusCode = StatusCode.Start, - timestampNanos = 0 - ), - InstrumentationEntry( - numTests = 3, - stream = ".", - id = "AndroidJUnitRunner", - test = "test2", - clazz = "com.example.test.TestClass", - current = 2, - stack = "", - statusCode = StatusCode.Ok, - timestampNanos = 0 - ), - InstrumentationEntry( - numTests = 3, - stream = ".", - id = "AndroidJUnitRunner", - test = "test3", - clazz = "com.example.test.TestClass", - current = 3, - stack = "", - statusCode = StatusCode.Ok, - timestampNanos = 0 - )) - ) - } - - it("completes stream") { - entriesSubscriber.assertCompleted() - } - - it("does not emit error") { - entriesSubscriber.assertNoErrors() - } - - context("as tests") { - - val testsSubscriber by memoized { TestSubscriber() } - - perform { - entries.asTests().subscribe(testsSubscriber) - testsSubscriber.awaitTerminalEvent(30, SECONDS) - } - - it("emits expected tests") { - assertThat(testsSubscriber.onNextEvents.map { it.copy(durationNanos = 0) }).isEqualTo(listOf( - InstrumentationTest( - index = 1, - total = 3, - className = "com.example.test.TestClass", - testName = "test1", - status = Passed, - durationNanos = 0L - ), - InstrumentationTest( - index = 2, - total = 3, - className = "com.example.test.TestClass", - testName = "test2", - status = Passed, - durationNanos = 0L - ), - InstrumentationTest( - index = 3, - total = 3, - className = "com.example.test.TestClass", - testName = "test3", - status = Passed, - durationNanos = 0L - ) - )) - } - - it("completes stream") { - testsSubscriber.assertCompleted() - } - - it("does not emit error") { - testsSubscriber.assertNoErrors() - } - } - } - context("read output with ignored test") { val entries by memoized { readInstrumentationOutput(fileFromJarResources("instrumentation-output-ignored-test.txt")) } @@ -497,8 +376,8 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 it("emits expected entries") { // We have no control over system time in tests. - assertThat(entriesSubscriber.onNextEvents.map { it.copy(timestampNanos = 0) }).isEqualTo(listOf( - InstrumentationEntry( + entriesSubscriber.assertValuesWithZeroedTimestamps(listOf( + InstrumentationEntry.Status( numTests = 2, stream = "com.example.test.TestClass:", id = "AndroidJUnitRunner", @@ -509,7 +388,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 statusCode = StatusCode.Start, timestampNanos = 0 ), - InstrumentationEntry( + InstrumentationEntry.Status( numTests = 2, stream = ".", id = "AndroidJUnitRunner", @@ -520,7 +399,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 statusCode = StatusCode.Ok, timestampNanos = 0 ), - InstrumentationEntry( + InstrumentationEntry.Status( numTests = 2, stream = "", id = "AndroidJUnitRunner", @@ -531,7 +410,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 statusCode = StatusCode.Start, timestampNanos = 0 ), - InstrumentationEntry( + InstrumentationEntry.Status( numTests = 2, stream = "", id = "AndroidJUnitRunner", @@ -541,8 +420,12 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 stack = "", statusCode = StatusCode.Ignored, timestampNanos = 0 - )) - ) + ), + InstrumentationEntry.Result( + message = "Time: 10.073\n\nOK (2 tests)", + timestampNanos = 0 + ) + )) } it("completes stream") { @@ -563,7 +446,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 } it("emits expected tests") { - assertThat(testsSubscriber.onNextEvents.map { it.copy(durationNanos = 0) }).isEqualTo(listOf( + testsSubscriber.assertValuesWithZeroedDurations(listOf( InstrumentationTest( index = 1, total = 2, @@ -629,8 +512,8 @@ at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.jav at android.app.Instrumentation${'$'}InstrumentationThread.run(Instrumentation.java:2074)""" stacktrace = normalizeLinefeed(stacktrace) - assertThat(entriesSubscriber.onNextEvents.map { it.copy(timestampNanos = 0) }).isEqualTo(listOf( - InstrumentationEntry( + entriesSubscriber.assertValuesWithZeroedTimestamps(listOf( + InstrumentationEntry.Status( numTests = 1, stream = "com.example.test.TestClass:", id = "AndroidJUnitRunner", @@ -641,7 +524,7 @@ at android.app.Instrumentation${'$'}InstrumentationThread.run(Instrumentation.ja statusCode = StatusCode.Start, timestampNanos = 0 ), - InstrumentationEntry( + InstrumentationEntry.Status( numTests = 1, stream = "com.example.test.TestClass:", id = "AndroidJUnitRunner", @@ -651,6 +534,10 @@ at android.app.Instrumentation${'$'}InstrumentationThread.run(Instrumentation.ja stack = stacktrace, statusCode = StatusCode.AssumptionFailure, timestampNanos = 0 + ), + InstrumentationEntry.Result( + message = "Time: ٠٫٠١٥\n\nOK (1 test)", + timestampNanos = 0 ) )) } @@ -704,7 +591,7 @@ at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:5 at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:375) at android.app.Instrumentation${'$'}InstrumentationThread.run(Instrumentation.java:2074)""" stacktrace = normalizeLinefeed(stacktrace) - assertThat(testsSubscriber.onNextEvents.map { it.copy(durationNanos = 0) }).isEqualTo(listOf( + testsSubscriber.assertValuesWithZeroedDurations(listOf( InstrumentationTest( index = 1, total = 1, @@ -750,10 +637,67 @@ at android.app.Instrumentation${'$'}InstrumentationThread.run(Instrumentation.ja entriesSubscriber.awaitTerminalEvent(30, SECONDS) } - it("emits exception describing issue") { - assertThat(entriesSubscriber.onErrorEvents.first()).hasMessage( - "Application process crashed. Check Logcat output for more details." - ) + it("emits expected entries") { + entriesSubscriber.assertValuesWithZeroedTimestamps(listOf( + InstrumentationEntry.Status( + numTests = 1, + stream = "com.example.test.TestClass:", + id = "AndroidJUnitRunner", + test = "crashTest", + clazz = "com.example.test.TestClass", + current = 1, + stack = "", + statusCode = StatusCode.Start, + timestampNanos = 0 + ), + InstrumentationEntry.Result( + message = "Process crashed.", + timestampNanos = 0 + ) + )) + } + + it("completes stream") { + entriesSubscriber.assertCompleted() + } + + it("does not emit error") { + entriesSubscriber.assertNoErrors() + } + + context("as tests") { + val testsSubscriber by memoized { TestSubscriber() } + + perform { + entries.asTests().subscribe(testsSubscriber) + testsSubscriber.awaitTerminalEvent(30, SECONDS) + } + + it("emits expected tests") { + testsSubscriber.assertValuesWithZeroedDurations(listOf( + InstrumentationTest( + index = 1, + total = 1, + className = "com.example.test.TestClass", + testName = "crashTest", + status = Failed(stacktrace = "Process crashed."), + durationNanos = 0L + ) + )) + } } } -}) \ No newline at end of file +}) + +private fun TestSubscriber.assertValuesWithZeroedDurations( + expectedValues: List +) = assertThat(onNextEvents.map { it.copy(durationNanos = 0) }).isEqualTo(expectedValues) + +private fun TestSubscriber.assertValuesWithZeroedTimestamps( + expectedValues: List +) = assertThat(onNextEvents.map { it.copy(timestampNanos = 0) }).isEqualTo(expectedValues) + +private fun InstrumentationEntry.copy(timestampNanos: Long) = when (this) { + is InstrumentationEntry.Status -> copy(timestampNanos = timestampNanos) + is InstrumentationEntry.Result -> copy(timestampNanos = timestampNanos) +} diff --git a/composer/src/test/resources/instrumentation-output-0-tests.txt b/composer/src/test/resources/instrumentation-output-0-tests.txt index 3f45b70..48b25f9 100644 --- a/composer/src/test/resources/instrumentation-output-0-tests.txt +++ b/composer/src/test/resources/instrumentation-output-0-tests.txt @@ -1,5 +1,3 @@ -Script started on Fri Mar 31 15:28:24 2017 -command: /usr/local/opt/android-sdk/platform-tools/adb -s emulator-5556 shell am instrument -w -r -e numShards 2 -e shardIndex 0 -e INSTRUMENTATION_RESULT: stream= Time: 0 diff --git a/composer/src/test/resources/instrumentation-output-app-crash.txt b/composer/src/test/resources/instrumentation-output-app-crash.txt index f1b6eef..5d914ff 100644 --- a/composer/src/test/resources/instrumentation-output-app-crash.txt +++ b/composer/src/test/resources/instrumentation-output-app-crash.txt @@ -3,10 +3,8 @@ INSTRUMENTATION_STATUS: stream= com.example.test.TestClass: INSTRUMENTATION_STATUS: id=AndroidJUnitRunner INSTRUMENTATION_STATUS: test=crashTest -INSTRUMENTATION_STATUS: class=com.example.test.TestClass: +INSTRUMENTATION_STATUS: class=com.example.test.TestClass INSTRUMENTATION_STATUS: current=1 INSTRUMENTATION_STATUS_CODE: 1 -INSTRUMENTATION_RESULT: shortMsg=java.lang.NullPointerException -INSTRUMENTATION_RESULT: longMsg=java.lang.NullPointerException: Attempt to invoke virtual method 'void java.util.logging.Logger.log(java.util.logging.Level, java.lang.String, java.lang.Throwable)' on a null object reference - -INSTRUMENTATION_CODE: 0 \ No newline at end of file +INSTRUMENTATION_RESULT: shortMsg=Process crashed. +INSTRUMENTATION_CODE: 0 diff --git a/composer/src/test/resources/instrumentation-output-failed-test.txt b/composer/src/test/resources/instrumentation-output-failed-test.txt index 56e45a7..fad3804 100644 --- a/composer/src/test/resources/instrumentation-output-failed-test.txt +++ b/composer/src/test/resources/instrumentation-output-failed-test.txt @@ -1,4 +1,3 @@ -adb shell am instrument -w -r -e numShards 20 -e shardIndex 1 com.example.test/android.support.test.runner.JunoAndroidRunner INSTRUMENTATION_STATUS: numtests=4 INSTRUMENTATION_STATUS: stream= com.example.test.TestClass: @@ -136,6 +135,7 @@ INSTRUMENTATION_STATUS: test=test4 INSTRUMENTATION_STATUS: class=com.example.test.TestClass INSTRUMENTATION_STATUS: current=4 INSTRUMENTATION_STATUS_CODE: 0 +INSTRUMENTATION_RESULT: stream= Time: 96.641 There was 1 failure: @@ -143,7 +143,6 @@ There was 1 failure: java.net.UnknownHostException: Test Exception at com.example.test.TestClass.test1.1.invoke(TestClass.kt:245) at com.example.test.TestClass.test1.1.invoke(TestClass.kt:44) - at com.example.test.screens.AddCreditCardScreen.Companion.invoke(AddCreditCardScreen.kt:23) at com.example.test.TestClass.test1(TestClass.kt:238) at java.lang.reflect.Method.invoke(Native Method) at org.junit.runners.model.FrameworkMethod.1.runReflectiveCall(FrameworkMethod.java:50) diff --git a/composer/src/test/resources/instrumentation-unordered-output.txt b/composer/src/test/resources/instrumentation-unordered-output.txt deleted file mode 100644 index 0f1a8c5..0000000 --- a/composer/src/test/resources/instrumentation-unordered-output.txt +++ /dev/null @@ -1,53 +0,0 @@ -INSTRUMENTATION_STATUS: numtests=3 -INSTRUMENTATION_STATUS: stream= -com.example.test.TestClass: -INSTRUMENTATION_STATUS: id=AndroidJUnitRunner -INSTRUMENTATION_STATUS: test=test1 -INSTRUMENTATION_STATUS: class=com.example.test.TestClass -INSTRUMENTATION_STATUS: current=1 -INSTRUMENTATION_STATUS_CODE: 1 -INSTRUMENTATION_STATUS: numtests=3 -INSTRUMENTATION_STATUS: stream=. -INSTRUMENTATION_STATUS: id=AndroidJUnitRunner -INSTRUMENTATION_STATUS: test=test1 -INSTRUMENTATION_STATUS: class=com.example.test.TestClass -INSTRUMENTATION_STATUS: current=1 -INSTRUMENTATION_STATUS_CODE: 0 -INSTRUMENTATION_STATUS: numtests=3 -INSTRUMENTATION_STATUS: stream= -com.example.test.TestClass: -INSTRUMENTATION_STATUS: id=AndroidJUnitRunner -INSTRUMENTATION_STATUS: test=test2 -INSTRUMENTATION_STATUS: class=com.example.test.TestClass -INSTRUMENTATION_STATUS: current=2 -INSTRUMENTATION_STATUS_CODE: 1 -INSTRUMENTATION_STATUS: numtests=3 -INSTRUMENTATION_STATUS: stream= -INSTRUMENTATION_STATUS: id=AndroidJUnitRunner -INSTRUMENTATION_STATUS: test=test3 -INSTRUMENTATION_STATUS: class=com.example.test.TestClass -INSTRUMENTATION_STATUS: current=3 -INSTRUMENTATION_STATUS_CODE: 1 -INSTRUMENTATION_STATUS: numtests=3 -INSTRUMENTATION_STATUS: stream=. -INSTRUMENTATION_STATUS: id=AndroidJUnitRunner -INSTRUMENTATION_STATUS: test=test2 -INSTRUMENTATION_STATUS: class=com.example.test.TestClass -INSTRUMENTATION_STATUS: current=2 -INSTRUMENTATION_STATUS_CODE: 0 -INSTRUMENTATION_STATUS: numtests=3 -INSTRUMENTATION_STATUS: stream=. -INSTRUMENTATION_STATUS: id=AndroidJUnitRunner -INSTRUMENTATION_STATUS: test=test3 -INSTRUMENTATION_STATUS: class=com.example.test.TestClass -INSTRUMENTATION_STATUS: current=3 -INSTRUMENTATION_STATUS_CODE: 0 - -Time: 0 - -OK (3 tests) - - -INSTRUMENTATION_CODE: -1 - -Script done on Fri Mar 31 15:28:27 2017