Today I was working in Python, writing a real serious module. Now usually I don’t bother with unit testing (code that tests to make sure all my code is working properly - it’s an Xtreme Programming thing), ‘cause my modules are usually small and braindead.
Not with this module though - it’s probably going to end up being a few thousand lines of python. That’s a lot of Python. So I need unit tests to keep myself sane - and they have. Greatly.
Today I also worked in a language that doesn’t have unit testing… Applescript doesn’t have a unit testing framework, because… well, I’m not sure why. You could load in another script object and tell it to runTests() or something like that. It should be simple enough.
Update: Applescript does have a Unit Testing Framework. Color me fasinated.
Well, anyway, I was trying to debug a bit of code in Applescript, where I wasn’t setting variable I was supposed to be setting. That unleashed a good hour and a half of torturous
display dialogs and such.
Oh yes, and for those of you who work in AppleScript Studio, remember: a text field with scroll bars around it is a text view. That took me at least an hour to figure out as well. The text field you pull out of the first Interface Builder Elements “tab”. The text view you pull out of the third or fourth (the one with all the other browsers).
In short: Unit Tests Good. Unit Test Very Good.