Testing Untestable CFML

submited by
Style Pass
2021-05-25 19:00:10

I spoke at some length about my frustrations testing CFML on the "Testing" episode of my podcast, Working Code (in February), and I've had some realizations since then, so I wanted to share what I've learned.

In fact, something I didn't understand about TDD until recently was that its primary benefit —at least in my opinion— is not that you've written the tests before/with the code, but rather that it forces you to write testable code.

This pattern could be repeated with nearly any feature, but the thing I had in mind when I lamented the inability to test my CFML app quickly and efficiently was ORM. Specifically, Adobe's implementation of Hibernate. What I was feeling was that it was impossible to test code that used ORM, but that feeling was wrong. If I had known enough to continue scratching that itch, I might have figured this out sooner.

And I do mean that I figured it out. Even though I have a bachelors degree in Computer Science and roughly 20 years of full time professional coding experience, somehow I managed to make it this far without ever getting a truly ground-up testing education. And what that's meant is that I had to do things the wrong way for a long time, and learn what it feels like to have those pains; AND I had to be exposed to the solutions multiple times because I never truly understood them the at the first few opportunities.

Leave a Comment