From 4eb79b56939a10b9696945c3df04a7e579e9962e Mon Sep 17 00:00:00 2001 From: Anton Malinskiy Date: Wed, 23 Dec 2020 23:08:42 +1100 Subject: [PATCH] feature(test): support unknown INSTRUMENTATION_CODE values (#13) * feature(test): support unknown INSTRUMENTATION_CODE values --- .../InstrumentationResponseTransformer.kt | 16 +- .../InstrumentationResponseTransformerTest.kt | 23 + .../resources/instrumentation/log_6.expected | 122 +++++ .../resources/instrumentation/log_6.input | 455 ++++++++++++++++++ 4 files changed, 615 insertions(+), 1 deletion(-) create mode 100644 src/test/resources/instrumentation/log_6.expected create mode 100644 src/test/resources/instrumentation/log_6.input diff --git a/src/main/kotlin/com/malinskiy/adam/request/transform/InstrumentationResponseTransformer.kt b/src/main/kotlin/com/malinskiy/adam/request/transform/InstrumentationResponseTransformer.kt index 8c5e57353..eb0c8c5ef 100644 --- a/src/main/kotlin/com/malinskiy/adam/request/transform/InstrumentationResponseTransformer.kt +++ b/src/main/kotlin/com/malinskiy/adam/request/transform/InstrumentationResponseTransformer.kt @@ -90,6 +90,12 @@ class InstrumentationResponseTransformer : ResponseTransformer?> } } + /** + * 1 - Test running + * 0 - Test passed + * -2 - assertion failure + * -1 - other exceptions + */ private fun parseStatusCode(last: String, atom: List): List? { val value = last.substring(TokenType.INSTRUMENTATION_STATUS_CODE.name.length + 1).trim() val parameters: Map = atom.toMap() @@ -169,6 +175,11 @@ class InstrumentationResponseTransformer : ResponseTransformer?> } } + /** + * Session Result Code: + * -1: Success + * other: Failure + */ private fun parseInstrumentationCode( last: String, atom: List @@ -190,7 +201,10 @@ class InstrumentationResponseTransformer : ResponseTransformer?> finishReported = true listOf(TestRunEnded(time, metrics)) } - else -> null + else -> { + finishReported = true + listOf(TestRunFailed("Unexpected INSTRUMENTATION_CODE: $code")) + } } } } diff --git a/src/test/kotlin/com/malinskiy/adam/request/transform/InstrumentationResponseTransformerTest.kt b/src/test/kotlin/com/malinskiy/adam/request/transform/InstrumentationResponseTransformerTest.kt index 07fdffd00..be4f619c6 100644 --- a/src/test/kotlin/com/malinskiy/adam/request/transform/InstrumentationResponseTransformerTest.kt +++ b/src/test/kotlin/com/malinskiy/adam/request/transform/InstrumentationResponseTransformerTest.kt @@ -147,4 +147,27 @@ class InstrumentationResponseTransformerTest { .isEqualTo(javaClass.getResourceAsStream("/instrumentation/log_5.expected").reader().readText()) } } + + /** + * This is purely theoretical scenario since this hasn't been observed in practice but is possible + */ + @Test + fun testOtherFailure() = runBlocking { + val transformer = InstrumentationResponseTransformer() + + val lines = javaClass.getResourceAsStream("/instrumentation/log_6.input").reader().readLines() + + val events = mutableListOf() + for (line in lines) { + val bytes = (line + '\n').toByteArray(Const.DEFAULT_TRANSPORT_ENCODING) + transformer.process(bytes, 0, bytes.size) + transformer.transform()?.let { + events.addAll(it) + } + } + transformer.close()?.let { events.addAll(it) } + + assertThat(events.map { it.toString() }.reduce { acc, s -> acc + "\n" + s }) + .isEqualTo(javaClass.getResourceAsStream("/instrumentation/log_6.expected").reader().readText()) + } } diff --git a/src/test/resources/instrumentation/log_6.expected b/src/test/resources/instrumentation/log_6.expected new file mode 100644 index 000000000..ee9e5fd1d --- /dev/null +++ b/src/test/resources/instrumentation/log_6.expected @@ -0,0 +1,122 @@ +TestRunStartedEvent(testCount=9) +TestStarted(id=TestIdentifier(className=com.example.MainActivityFlakyTest, testName=testTextFlaky)) +TestEnded(id=TestIdentifier(className=com.example.MainActivityFlakyTest, testName=testTextFlaky), metrics={}) +TestStarted(id=TestIdentifier(className=com.example.MainActivityFlakyTest, testName=testTextFlaky1)) +TestEnded(id=TestIdentifier(className=com.example.MainActivityFlakyTest, testName=testTextFlaky1), metrics={}) +TestStarted(id=TestIdentifier(className=com.example.MainActivityFlakyTest, testName=testTextFlaky2)) +TestEnded(id=TestIdentifier(className=com.example.MainActivityFlakyTest, testName=testTextFlaky2), metrics={}) +TestStarted(id=TestIdentifier(className=com.example.MainActivityFlakyTest, testName=testTextFlaky3)) +TestEnded(id=TestIdentifier(className=com.example.MainActivityFlakyTest, testName=testTextFlaky3), metrics={}) +TestStarted(id=TestIdentifier(className=com.example.MainActivityFlakyTest, testName=testTextFlaky4)) +TestFailed(id=TestIdentifier(className=com.example.MainActivityFlakyTest, testName=testTextFlaky4), stackTrace=java.lang.AssertionError + at org.junit.Assert.fail(Assert.java:86) + at org.junit.Assert.assertTrue(Assert.java:41) + at org.junit.Assert.assertTrue(Assert.java:52) + at com.example.MainActivityFlakyTest.testTextFlaky4(MainActivityFlakyTest.kt:57) + at java.lang.reflect.Method.invoke(Native Method) + at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) + at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) + at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) + at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) + at android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:433) + at org.junit.rules.RunRules.evaluate(RunRules.java:20) + at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runners.Suite.runChild(Suite.java:128) + at org.junit.runners.Suite.runChild(Suite.java:27) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runner.JUnitCore.run(JUnitCore.java:137) + at org.junit.runner.JUnitCore.run(JUnitCore.java:115) + at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:58) + at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:375) + at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1932)) +TestEnded(id=TestIdentifier(className=com.example.MainActivityFlakyTest, testName=testTextFlaky4), metrics={}) +TestStarted(id=TestIdentifier(className=com.example.MainActivityFlakyTest, testName=testTextFlaky5)) +TestEnded(id=TestIdentifier(className=com.example.MainActivityFlakyTest, testName=testTextFlaky5), metrics={}) +TestStarted(id=TestIdentifier(className=com.example.MainActivityFlakyTest, testName=testTextFlaky6)) +TestFailed(id=TestIdentifier(className=com.example.MainActivityFlakyTest, testName=testTextFlaky6), stackTrace=java.lang.AssertionError + at org.junit.Assert.fail(Assert.java:86) + at org.junit.Assert.assertTrue(Assert.java:41) + at org.junit.Assert.assertTrue(Assert.java:52) + at com.example.MainActivityFlakyTest.testTextFlaky6(MainActivityFlakyTest.kt:69) + at java.lang.reflect.Method.invoke(Native Method) + at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) + at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) + at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) + at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) + at android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:433) + at org.junit.rules.RunRules.evaluate(RunRules.java:20) + at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runners.Suite.runChild(Suite.java:128) + at org.junit.runners.Suite.runChild(Suite.java:27) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runner.JUnitCore.run(JUnitCore.java:137) + at org.junit.runner.JUnitCore.run(JUnitCore.java:115) + at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:58) + at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:375) + at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1932)) +TestEnded(id=TestIdentifier(className=com.example.MainActivityFlakyTest, testName=testTextFlaky6), metrics={}) +TestStarted(id=TestIdentifier(className=com.example.MainActivityFlakyTest, testName=testTextFlaky7)) +TestFailed(id=TestIdentifier(className=com.example.MainActivityFlakyTest, testName=testTextFlaky7), stackTrace=java.lang.AssertionError + at org.junit.Assert.fail(Assert.java:86) + at org.junit.Assert.assertTrue(Assert.java:41) + at org.junit.Assert.assertTrue(Assert.java:52) + at com.example.MainActivityFlakyTest.testTextFlaky7(MainActivityFlakyTest.kt:75) + at java.lang.reflect.Method.invoke(Native Method) + at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) + at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) + at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) + at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) + at android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:433) + at org.junit.rules.RunRules.evaluate(RunRules.java:20) + at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runners.Suite.runChild(Suite.java:128) + at org.junit.runners.Suite.runChild(Suite.java:27) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runner.JUnitCore.run(JUnitCore.java:137) + at org.junit.runner.JUnitCore.run(JUnitCore.java:115) + at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:58) + at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:375) + at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1932)) +TestEnded(id=TestIdentifier(className=com.example.MainActivityFlakyTest, testName=testTextFlaky7), metrics={}) +TestStarted(id=TestIdentifier(className=com.example.MainActivityFlakyTest, testName=testTextFlaky8)) +TestEnded(id=TestIdentifier(className=com.example.MainActivityFlakyTest, testName=testTextFlaky8), metrics={}) +TestRunFailed(error=Unexpected INSTRUMENTATION_CODE: 0) \ No newline at end of file diff --git a/src/test/resources/instrumentation/log_6.input b/src/test/resources/instrumentation/log_6.input new file mode 100644 index 000000000..0e9108489 --- /dev/null +++ b/src/test/resources/instrumentation/log_6.input @@ -0,0 +1,455 @@ +INSTRUMENTATION_STATUS: numtests=9 +INSTRUMENTATION_STATUS: stream= +com.example.MainActivityFlakyTest: +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=testTextFlaky +INSTRUMENTATION_STATUS: class=com.example.MainActivityFlakyTest +INSTRUMENTATION_STATUS: current=1 +INSTRUMENTATION_STATUS_CODE: 1 +INSTRUMENTATION_STATUS: numtests=9 +INSTRUMENTATION_STATUS: stream=. +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=testTextFlaky +INSTRUMENTATION_STATUS: class=com.example.MainActivityFlakyTest +INSTRUMENTATION_STATUS: current=1 +INSTRUMENTATION_STATUS_CODE: 0 +INSTRUMENTATION_STATUS: numtests=9 +INSTRUMENTATION_STATUS: stream= +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=testTextFlaky1 +INSTRUMENTATION_STATUS: class=com.example.MainActivityFlakyTest +INSTRUMENTATION_STATUS: current=2 +INSTRUMENTATION_STATUS_CODE: 1 +INSTRUMENTATION_STATUS: numtests=9 +INSTRUMENTATION_STATUS: stream=. +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=testTextFlaky1 +INSTRUMENTATION_STATUS: class=com.example.MainActivityFlakyTest +INSTRUMENTATION_STATUS: current=2 +INSTRUMENTATION_STATUS_CODE: 0 +INSTRUMENTATION_STATUS: numtests=9 +INSTRUMENTATION_STATUS: stream= +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=testTextFlaky2 +INSTRUMENTATION_STATUS: class=com.example.MainActivityFlakyTest +INSTRUMENTATION_STATUS: current=3 +INSTRUMENTATION_STATUS_CODE: 1 +INSTRUMENTATION_STATUS: numtests=9 +INSTRUMENTATION_STATUS: stream=. +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=testTextFlaky2 +INSTRUMENTATION_STATUS: class=com.example.MainActivityFlakyTest +INSTRUMENTATION_STATUS: current=3 +INSTRUMENTATION_STATUS_CODE: 0 +INSTRUMENTATION_STATUS: numtests=9 +INSTRUMENTATION_STATUS: stream= +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=testTextFlaky3 +INSTRUMENTATION_STATUS: class=com.example.MainActivityFlakyTest +INSTRUMENTATION_STATUS: current=4 +INSTRUMENTATION_STATUS_CODE: 1 +INSTRUMENTATION_STATUS: numtests=9 +INSTRUMENTATION_STATUS: stream=. +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=testTextFlaky3 +INSTRUMENTATION_STATUS: class=com.example.MainActivityFlakyTest +INSTRUMENTATION_STATUS: current=4 +INSTRUMENTATION_STATUS_CODE: 0 +INSTRUMENTATION_STATUS: numtests=9 +INSTRUMENTATION_STATUS: stream= +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=testTextFlaky4 +INSTRUMENTATION_STATUS: class=com.example.MainActivityFlakyTest +INSTRUMENTATION_STATUS: current=5 +INSTRUMENTATION_STATUS_CODE: 1 +INSTRUMENTATION_STATUS: numtests=9 +INSTRUMENTATION_STATUS: stream= +Error in testTextFlaky4(com.example.MainActivityFlakyTest): +java.lang.AssertionError + at org.junit.Assert.fail(Assert.java:86) + at org.junit.Assert.assertTrue(Assert.java:41) + at org.junit.Assert.assertTrue(Assert.java:52) + at com.example.MainActivityFlakyTest.testTextFlaky4(MainActivityFlakyTest.kt:57) + at java.lang.reflect.Method.invoke(Native Method) + at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) + at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) + at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) + at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) + at android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:433) + at org.junit.rules.RunRules.evaluate(RunRules.java:20) + at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runners.Suite.runChild(Suite.java:128) + at org.junit.runners.Suite.runChild(Suite.java:27) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runner.JUnitCore.run(JUnitCore.java:137) + at org.junit.runner.JUnitCore.run(JUnitCore.java:115) + at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:58) + at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:375) + at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1932) + +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=testTextFlaky4 +INSTRUMENTATION_STATUS: class=com.example.MainActivityFlakyTest +INSTRUMENTATION_STATUS: stack=java.lang.AssertionError + at org.junit.Assert.fail(Assert.java:86) + at org.junit.Assert.assertTrue(Assert.java:41) + at org.junit.Assert.assertTrue(Assert.java:52) + at com.example.MainActivityFlakyTest.testTextFlaky4(MainActivityFlakyTest.kt:57) + at java.lang.reflect.Method.invoke(Native Method) + at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) + at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) + at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) + at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) + at android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:433) + at org.junit.rules.RunRules.evaluate(RunRules.java:20) + at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runners.Suite.runChild(Suite.java:128) + at org.junit.runners.Suite.runChild(Suite.java:27) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runner.JUnitCore.run(JUnitCore.java:137) + at org.junit.runner.JUnitCore.run(JUnitCore.java:115) + at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:58) + at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:375) + at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1932) + +INSTRUMENTATION_STATUS: current=5 +INSTRUMENTATION_STATUS_CODE: -2 +INSTRUMENTATION_STATUS: numtests=9 +INSTRUMENTATION_STATUS: stream= +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=testTextFlaky5 +INSTRUMENTATION_STATUS: class=com.example.MainActivityFlakyTest +INSTRUMENTATION_STATUS: current=6 +INSTRUMENTATION_STATUS_CODE: 1 +INSTRUMENTATION_STATUS: numtests=9 +INSTRUMENTATION_STATUS: stream=. +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=testTextFlaky5 +INSTRUMENTATION_STATUS: class=com.example.MainActivityFlakyTest +INSTRUMENTATION_STATUS: current=6 +INSTRUMENTATION_STATUS_CODE: 0 +INSTRUMENTATION_STATUS: numtests=9 +INSTRUMENTATION_STATUS: stream= +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=testTextFlaky6 +INSTRUMENTATION_STATUS: class=com.example.MainActivityFlakyTest +INSTRUMENTATION_STATUS: current=7 +INSTRUMENTATION_STATUS_CODE: 1 +INSTRUMENTATION_STATUS: numtests=9 +INSTRUMENTATION_STATUS: stream= +Error in testTextFlaky6(com.example.MainActivityFlakyTest): +java.lang.AssertionError + at org.junit.Assert.fail(Assert.java:86) + at org.junit.Assert.assertTrue(Assert.java:41) + at org.junit.Assert.assertTrue(Assert.java:52) + at com.example.MainActivityFlakyTest.testTextFlaky6(MainActivityFlakyTest.kt:69) + at java.lang.reflect.Method.invoke(Native Method) + at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) + at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) + at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) + at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) + at android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:433) + at org.junit.rules.RunRules.evaluate(RunRules.java:20) + at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runners.Suite.runChild(Suite.java:128) + at org.junit.runners.Suite.runChild(Suite.java:27) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runner.JUnitCore.run(JUnitCore.java:137) + at org.junit.runner.JUnitCore.run(JUnitCore.java:115) + at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:58) + at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:375) + at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1932) + +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=testTextFlaky6 +INSTRUMENTATION_STATUS: class=com.example.MainActivityFlakyTest +INSTRUMENTATION_STATUS: stack=java.lang.AssertionError + at org.junit.Assert.fail(Assert.java:86) + at org.junit.Assert.assertTrue(Assert.java:41) + at org.junit.Assert.assertTrue(Assert.java:52) + at com.example.MainActivityFlakyTest.testTextFlaky6(MainActivityFlakyTest.kt:69) + at java.lang.reflect.Method.invoke(Native Method) + at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) + at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) + at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) + at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) + at android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:433) + at org.junit.rules.RunRules.evaluate(RunRules.java:20) + at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runners.Suite.runChild(Suite.java:128) + at org.junit.runners.Suite.runChild(Suite.java:27) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runner.JUnitCore.run(JUnitCore.java:137) + at org.junit.runner.JUnitCore.run(JUnitCore.java:115) + at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:58) + at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:375) + at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1932) + +INSTRUMENTATION_STATUS: current=7 +INSTRUMENTATION_STATUS_CODE: -2 +INSTRUMENTATION_STATUS: numtests=9 +INSTRUMENTATION_STATUS: stream= +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=testTextFlaky7 +INSTRUMENTATION_STATUS: class=com.example.MainActivityFlakyTest +INSTRUMENTATION_STATUS: current=8 +INSTRUMENTATION_STATUS_CODE: 1 +INSTRUMENTATION_STATUS: numtests=9 +INSTRUMENTATION_STATUS: stream= +Error in testTextFlaky7(com.example.MainActivityFlakyTest): +java.lang.AssertionError + at org.junit.Assert.fail(Assert.java:86) + at org.junit.Assert.assertTrue(Assert.java:41) + at org.junit.Assert.assertTrue(Assert.java:52) + at com.example.MainActivityFlakyTest.testTextFlaky7(MainActivityFlakyTest.kt:75) + at java.lang.reflect.Method.invoke(Native Method) + at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) + at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) + at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) + at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) + at android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:433) + at org.junit.rules.RunRules.evaluate(RunRules.java:20) + at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runners.Suite.runChild(Suite.java:128) + at org.junit.runners.Suite.runChild(Suite.java:27) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runner.JUnitCore.run(JUnitCore.java:137) + at org.junit.runner.JUnitCore.run(JUnitCore.java:115) + at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:58) + at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:375) + at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1932) + +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=testTextFlaky7 +INSTRUMENTATION_STATUS: class=com.example.MainActivityFlakyTest +INSTRUMENTATION_STATUS: stack=java.lang.AssertionError + at org.junit.Assert.fail(Assert.java:86) + at org.junit.Assert.assertTrue(Assert.java:41) + at org.junit.Assert.assertTrue(Assert.java:52) + at com.example.MainActivityFlakyTest.testTextFlaky7(MainActivityFlakyTest.kt:75) + at java.lang.reflect.Method.invoke(Native Method) + at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) + at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) + at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) + at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) + at android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:433) + at org.junit.rules.RunRules.evaluate(RunRules.java:20) + at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runners.Suite.runChild(Suite.java:128) + at org.junit.runners.Suite.runChild(Suite.java:27) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runner.JUnitCore.run(JUnitCore.java:137) + at org.junit.runner.JUnitCore.run(JUnitCore.java:115) + at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:58) + at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:375) + at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1932) + +INSTRUMENTATION_STATUS: current=8 +INSTRUMENTATION_STATUS_CODE: -2 +INSTRUMENTATION_STATUS: numtests=9 +INSTRUMENTATION_STATUS: stream= +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=testTextFlaky8 +INSTRUMENTATION_STATUS: class=com.example.MainActivityFlakyTest +INSTRUMENTATION_STATUS: current=9 +INSTRUMENTATION_STATUS_CODE: 1 +INSTRUMENTATION_STATUS: numtests=9 +INSTRUMENTATION_STATUS: stream=. +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=testTextFlaky8 +INSTRUMENTATION_STATUS: class=com.example.MainActivityFlakyTest +INSTRUMENTATION_STATUS: current=9 +INSTRUMENTATION_STATUS_CODE: 0 +INSTRUMENTATION_RESULT: stream= + +Time: 5.832 +There were 3 failures: +1) testTextFlaky4(com.example.MainActivityFlakyTest) +java.lang.AssertionError + at org.junit.Assert.fail(Assert.java:86) + at org.junit.Assert.assertTrue(Assert.java:41) + at org.junit.Assert.assertTrue(Assert.java:52) + at com.example.MainActivityFlakyTest.testTextFlaky4(MainActivityFlakyTest.kt:57) + at java.lang.reflect.Method.invoke(Native Method) + at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) + at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) + at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) + at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) + at android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:433) + at org.junit.rules.RunRules.evaluate(RunRules.java:20) + at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runners.Suite.runChild(Suite.java:128) + at org.junit.runners.Suite.runChild(Suite.java:27) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runner.JUnitCore.run(JUnitCore.java:137) + at org.junit.runner.JUnitCore.run(JUnitCore.java:115) + at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:58) + at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:375) + at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1932) +2) testTextFlaky6(com.example.MainActivityFlakyTest) +java.lang.AssertionError + at org.junit.Assert.fail(Assert.java:86) + at org.junit.Assert.assertTrue(Assert.java:41) + at org.junit.Assert.assertTrue(Assert.java:52) + at com.example.MainActivityFlakyTest.testTextFlaky6(MainActivityFlakyTest.kt:69) + at java.lang.reflect.Method.invoke(Native Method) + at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) + at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) + at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) + at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) + at android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:433) + at org.junit.rules.RunRules.evaluate(RunRules.java:20) + at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runners.Suite.runChild(Suite.java:128) + at org.junit.runners.Suite.runChild(Suite.java:27) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runner.JUnitCore.run(JUnitCore.java:137) + at org.junit.runner.JUnitCore.run(JUnitCore.java:115) + at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:58) + at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:375) + at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1932) +3) testTextFlaky7(com.example.MainActivityFlakyTest) +java.lang.AssertionError + at org.junit.Assert.fail(Assert.java:86) + at org.junit.Assert.assertTrue(Assert.java:41) + at org.junit.Assert.assertTrue(Assert.java:52) + at com.example.MainActivityFlakyTest.testTextFlaky7(MainActivityFlakyTest.kt:75) + at java.lang.reflect.Method.invoke(Native Method) + at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) + at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) + at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) + at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) + at android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:433) + at org.junit.rules.RunRules.evaluate(RunRules.java:20) + at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runners.Suite.runChild(Suite.java:128) + at org.junit.runners.Suite.runChild(Suite.java:27) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runner.JUnitCore.run(JUnitCore.java:137) + at org.junit.runner.JUnitCore.run(JUnitCore.java:115) + at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:58) + at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:375) + at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1932) + +FAILURES!!! +Tests run: 9, Failures: 3 + + +INSTRUMENTATION_CODE: 0