Skip to content
This repository has been archived by the owner on Dec 7, 2019. It is now read-only.

Handle app process crash. #95

Merged
merged 1 commit into from
Aug 9, 2017
Merged

Handle app process crash. #95

merged 1 commit into from
Aug 9, 2017

Conversation

dmitry-novikov
Copy link
Contributor

Fixes issue when Composer fails to recognize that app process under the test is crashed that leads to successful completion.

}

if (second == null) null else first to second
}
.filterNotNull()
.map { (first, second) ->
InstrumentationTest(
index = first.current,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Printing test index and total test count sharded to particular device really helps.

Copy link
Collaborator

@artem-zinnatullin artem-zinnatullin left a comment

Choose a reason for hiding this comment

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

Great!

Exception("Instrumentation was unable to run tests using runner $runner.\n" +
private fun String.throwIfError(output: File) = when {
contains("INSTRUMENTATION_RESULT: shortMsg=Process crashed") -> {
throw Exception("Application process crashed. Check Logcat output for more details.")
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice

.takeWhile { !it.startsWith("INSTRUMENTATION_CODE") }
.map { it.throwIfError(output) }
.takeWhile {
// `INSTRUMENTATION_CODE: <code>` is the last line printed by instrumentation, even if 0 tests were run.
Copy link
Collaborator

Choose a reason for hiding this comment

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

thx for fix

)
}
adbDevice.log(
"Test ${test.index}/${test.total} $status in " +
Copy link
Collaborator

Choose a reason for hiding this comment

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

Super nice, I actually wanted this in #82

@yunikkk yunikkk merged commit beae497 into master Aug 9, 2017
@artem-zinnatullin artem-zinnatullin deleted the dn/handle-app-process-crash branch August 10, 2017 01:16
@artem-zinnatullin
Copy link
Collaborator

@yunikkk can you ship a release with this please?

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