Flutter: Unit and Widget Tests in Depth

Andrea Bizzotto
Code With Andrea
Published in
2 min readAug 3, 2018

Today I’m launching a new, in-depth video about Widget Tests.

This will give you a solid understanding about testing in Flutter, so that you can ensure your widgets behave as expected.

This is based on my Firebase authentication demo, which I have covered in my previous videos.

Full source code on GitHub:

Highlights

  • Overview of Widget tests: what they are and what they are used for
  • Review of Widget tests in the Flutter Sample Demo App
  • Use WidgetTester to trigger UI events, and write expectations with matcher objects
  • Explanation of WidgetTester.pump().
  • How to write Widget tests for a login screen
  • Introduction to test mocks, and how to write one
  • Introduction to mockito as a powerful tool to mock objects
  • From Acceptance Criteria to Widget Tests, in detail
  • Finding widgets by key
  • Write expectations with mockito
  • Use mocks to return values and throw errors

What about Unit Tests?

I have covered this in my previous video, which you can see here:

Want more? Here’s an article I have written some time ago about widget tests:

UPDATE: My Flutter & Firebase Udemy course is now available for Early Access. Use this link to enroll (discount code included):

For more articles and video tutorials, check out Code With Andrea.

I’m @biz84 on Twitter. You can also see my GitHub page. Did you like this article? Then smash that clap 👏 button! It makes me feel awesome so I can write more about Flutter. 😎

--

--