I just wanted to let people know about a new feature that I am about to add to acs-automated-testing. It is common in Tcl API tests to want to roll back changes to the database made during the test. Now you can easily accomplish this with a construct like:
aa_run_with_teardown -rollback -test_code {
<invoke Tcl API that changes database>
aa_equals ...
aa_true ....
}
and every change in the test_code block will be rolled back.
Another very powerful feature of acs-automated-testing is the aa_stub procedure. Suppose you are about to test a proc that sends out email as a side effect and you want to avoid this. All you have to do then is to preceed your tests with the invocation
aa_stub ns_sendmail {
return
}
Examples of rollbacks and stubbing can be found in the tests in the acs-authentication package.
I encourage package maintainers to start adding Tcl API tests to their packages. It's easy and it very quickly pays off. The next time you make a refactoring in your API (or somebody else does) you'll be happy you have the tests. The tests can significantly increase your confidence in the code and that is a great feeling.