An Architect's View

CFML, Clojure, Software Design, Frameworks and more...

An Architect's View

Entries Tagged as tdd

Into The Box

January 15, 2014 ·

The Into The Box conference web site is up and running now: May 13th, 2014, the day before cf.Objective().

Into The Box brings together ten speakers, in two tracks, covering all aspects of the ColdBox-family of products for just $199. If you're using any of those frameworks - or you're just curious about them, this is going to be a great opportunity to really get to know them in depth!

Back in 2009, I gave a talk at cf.Objective() about Behavior-Driven Development - a way to describe the expected behavior of software as executable tests. It's an approach I've always believed in but we've lacked the tools in the CFML world until recently: TestBox provides traditional "xUnit" testing, MXUnit compatibility, and Behavior-Driven Development testing.

Tags: bdd · cfobjective · coldbox · coldfusion · tdd

TestBox - replacing MXUnit and providing BDD

December 23, 2013 ·

If you've seen my tweets over the last couple of days, you'll know that I've been taking a look at TestBox, the new testing framework from the ColdBox team.

You might be thinking "Do we really need a new testing framework?" and it's a reasonable question. CFML has had a number of testing frameworks over the years but mostly we've seen each one come and go as maintainers have moved onto other things: cfUnit, then cfcUnit, then a brief resurrection of cfUnit, then MXUnit. Does anyone remember cfSpec? I liked that a lot - I like the Behavior-Driven Development style of writing tests. That's why, at World Singles, we use the Expectations library for almost all of our Clojure-based tests.

So why the interest in TestBox? My initial interest was spurred by the inclusion of the BDD style of tests which I find both more natural to read and a better fit for expressing requirements for software that is yet to be written. Then I read that TestBox has MXUnit compatibility which intrigued me - we have been using MXUnit for several years at World Singles and I don't relish having to rewrite all those tests. If TestBox could allow us to run our existing "xUnit" tests as-is while we write new tests in the BDD style, I'd be very happy.

Adam Cameron has been blogging about Test-Driven Development recently and has also picked up on TestBox. He just blogged about trying TestBox on his extensive MXUnit test suite and you can see he ran into a number of issues, all of which he has reported, and which I expect we'll see fixes for. My experience was more fruitful than his - as I mentioned in my comment on his blog post: just two small changes got the whole of our suite running flawlessly!

My next challenge was integrating TestBox into our automated build / test script, which uses Ant. TestBox provides a runner-template that shows how to do basic Ant integration. I followed that recipe but discovered there was no way for Ant to see that any tests failed and so I couldn't "fail the build" if TestBox found errors or failures. After studying the source code briefly, I realized I could extend the TestBox CFC and provide a way for the runner CFM template to access the details of the TestResult object, and write a property file that Ant could read and fail if a certain property was set. Time to fork the ColdBox Platform Github repo and send a Pull Request to add build failing functionality which Luis merged in within a few hours! Nice!

With that in place, I was able to delete MXUnit from the World Singles repo and rely entirely on TestBox for all our testing needs!

Whether you prefer the "xUnit" style of tests, with assertions, or the "BDD" style with expectations, TestBox can support you, and even if you have a lot invested in MXUnit, migration to TestBox should be straightforward (especially once they address the issues Adam has raised). I think we can be sure of ongoing support and maintenance - based on the well-established track record of the ColdBox Team. I think TestBox is a safe bet. Now you just need to start actually doing some automated testing :)

Tags: bdd · coldbox · coldfusion · tdd · worldsingles

Hiring! Hiring!

January 20, 2013 ·

[UPDATED] Welcome to 2013 and at World Singles we are expanding our development team! We're looking for self-motivated people in two very different roles, working remotely from their home office.

