Twitter: raymondcamden


Address: Lafayette, LA, USA

Best of ColdFusion 10: MightySpec

06-27-2012 4,868 views ColdFusion 6 Comments

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?

Related Blog Entries

6 Comments

  • Commented on 06-27-2012 at 9:40 AM
    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!
  • Commented on 06-27-2012 at 9:42 AM
    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. ;)
  • Commented on 06-27-2012 at 9:48 AM
    Ray, you should write UT for your POC to 'prove' them. :)
  • Commented on 06-27-2012 at 9:50 AM
    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.
  • Joe Rinehart #
    Commented on 06-27-2012 at 10:31 AM
    Who is Marc 'Esther?' I'd like to meet that guy. We only have an Esher working with us.
  • Commented on 06-27-2012 at 5:25 PM
    Marc should be proud - you wouldn't believe how many notes I got on that. Fixed. :)

Post Reply

Please refrain from posting large blocks of code as a comment. Use Pastebin or Gists instead. Text wrapped in asterisks (*) will be bold and text wrapped in underscores (_) will be italicized.

Leave this field empty