|
|
|
|
|
by taligent
4845 days ago
|
|
TDD in theory is a great idea. In practice it is dreadful. Because what has happened is that the obsession with code coverage has meant that developers create a whole raft of tests that serve no real purpose. Which due to TDD then gets translated into unworkable, unwieldy spaghetti like mess of code. Throw in IOC and UI testing e.g. Cucumber and very quickly the simplest feature takes 5x as long to develop and is borderline unmaintainable. It just seems like there needs to be a better way to do this. |
|
- Focus on code coverage
- Testing nothing
- Spagetti code from doing TDD
- IOC + UI/Cucumber takes long to write and run
I would have to say I agree, there is a better way to do this. My guess from your last statement is that you are relatively new to software. Don't mistake your teams poor practices for the practices not working. Try to promote better practices.
Tell your team code coverage only informs you on what isn't being tested. It doesn't help with quality.
Tests, like code, should be deleted if they don't do anything. Strictly adhere to YAGNI,
If TDD is producing spagetti code, you are doing something very wrong in your tests. The tests should be short and focused, just like your code base. Those tests are hard to write on a messy code base, which forces you to refactor, which leads to clean code. Maybe read up on the SOLID principles and other code quality practices to see what you are missing. Refactoring techniques can be very helpful too. This takes years to get good at.
Cucumber is over used. Read about the testing triangle (http://jonkruger.com/blog/2010/02/08/the-automated-testing-t...). My guess is that your team is focusing on the top levels. Those tests provide little long term value, fail without good explanations and can be complicated to write and maintain.