[

Tags: clojure · coldfusion · javascript · mongodb · programming · tdd · worldsingles

Automated Testing with Selenium

December 30, 2009 ·

A few weeks ago, I blogged about a fix for running Selenium with ant on Snow Leopard and several people have asked me to blog about the basic setup for which that fix applies since it is of much broader interest to developers... Yes, good point! A bit of background first. I'm working on a large ColdBox project and one of the first things I did when I joined the project was to start creating some unit tests and integration tests. ColdBox has integration with MXUnit so you can fairly easily write unit tests for parts of your model and integration tests for your event handlers. Over time we've built a suite of over 100 MXUnit-based tests. If I had my way, we'd have a lot more by now but test-infecting your colleagues isn't always easy!

[

Tags: coldfusion · tdd

Selenium, ant and Snow Leopard

December 17, 2009 ·

With the arrival of my new 27" iMac, I'm now doing all my development on Snow Leopard and that caused a problem today with my automated Selenium tests... I use ant to drive Selenium to launch Firefox to run UI-based test suites. It's pretty slick and I'll blog about it soon. Unfortunately, on Snow Leopard, Selenium cannot launch Firefox from the command line (due to a security exception caused by a library mismatch it seems). Myself and Peter Bell have been looking for a workaround for this for a few days and even started looking at the alpha builds of Selenium 2.0 which claim to resolve this (but we couldn't figure out how to drive those builds from ant). Some Googling turned up Matt Patterson's blog post with a simple workaround. The root of the problem is the dynamic library load path in the environment and his workaround is simply to use a shell script wrapper that removes the environment! Then you can specify browser="*chrome path/to/selenium-firefox" with your shell script in the selenese ant task and you're off to the races.

Tags: tdd

Static is Evil

December 12, 2009 ·

This cropped up on the TDD mailing list and it made me smile so I wanted to share it along with some commentary. A fairly common request from folks in the CF community is for "static" methods (and data members) to be added to CFML. Folks look at Java, think it's a cool concept, and want it in CFML as well. I generally pop up and say it's a bad idea and that Java only has static because it doesn't have any concept of a global application scope (which CFML does, of course).

[

Tags: architecture · coldfusion · tdd

What Makes Better Code?

November 09, 2009 ·

As you might guess from some of my tweets and blog posts lately, I've been reading more about Agile, Lean and XP software processes, looking at how I can improve my own working practices and those of the teams I work with. Once again the XP mailing list has provided a good read with a link to large-scale research at Microsoft into the effectiveness of certain software practices. As the researcher points out, the vast scale and diversity of Microsoft's software development ecosystem allows for some in-depth analysis that compares different approaches on similar teams. The article is worth reading all the way through and shouldn't really contain any surprises but there are a couple of things I wanted to pull out and highlight.

[

Tags: programming · tdd

Testing a ColdBox Controller that Redirects

August 08, 2009 ·

I'm working on a ColdBox project right now for a client and, as some may have gathered from my occasional tweets, I've set up Hudson as a Continuous Integration server that pulls the latest code from git, restarts the test server instance, reloads the test database and automatically runs the MXUnit-based test suite, whenever someone commits files to the main git repository. We have unit tests for individual components and we have integration tests for the ColdBox event handlers. Luis has provided pretty good documentation for writing such tests but one of the challenges I faced in getting some of the integration tests working was that they redirected to a new event!

[

Tags: coldbox · coldfusion · tdd

Behavior-Driven Development with cfSpec slides posted

May 17, 2009 ·

I just posted the slides (as a PDF) and the code example ( under PRESOS and SOFTWARE on my blog. You'll need to download cfSpec from RIAforge to run the sample code.

Tags: cfobjective · coldfusion · tdd

My cf.Objective() 2009 Schedule

May 11, 2009 ·

In the absence of a printable schedule - sorry, Joe Rinehart says it's a problem with the Media3 hosting and he's been trying to get them to fix it for months! - here is my schedule for cf.Objective() 2009:

[

Tags: adobe · air · architecture · cfobjective · coldbox · coldfusion · coldspring · flex · iphone · j2ee · jquery · machii · orm · oss · ria · saas · swiz · tdd