Benefits of Unit Testing

The following are some benefits to ColdFusion unit testing that I've noticed while creating them over the past several days:

  • As I write the unit tests (and the subsequent code for the cfcs) I find that changes are actually quite simple. It makes it easier to make changes in the beginning. IMHO, it is much more difficult to make changes as I'm implementing the CFC into the presentation layer.
  • As I develop unit tests, I establish the expected behavior of the CFC even before I begin to create it. This allows me to have a more absolute concept of what the CFC is supposed to do early on. As mentioned above, that's much easier to change than if the whole darn CFC is already coded and implemented in an interface.
  • Initial bugs are found and fixed before connecting to the interface. I have a fully functional CFC that has been bug tested (by the unit testing) prior to its implementation. Plus, I'm not bug testing with the interface (except for interface bugs) because that's already been done with the unit test. So nice.

I'm sure there are so many other reasons to do unit tests that I haven't covered. If I think of any, I'll post them. Otherwise, feel free to post your reasons for unit testing.

Which ColdFusion Unit Testing Framework?

I'm currently using MXUnit. In the past I've tried CFUnit which was really nice, BUT THEY STOPPED UPDATING IT! It's been dormant for about 18 months.

I've also tried CFCUnit but they stopped updating it over two years ago! That's a bummer because their interface was really nice.

MXUnit is currently being updated, supported and they even have an Eclipse plug-in (that I haven't tried yet). They have an active blog and an active Google Group to get support.

Comments
Contact Chris SchofieldBlogCFC was created by Raymond Camden. This blog is running version 5.9.001.