воскресенье, 16 февраля 2014 г.

Test in the middle

I am passionate advocate of unit testing and I will make it one of the principles of jet framework. Whatever code is written developer have to prove that it works as expected. Normally I do not follow extreme TDD activity – it’s possible but non-practical to write unit test before implementation of some functionality. Instead I follow approach when final product looks like it was implemented using TDD (but it wasn’t).

In argument around pro- and against-TDD people usually miss one important point – the purpose of testing. Imagine if somebody has unlimited analytic capabilities – does he need to test his code? Not really. He can trace possible execution paths of the program without writing a single piece of helper code (which is unit tests by definition). Indeed unit tests are not for genius – but for software developers who understand limits of their abilities.

TDD as a development process helps people to organize their coding activity but this is not the only way to do it. Moreover this stable and repeatable process contradicts to initial development stage of any project. Consider “flash of insight” when programmer needs urgently to write down his thoughts. Unit test is not the best way to start implementation in this case – it’s too “organized”.

Anyway testing is required. So I prefer opportunistic testing which can be described as “test-in-the-middle” as opposition to “test-first” concept.

Комментариев нет:

Отправить комментарий