Chapter 11. Testing Flutter apps

 

This chapter covers

  • Writing Dart unit tests
  • Mocking HTTP calls
  • Writing Flutter widget tests
  • Writing Flutter integration tests with Flutter drive
  • Accessibility widgets in Flutter

In the roughly 100 interviews I’ve endured in my life, one of the most common questions the interviewer asks is, “What kind of testing do you do at your current job?” Trying to mask my inadequacy with humor, and hoping that the interviewer will just forget they care about testing code and move on, I always say, “Not as much as we should.” Which can be translated to “Not at all!” The only feeling of comfort I get from that is knowing that I’m not alone. (And, for the record, it’s never worked.)

The reason they ask about that, I think, is because it’s important, but often an afterthought. And that’s what this final chapter is about: subjects that are important, but often forgotten. First, I want to talk about testing Flutter apps. Towards the end, I’ll cover some built-in accessibility features in Flutter. You can think of this chapter as “things you should absolutely do for a production app, but probably aren’t needed for projects that’ll never leave your machine.”

11.1. Tests in Flutter

Testing in Flutter can be split into three categories:

11.1.1. Dart unit tests

 
 
 

11.1.2. Using mockito to test methods that need external dependencies

 

11.1.3. Flutter widget tests

 

11.1.4. Flutter integration tests

 
 
 

11.1.5. Performance profiling integration tests

 

11.2. Accessibility with the semantics widgets

 
 
 

11.3. Next steps with Flutter

 
 

Summary

 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest