Widget tests
I know that I can expect exceptions in widget tests:
However, I want to test for an Error or an Exception when running my app using flutter_driver.
Integration tests
Currently, I simply look at the logs when running test_driver and check if the logged exceptions are what I expect. However, that is not ideal and I want to integrate the exceptions into the rest of the integration testing.
flutterDriverLog
I found flutterDriverLog in the flutter_driver library, however, the exceptions do not appear there. It only sends records for the FlutterDriver status, e.g.:
[info ] FlutterDriver: Connecting to Flutter application at ..
[trace] FlutterDriver: Isolate found with number: ..
...
What I am looking for
I would love to have some code like this:
group('Some tests', () {
test('Button that throws an exception', () async {
await flutterDriver.tap(find.byType(IconButton));
// The following property and function do not exist.
expect(thatExceptionIsThrown, thatMatches('PlatformException(some_error'));
});
});
How do I do that when running FlutterDriver?