Best of ColdFusion 10: MightySpec

This post is more than 2 years old.

Welcome to the final entry in the Best of ColdFusion 10 contest. I apologize for taking so long to "wrap" this (and technically it isn't wrapped till I announce the winners), but hopefully the utter and complete coolness of today's entry will make you forget how long it took me to actually get it posted. Our last entry comes from Marc Esher : MightySpec

MightySpec is a modification to MXUnit that aims to provide Behavior-Driven-Development support to your unit tests. Marc's work is based on Jasmine. If that doesn't mean anything to you, perhaps an example will help clear it up. Imagine your typical, simple unit test making use of an assert statement.

While this works well enough, now imagine writing tests like this:

Look at how descriptive the tests are. You could almost read this like a story. This friendlier output also shows up in the output, both in the browser...

And Eclipse:

I've blogged before about how impressed I am with ColdFusion 10's closure support and this just reinforces my belief that closure support may be the most important feature added to the latest version of ColdFusion.

There is one small hitch though. While working on MightySpec, Marc encountered a bug with closures. I'll share with you what he had to say about it:

To get it to work, you'll need to point to a custom RemoteFacade URL

Here's what to do:

with that version of MXUnit in your CFBuilder, drill down to mxunit/tests/mightyspec

Right click, select "properties", and go to the MXUnit tab.

in the URL box, use this: http://localhost:8500/mxunit/tests/mightyspec/RemoteFacade.cfc?wsdl

with the server name and port to whatever your stuff is.

Hit OK.

Now, when you run the Specs, it'll point to that URL and run correctly.

Keep the above in mind if you plan on testing his project. So - what do you think?

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA

Archived Comments

Comment 1 by Matt Gifford posted on 6/27/2012 at 6:40 PM

BDD is immense, and I was thrilled to see Marc working on this. There are three reasons why this rocks:

1 - ANY addition to testing strategies and resources is a great thing
2 - BDD means it can be readable by non-developers... everyone can see what should be happening in the tests
3 - it highlights how awesome CF10 features are!

Great work, Marc!

Comment 2 by Raymond Camden posted on 6/27/2012 at 6:42 PM

This may sound nerdy - but one of the main things I miss since my move to evangelism is writing unit tests. As I hardly do anything more than POCs for blog entries and books, I just don't find the need to write UTs as part of my day to day. Seeing this makes me want to find an excuse. ;)

Comment 3 by James Brown posted on 6/27/2012 at 6:48 PM

Ray, you should write UT for your POC to 'prove' them. :)

Comment 4 by Raymond Camden posted on 6/27/2012 at 6:50 PM

Heh, good point. I should at least get into Jasmine now and see how well it works with PhoneGap projects. Obviously it can't test hardware, but it could handle the rest.

Comment 5 by Joe Rinehart posted on 6/27/2012 at 7:31 PM

Who is Marc 'Esther?' I'd like to meet that guy. We only have an Esher working with us.

Comment 6 by Raymond Camden posted on 6/28/2012 at 2:25 AM

Marc should be proud - you wouldn't believe how many notes I got on that. Fixed. :)