A misc. collection of interesting TDD resources.
- Recap of major TDD principles
- How to think about refactoring as a key step in TDD
- A nice JS TDD setup
- Mocking is a code smell - The author suggests that the need for mocking suggests excessively tight coupling.
- James Shore on TDD Architecture that avoids mocks
- Reducing the scope of possible errors is the key to developing quickly. If you have total confidence that your software worked five minutes ago, then only the actions you’ve taken in the last five minutes could cause it to fail now.
- Kent Dodds’ Common Mistakes With React Testing Library. Note that by itself, Testing Library is (perhaps) not broad enough for TDD. We need to augment it with enzyme or something.
- Five Things You (Probably) Didn’t Know About Testing Library - This article includes a bit about how to test a front-end table with Testing Library.
- Note that innerText is not supported in Jest. Jest relies on jsdom which doesn not support innerText.
Non TDD Unit Tests
TDD is great for maintaining justified confidence in your code as you go. However, it really isn’t adequate for testing things you haven’t thought of. Two related categories of test that help with what you haven’t thought of are Metomorphic Tests and Propery Based Tests. These two types of tests are good to run after you feel like you’re done with the test driven development.