[gambit-list] test driven development

Thomas Hafner thomas at hafner.NL.EU.ORG
Thu Aug 18 15:31:33 EDT 2005


Are there any tools helping me doing TDD using Gambit-C?

I've found Neil Van Dyke's Testeez. But it doesn't seem to support
stubs. I think there is the need, that a function under test may call
a stub (belonging to the test environment) rather than the original
function. E.g. it may be a good idea to stub read-line, otherwise the
test wouldn't be automatical. I can even think about situations where
it may usefull to stub functions which are part of the software to be
tested, at least for a part of the tests: e.g. if the original
function isn't stateless and it's difficult to get to a rare state.
Then a stub representing that state is easier to deal with.

Maybe I shouln't look for tools, but on ways how to write code, that
can be tested easier. Programming in a functional way seems to be
better there, but what to do then with non-functional functions like
read-line? (I call it ,,non-functional`` because it can return
different values although the argument list keeps being the same, i.e.
the emptry one.)

Just an idea: problematic functions (like read-line above) are passed
explicitely as function arguments rather than being referenced
directly. When testing, I'm free to pass a stub instead of the
original function read-line. Is that good?

Regards
  Thomas


More information about the Gambit-list mailing list