[crossfire] Unit tests

Tchize tchize at myrealbox.com
Wed Mar 8 06:53:21 CST 2006


Lalo Martins a écrit :

>And so says Mark Wedel on 08/03/06 14:36...
>  
>
>>  For example, a lot tests may require non trivial maps, so it takes some time 
>>to create that map...
>>    
>>
>
>note, we're talking about "unit" tests here.  By definition, they don't
>use maps.  The traditional "unit" for C unit tests is a function - so
>each test case (a set of individual tests) will test a given function.
>Unit tests are much more low-level than a few of the posters in this
>thread are thinking.
>
>The kind of tests that would include loading maps and checking for
>correct behaviour, is what we usually call "functional" tests.  They are
>desirable too, but much harder to get right and complete than unit tests.
>
>best,
>                                               Lalo Martins
>  
>
You are  right. Basic purpose of unit testing is to check the functions
for correctness and prevent regression after future modifications. But
it's also quite common to write unit test that test the behaviour of the
integrated system. They then do test on a full life cycle of code. This
is mainly used when bugs have been identified.
But it is also incorrect to think functionnal unit test would not
require maps. Some methods in code can not work properly without a map
(like all get/put_ob_in_map()).
Functional tests will never be complete (you can't cover all game
situation, but you can cover all methods), that does not mean we
shouldn't write them as they are about as easy to write as unit one, and
use the same framework. I even think we should start by writing a few
functionnal unit tests based on current sourceforge bugtrack, while in
parallel begin to write unit tests to cover each crossfire function.

Regards.

>--
>      So many of our dreams at first seem impossible,
>       then they seem improbable, and then, when we
>       summon the will, they soon become inevitable.
>--
>personal:                              http://www.laranja.org/
>technical:                    http://lalo.revisioncontrol.net/
>GNU: never give up freedom                 http://www.gnu.org/
>
>
>_______________________________________________
>crossfire mailing list
>crossfire at metalforge.org
>http://mailman.metalforge.org/mailman/listinfo/crossfire
>
>  
>




More information about the crossfire mailing list