testing at different levels (i.e. unit and integration); Test-Driven Development; mocks and stubs; testing patterns (i.e. Four Phase testing)
Write tests to ensure your code continues to work after you make changes to it.
Consider using the apply first, study second approach with the learning tactic below: implement one of the practices from the Apply It section first. If you get stuck, then use the resources in the Reference section. The point is: the quicker you get to the “doing,” the better the learning. Make your learning active.
One reason why I like Exercism is its emphasis on tests. Each problem has at least two files: a file to write your solution and a file that contains a test suite. This setup makes for a perfect opportunity to learn to write tests and get familiar with Test-Driven Development (TDD).
Here’s how it works:
This process is simple but incredibly effective because you get immediate feedback on your tests. As you compare, notice how Exercism’s test cases ensure the program has the correct behavior, particularly edge cases. I followed this process to learn Pytest and Jest; the learning sticks because the process is active and you get feedback right away.
Fundamentals of TDD by thoughtbot is a free course that covers core tenants of TDD in a clear and approachable style. If you’re new to TDD, then focus on the first three lectures of this video course. This Four-Phase Test article, also by thoughtbot, offers a short and sweet overview of the four-phase testing pattern.
"It always seems impossible until it is done."
Martin Fowler’s free Software Testing Guide points to several testing-related articles that you may find useful.