Flutter Unit Test Coaching

Published: 26 July 2023
on channel: FilledStacks
3,214
167

I’ve coached developers from not writing tests to loving unit tests.

Here are the 5 biggest unit test blockers and how to get over them:

Blockers:

1. I don’t know what to test

2. I don’t know how to test this function

3. The concern of testing something that doesn’t matter

4. When do I write the test

5. I don’t know how it will work yet so I can’t write the test

Solutions:

1. Test assumptions, state, interaction, conditionals, error handling

2. Start with X in, Y out. Then Do Calling X, changes state to Y

3. To start, write the tests you can write. You’ll learn this in time.

4. When you’re done with the code. Use it to “prove your code works”

5. Divide and conquer. Write tests for the small problems ONLY.