September 13, 2002

Value of tests, part 808

I recently added tests for the various export implementations for version 0.69 of SPOPS, but got bitten – again! – by the hash-keys-sort-differently change in 5.8. And about 12 hours after releasing to CPAN I got an automated email from one of the CPAN testers outlining a failed due to not declaring Time::Piece as a dependency. And then an email on one of the mailing lists with this and the aforementioned 5.8 error. Double doh!

On the plus side, it's very reassuring to have more coverage with the additional tests. I only have the import implementations and security to go before all classes are covered. I need to revisit some of the older tests to expand their method coverage, but still.

One of the nice side effects of writing tests is that you are often forced to simplify your interface. For instance: security. In SPOPS you need to have users, groups and security objects defined in addition to the object you're actually protecting. Creating dummy implementations of these isn't hard (esp. with recent additions to SPOPS::Loopback), but I have additional functionality required for the security object in particular. Then it hits me: why not just create implementation superclasses so people don't have to keep copying the examples? That was a real forehead smacker... So I'm in the middle of putting that stuff into separate implementation files, documenting it, and then I can use the loopback objects for security. Cool.

Next: Handy man
Previous: Shameful social security political ad