Readable Unit Tests in Dart/Flutter | BDD | Shouldly | Given When Then

Опубликовано: 05 Май 2026
на канале: DesignCodeArt
679
20

In this video, you will learn how to write more readable and expressive unit tests. You will know about BDD (Behavior-driven development). And how BDD and TDD work together.

This is the second part of the course "Testing Adventures in Flutter". The first part you can watch here    • Flutter GetX Testing: Unit Tests | part 1  

Text version in the articles below:
ENG: https://dev.to/andrew_piterov/readabl...
RU: https://habr.com/ru/post/666196

Plugins:
Shouldly: https://pub.dev/packages/shouldly
GivenWhenThen: https://pub.dev/packages/given_when_t...

00:00 Intro
00:57 Three parts of any test
02:20 Shouldly
02:20 Shouldly: refactoring
07:00 Shouldly: better failure messages
08:50 Shouldly: no mix up with actual and expected
10:27 Shouldly: no big heap of assertions
10:50 Shouldly: more features: Conjunction, SatisfyAll, Custom matchers, etc.
11:53 BDD Introduction
13:24 BDD Process: Given-When-Then
15:40 BDD vs TDD
17:07 Given-When-Then: refactoring
21:30 Test Cases
31:29 - Wrap up
31:44 - Upcoming video: More interesting and complex unit tests