The Dopefly Tech Blog

<< The Dopefly Tech Blog Main page

Some early thoughts on web application testing

posted under category: ColdFusion on September 12, 2007 at 1:00 am by MrNate

Recently I decided to become interested in software quality. Let me assure you, it's not something you gravitate to when you're cowboy coding for thrills or something you decide to pick up because the cool kids are doing it. No, this is something you have to decide to like.

I said I decided this recently, so here are a couple of my early thoughts on the subject.

Web application testing tends to focus on the front-end. If you can see it in a browser, that's what you need to test. Or at least that's what I hear a lot of. Of course this testing is great at revealing missing requirements and catching exceptions, but that's the same testing we used when we tested our HTML pages in the 90's.

Come on now, is this a web site or a web application? Am I making a script or a system? Do I serve pages or programs? I certainly like to charge my clients based on the latter.

So how does testing change when you consider applications opposed to pages? This is the question I've been pondering, and I am still working on my conclusions. One partial answer is the unit test.

A unit test is an automated script that calls methods on an object. It helps to have a unit test framework that can run the tests and tell you the results in a pass/fail style (there are a couple for CF). The framework can run a number of unit tests all at once to give you a view on your overall system.

Something notable from The Pragmatic Programmer, tip # 66, "Find Bugs Once," meaning once a bug makes it past you, the developer, and appears for someone in QA or, worse, a customer, add that bug to your unit test to make sure it never slips by again.

The bright red glaring issue in this space is the lack of testable software. How do you make ColdFusion applications that can be driven by TDD? Is OO the only answer? Can you unit test a .cfm file? How can I unit test a legacy (CFMX6.0) application?

I'd like to hear what people are doing. Comment below or blog your own experiences in reply. Thanks!

More later, like I said, I am now interested in the subject :)

Too old to comment!
On Sep 12, 2007 at 1:00 AM Jaime Metcher (jmetcher, who eats said:
I'm a big fan of Selenium for UI testing. Having said that, it's perfectly feasible to "unit test" controller and view .cfm files using CFCUnit. Just call the module (either cfinclude or cfmodule), capture the output, check both the captured output and any expected side effects (e.g. database writes), and you're done.

Where I find OO really helps is in the setup of test fixtures. Super disciplined procedural programmers probably already have this wired, but I find an OO model layer forces me to have a way to interact with my data objects independently of the UI, which is exactly what you want for test setup and verification.

On Sep 12, 2007 at 1:00 AM Jim Priest (priest, by way of said:
I've used Selenium in the past with good results...

I've also recently discovered Canoo ( I haven't tried it yet but I like the fact the tests are done within Ant - which I already use to deploy.

On Sep 13, 2007 at 1:00 AM ROe (paul.roe at the ever popular said:
OO will really help and since TDD is another good reason to switch why don't you take the plunge?
Too old to comment!