[Biococoa-dev] Unit testing: poll

Charles PARNOT charles.parnot at stanford.edu
Wed Feb 23 01:19:39 EST 2005

I gave unit testing a try, like I explained before, and added more test classes for the sequence classes. I can only say again that I liked it a lot. It is very easy to quickly set a new test, it is a great way to think about what we really want to make with the class being tested. And the nice thing about it is that it should be quite insensitive to refactoring of the framework (if used properly), which means very little maintenance. Ideally, these tests keep accumulating over time and you rarely destroy any. And you don't need any headerdoc, just some regular comments. The code itself will usually be short and self-explanatory.

Then, there is Koen's question: how do you test the tests? At first, I thought it was a nice joke. Then I realized the tests themselves are in fact tests for themselves. When they fail, it is either the framework or the test. So there is an answer for Koen's question: if the test has a bug, it will fail! There you go...

Anyway, the bottom line is:
* should we add unit testing? By reading about it, it seems to require some very strict habits of writing tests all the time, but somehow, I got the feeling that was mostly for commercial program with deadlines and doing this scary 'extreme programing' thing. I believe that we can add tests as we go without being too obsessed with them. As I say, they will grow over time and with several programers involved, they will eventually be in sync with the project. One good habit for sure is: when you find a bug, add a test to prevent it from happening again in the future.
* should we use OCUnit? All these frameworks look about the same and I had the feeling this one had been around for a while and was updated frequently, this is why I picked it. I found it really easy to use. Also, it is released with a BSD license, which means it is quite compatible with LPGL (anyway, we would not use any portion of the code anywhere, so the problem is probably moot).
* one drawback is that new BioCocoa developers will have to install the OCUnit framework in addition to the checkout of the project, as we can not simply include it in the current project; however, it is only really needed when running the tests; the test bundle could however be part of the project and be easily run at any time

>From last week, it seemed most people liked the idea, but I thought I'd ask again now that we have more people before adding yet another folder and a new target and 10 more files...


Help science go fast forward:

Charles Parnot
charles.parnot at stanford.edu

Room  B157 in Beckman Center
279, Campus Drive
Stanford University
Stanford, CA 94305 (USA)

Tel +1 650 725 7754
Fax +1 650 725 8021

More information about the Biococoa-dev mailing list