Testing Fundamentals of Flutter [Course]

We have some very exciting testing news to share! A few months ago, our teammate Jorge developed a comprehensive Lesson on Flutter Testing for Caster.IO.

2 min read

We have some very exciting testing news to share! A few months ago, our teammate Jorge developed a comprehensive Lesson on Flutter Testing for Caster.IO. While Caster.IO has since ceased operations, we are very fortunate to be the new home for hosting Jorge’s Flutter testing content.

The best part is: it’s now free! 

We are very excited to make this content available to the developer community because we strongly believe that testing is a crucial part of the development process. It can make or break your application—lack of tests or offloading testing to a separate development team could lead to low-quality applications and last minute scrambles to squash bugs before launch.

In contrast, integrating testing into the development process can increase confidence in your codebase and ensure that your app is able to ship at any point.

This course will provide a nice foundation for Flutter developers looking to learn the fundamentals of testing, or serve as a handy reference for more experienced developers.

We plan to release the full course in three batches over the next few weeks according to the below schedule. You can view all of the content on this YouTube playlist.

Testing Fundamentals of Flutter Tutorial Schedule

Week 1

Lesson 1: What is the difference between unit testing, widget testing, and integration testing? 

Lesson 2: Writing your first unit test 

Lesson 3: Running your test from the terminal

Lesson 4: The structure of a good test

Lesson 5: Using expect() in your tests

Lesson 6: All you need to know about Matchers

Lesson 7: Grouping your tests using the group() function

Lesson 8: Testing code that throws an Error or an Exception

Lesson 9: Sharing code between tests with setUp() and tearDown()

Week 2

Lesson 10: Testing Futures

Lesson 11: Testing Streams

Lesson 12: Writing your first widget test

Lesson 13: The difference between pumpWidget(), pump(), and pumpAndSettle()

Lesson 14: Finding a widget in your widget tree using CommonFinders

Lesson 15: Interacting with your widgets using WidgetTester

Lesson 16: Verifying your widget tests using a Matcher from flutter_test

Lesson 17: Testing smaller widgets in isolation

Week 3

Lesson 18: Controlling the behavior of your dependencies using mockito

Lesson 19: Stubbing synchronous methods with mockito

Lesson 20: Stubbing asynchronous methods with mockito

Lesson 21: Verifying interactions with mockito

Lesson 22: Using golden files to verify pixel-perfect widgets

Lesson 23: Collecting code coverage from your tests

Lesson 24: Running integration tests with flutter_driver

Lesson 25: Taking automated screenshots of your application

Lesson 26: Running your tests on GitHub Actions

Lesson 27: Using Codemagic for your CI/CD needs

Ready to learn more? Read our Very Good Guide to Flutter Testing.

Frequently Asked Questions

Where can I watch the Testing Fundamentals of Flutter course?

The full course is free on the VGV YouTube playlist. It was originally produced for Caster.IO by VGV's Jorge Coca, and after Caster.IO ceased operations, VGV brought it home and made it free.

What does the course cover?

27 lessons split across three weeks. Week one covers unit testing fundamentals: matchers, expect, group, setUp, and testing errors. Week two moves into widget testing with pumpWidget, finders, and WidgetTester. Week three covers mockito, golden files, code coverage, integration tests with flutter_driver, and CI on GitHub Actions and Codemagic.

Is this course for beginners or experienced Flutter developers?

Both. The lessons start with the difference between unit, widget, and integration tests, so a developer new to Flutter testing can use it as a foundation. More experienced developers can skip ahead and use it as a reference for specific topics like golden files or stubbing async methods with mockito.

Why does VGV care this much about Flutter testing?

Lack of tests can lead to low-quality apps and last-minute scrambles to fix bugs before launch. Integrating testing into the development process raises confidence in the codebase and means the app is shippable at any point. The Very Good Guide to Flutter Testing goes deeper on the why.