Episode 19 – Advanced TDD

Clean Code

Episode 19

This episode is a two parts serie on a deep dive into the test-drive development.

  • TDD Review of the Three Laws
    • Before production code, must write unit test to fail
    • Stop writing the test as soon as you got a failure
    • Don’t write more production code than you need to pass the test
    • Red Green Refactor
  • The Single Assert Rule
    • Every unit test should only have one assert
    • Arrange-Act-Assert
    • Every action should have one assert.
  • Incremental Algorithmic
    • As the test gets more specific, the code gets more generic.
  • Getting Stuck
    • Should create degenerate test case first. Approach from outside in.
  • Getting Unstuck
    • First, make most degenerate test case.
    • Solve the problem using test case with incremental complexity
    • For every failed test, we make it pass by generalize the production code
    • Don’t make specific with the code
  • Conclusion
    • Test can only prove the program wrong and never prove the program right
  • References
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s