14 thoughts on “Test Driven Development

    1. One of the ways programmers make sure that their code works correctly is unit testing, which consists of running a small but self-sufficient piece of the code – a “unit” – for predetermined input values and comparing the output with the expected result. A good test suite (in theory) contains every corner case imaginable, ensuring that every nook and cranny of the software works in all those cases as it should, e.g. a function that adds two numbers should be tested for positive inputs, negative inputs, zero inputs, invalid inputs, missing inputs, too large inputs, too small inputs, unparsable inputs, and of course all of these for each of the two numbers to be added. This results in a huge number of tests even for relatively simple tasks.

      Liked by 1 person

    2. my guess is the public method (actual code) relies on many private methods / nested or API calls / clever or complex logic etc. that looks compact in that method but requires tons of tests to account for all the behaviors

      Like

  1. Been there, done that!
    For those asking for an explanation: You sometimes end up writing a pair of production code/unit tests at the ratio show in this comic. It can literally be so that a function with only 5-6 lines would command writing 10-15 tests to cover all eventualities. At least, if you strive for 100% code coverage.

    Like

  2. Aren’t writing unit tests just a way of passing the day anyways. Unimaginable scenarios vs actual work where you have to try?

    Like

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 )

Connecting to %s