Update test reports to show all exceptions thrown in flutter #2362
+107
−29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue:
Test reports don't contain useful info ("Multiple exceptions were thrown")
#951The first version (without calling
previousOnError
in ouronError
) didn't work with Patrol's finders. A test tapping on a widget that is not on a screen would hang without any logs instead of failing (maybe it has something to do with using async guards, not sure).Right now (with calling
previousOnError
in ouronError
) we don't catch all errors inonError
, but we do avoid theMultiple exceptions were thrown
message.Because we're intercepting the errors in
onError
, overridingreportTestException
is not needed. Moreover, it would collect theMultiple exceptions were thrown
message that can be created when we callpreviousOnError
ourselves.Probably the exceptions are thrown so close to each other, that us calling
previousOnError
makes them go through its code and we miss them.Original
onError
saves the error in a variable and when another one comes, it savesMultiple exceptions were thrown
message to this variable. There is a methodtakeException()
that assigns null to this variable, but trying to do it in ouronError
before callingpreviousOnError
doesn't work as expected (we do not take it out, so that theMultiple exceptions were thrown
is not saved and dumped to console).The conclusion is that we successfully show real exception descriptions instead of a general
Multiple exceptions were thrown
message. Although we get only two out of four known exceptions that should be caught inoverflow_test.dart
, this is still progress. The exceptions shown are the first ones to be thrown.