[Bf-committers] Unit testing frameworks
Dean Giberson
bf-committers@blender.org
Fri, 06 Jun 2003 09:35:12 -0700
Unit testing is a very good thing. I've started using it myself for
small projects and it makes a big difference. I know that you mention
unit tests for you code, does that mean a separate project or a
sub-project within bf-blender?
I'm afraid of a couple things with adding it in after the fact though:
1) Getting everyone to use it & keep the tests up to date, it's been my
finding that adding tests after the fact does not instill confidence in
the code unless the next two point are addressed.
2) Code coverage is not complete. When your writing units as you go, you
tend to understand the corner cases of your code better. So tests get
written to catch them. In cases where you add tests after the fact, some
of that 'project lore' may have been lost. To get everyone to trust the
tests & keep them in sync with the code you need to show that all
possible paths in a function & all corner cases are tested. For this a
test coverage tool is also helpful. An example coverage tool would be
COVTOOL (http://covtool.sourceforge.net/).
3) Unit tests _must_ be part of the build process for all coders or the
coverage will not be complete.
Sorry to be the negative one here but I just want to bring some of my
experience to the table.
Also while cutest is good for C, CppUnit
(http://cppunit.sourceforge.net/) may be better for the bf-blender
project since it has some C++ components.
I really like the idea of testing out some of the more core
functionality of blender as it gets cleaned up, but it's a huge job :)
My vote would be to put it in, 'cause it would be good proof to
outsiders of the correctness of the blender code base.
Dean Giberson
(voidptr)
Timo Mihaljov wrote:
> I'd like to write tests for the code I am writing, but as far as I know there is no unit testing in Blender at the moment.
>
> Which unit testing framework should I use (if any) when writing tests for Blender's sources?
>
> I have looked at some of the options and so far CuTest
> (http://cutest.sourceforge.net), seems to be the most suitable for
> use with Blender because it is
> - very simple, consisting of only one .c and one .h file which
> both are small and easy to understand
> - extremely portable
> - quite recently updated
>
> More information about unit testing in general can be found here:
> http://c2.com/cgi/wiki?UnitTest
>
>
> Timo Mihaljov
> _______________________________________________
> Bf-committers mailing list
> Bf-committers@blender.org
> http://www.blender.org/mailman/listinfo/bf-committers