Skip to content

Comments on DUnit

Steve Trefethen asked for feedback about DUnit. My reply got pretty long, so I’m making it a post here instead.

Yes, we use DUnit. Mostly we like it. We run the tests with FinalBuilder and the build fails if any of the tests fail. I think that unit testing fits in well with the type safety of Pascal.

The most painful things with DUnit now are:

  • Expected exceptions. This is so easy with NUnit (just add an attribute to the test method), whereas in DUnit you have to have a try/except. It would be *really cool* if the IDE had a way to not stop on exceptions which are "expected" in tests, hint, hint!
  • It’s very easy to write unit tests for simple procedures (classless procedures) by creating a test class for the unit, but the DUnit integration in the IDE won’t handle this. Hint, hint!
  • The way the IDE integration does property accessors doesn’t work real well for me. I generally test getters/setters for the same property in a single test, since I consider the property a logical unit, and the integration generates separate tests for them.
  • The GUI needs some minor feature tweaks, like the ability to easily select a single test to run. There’s no way to easily select/unselect all checkboxes in a branch of the tree.
  • DUnit is good at testing things which work well with unit testing. Some features, particular GUI interactions, really are better candidates for program automation than unit testing. It’s important to consider that there are many ways to test an app, and not all of them are right for every situation.

But overall we like DUnit a lot.

Post a Comment

Your email is never published nor shared. Required fields are marked *

Bad Behavior has blocked 713 access attempts in the last 7 days.

Close