Loading topic
flutter_test test and that you know Dart abstract classes and implements. It also assumes your classes receive their dependencies through constructors, which the previous chapter covered. By the end you will have mocktail installed, a working Mock cla6 min readtest and setUp blocks with flutter_test. It also assumes you have a Mock subclass for an abstract class, as in the previous chapter. Here you will learn how to tell a mock what to return and when to throw. You will also see what the mock does when you tell 5 min readflutter_test tests, you know async/await, Future, and Stream, and you have already created a Mock class with mocktail and stubbed a synchronous method with when(...).thenReturn(...). It covers the rules for stubbing methods that return a `Future5 min readextends Mock implements ..., stub a method with when(...), and run tests with flutter_test. Stubbing basics and Futures were covered in earlier chapters. Here you will4 min readverify, call counts, verifyNever, verifyInOrder and verifyNoMoreInteractions, and how mocktail reports a failed check.4 min readwhen, and that you know how any() and verify work from the previous chapters. You should also be comfortable with setUpAll and setUp from flutter_test.5 min readwhen, verify with verify, and register fallback values with registerFallbackValue. Those topics are covered in earlier chapters.5 min readtest and testWidgets cases, that you know how to create a Mock subclass, and that you can stub with when and check calls with verify. It covers how mock state leaks between tests, and how to prevent that with setUp, reset, and clearInteractions.5 min readtestWidgets tests with WidgetTester, how FutureBuilder and StreamBuilder work, and how to create and stub a mocktail mock (when, thenAnswer, verify). The examples reuse User, UserRepository and MockUserRepository from earlier chapters. T4 min readwhen, and check calls with verify. It also assumes you know how to inject a dependency through a constructor. Here you decide when a mock is the wrong tool and a fake or the real object is better.5 min readwhen, verify, any() and registerFallbackValue, and that your mocks come from class MockX extends Mock implements X {}. Most mocktail failures come from a small set of causes. Once you can name the cause from the error text, fixing it 7 min read