apardon at forel.vub.ac.be
Tue Jan 10 09:16:11 CET 2006
Op 2006-01-09, Xavier Morel schreef <xavier.morel at masklinn.net>:
> Antoon Pardon wrote:
>> I don't think unit tests are that helpful in this case.
>> Unit tests help you in finding out there is a bug, they
>> don't help that much in tracking down a bug.
>> I for some reason a person is reading over the difference
>> between sumLongName and someLongName and doesn't notice
>> the different spelling in his source a unit test won't
>> be of much help.
> 1- The unit test will obviously fail in this case, telling you in which
> code unit the issue is
Not in general. Several unit tests can fail. And if you have a variable
spelled differently, the code unit that fails is not dependant on which
occurence was spelled correct and which was spelled wrong. So it is very
well possible that the code unit with the issue is the one in which the
variable is spelled correctly.
> 2- Unit Test favor extremely modular coding with very short increments
> (as a somewhat extreme example, Robert Martin gets nervous if his test
> suites don't validate the code every 5 minutes, you usually don't write
> 200 lines and their unit tests in 5 minutes)
I have a unit test that takes at leas 2 minutes. If I would validate
each five minutes I wouldn't get any work done.
> We can deduce that unit testing will detect the typo extremely early and
> that the field of research will span about 5 to 10 lines, making the
> tracking quite easy to perform.
Not necessary. You may have started with misspelling the variable and
spelled it correctly in your last edit session. Doing your research
in the 5 to 10 lines last edited will then reveal nothing.
More information about the Python-list