[crossfire] Unit tests

Tchize tchize at myrealbox.com
Tue Mar 7 02:14:07 CST 2006


Mark Wedel a écrit :

>  While what tchize says about writing unit tests make sense, I'm also a little 
>skeptical that it will actually get done in the way described and/or have other 
>bad effects.
>
>  For example, if there is the requirement that a unit test be written to 
>test/confirm bug fixes, I could see it leading some people say they don't really 
>want to spend the time to write such a test when the fix itself is trivial.  And 
>then they don't fix the bug.
>  
>
If the bug is trivial, the unit test is trivial and could be written in
a 1 or 2 minutes. Writting the test is simply the same as discovering
how the bug can arise. If the bug happens on a specific map, for
example, then it's just a matter of copying that map in test directory
with a specific name, write a testcase using that map (should take no
more than 3 lines of code to init this test), identify the wrong state
of object (simply mean locate object a X,Y in map, check a given value
for correctness).

>  Likewise, while writing unit tests before any large changes are done, I know 
>from my experience finding time to actually code the change and do basic testing 
>is difficult.  If it now takes 50% longer because unit tests also have to be 
>written, that has various implications.
>  
>


More information about the crossfire mailing list