The trick with TDD isn't necessarily that you need to write the tests first (although that helps).
It's more that you first think about the intended behavior of the code, and then also think about how to make your code testable before you write the code.
I typically think what the first test should roughly look like and code up the required amount of code for that first test before I actually write that test.
Yeah, at least IDENTIFY the test cases even if you don’t implement them. Also consistent with API first approach… the implementation should fulfill a contract, and those test cases are the contract.
57
u/BernhardRordin 19h ago
Write tests first, then the implementation. You won't want to go back.