Uncle Bob's three rules of test-driven development
Here are some guidelines to Test-Driven development (TDD):
Only write code to make a test pass
When writing a test, write the minimal to make a test fail; this includes your code not compiling
Write the minimal amount of code to make a test pass
With that said, the other rule of thumb is Red-Green-Refactor.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.