PHP Classes

Why we don't TDD

Recommend this page to a friend!

      PHP Classes blog  >  7 Reasons Why TDD Fai...  >  All threads  >  Why we don't TDD  >  (Un) Subscribe thread alerts  
Subject:Why we don't TDD
Summary:Our reason
Messages:3
Author:jeroen le roy
Date:2014-06-11 16:23:34
Update:2014-06-11 23:58:49
 

  1. Why we don't TDD   Reply   Report abuse  
Picture of jeroen le roy jeroen le roy - 2014-06-11 20:33:29
Although we where very enthusiastic about TDD at first I noticed that me and my team where hitting a serious issue.

The main issue of TDD is that you test against what you expect the code to do, not what could be done with the code. If this then that is fine, but especially the 'this' part is everything but reliable for instance:

Let's say we are creating a calculator with 2 input fields and it should do a sum on those two items. We would test if 1 + 1 equals 2 and if so it works. What the programmer could forget to think about is that the user inputs 1.2 where the end result is an integer instead of a float, or that the input excepts any character which means a + 1 could also be inserted.

TDD can never test against these odds, and a 'all systems go' after running a TDD never means that a bug or issue is prevented. People around us (from other partners) tended to get lazy, why test manually if the test runs without failures!

  2. Re: Why we don't TDD   Reply   Report abuse  
Picture of Rad Paluszak Rad Paluszak - 2014-06-11 23:58:49 - In reply to message 1 from jeroen le roy
In your example I would say, that proper tests should consider types as well. But I do agree that you won't ever predict all the behaviour to cover it with tests.

  3. Re: Why we don't TDD   Reply   Report abuse  
Picture of Steve Ash Steve Ash - 2014-06-11 23:58:30 - In reply to message 1 from jeroen le roy
The point of TDD is not just to test the result of a user input but there should be tests to test the user input a well!!!

TDD will not replace intelligent analysts and programmers - it just has the potential to reduce bugs by up to 80% in the 'checked-in' code.

If you don't check the user input at the interface, you must test the data fed to the business layer with assertions of the parameters.

Whatever happened to good OO design practices? Do some people really think that dumbly using tools obviates them from being professional?