I need to access the tests result in tearDownAll
callback. I want to check if any of the tests failed during the execution.
tearDownAll(() async {
final success = // code here
});
I researched classes like Invoker
, Declarer
, Engine
, LiveTestController
and test_core.dart
file. Seems like this is the code that does what I need.
var success = await runZoned(() => Invoker.guard(engine.run),
zoneValues: {#test.declarer: _globalDeclarer});
if (success) return null;
print('');
unawaited(Future.error('Dummy exception to set exit code.'));
Unfortunately the engine
is not accessible from outside. I've also not found API for checking the tests result in test_core
library.
Is there a way to check if any of previous test has failed? I'd like use this inside a tearDownAll()
or test()
functions of a test group.