With Dart M3, the setUp function can return a Future if necessary. If setUp returns the future, the unittest framework will wait for future work to complete before running individual test methods.
Here is an example:
group(('database') { var db = createDb(); setUp(() { return openDatabase() .then((db) => populateForTests(db)); }); test('read', () { Future future = db.read('foo'); future.then((value) { expect(value, 'bar'); }); expect(future, completes); }); });
Learn more about setUp .
Seth ladd
source share