Friday, May 25, 2012

MXUnit Boiler Plate 2.0 is here!

A while back, I decided that stubbing out all the unit tests for an existing component was very, very tedious. So, I wrote a terse cfBuilder extension that had a few simple options to generate stubs of your tests.

After having my coding fire reignited at cfObjective last week, I decided that it was time to update the extension to be a bit more useful. ( GET IT HERE )

So, for those of you lovely individuals who are using mxUnit ( Get mxUnit here ) you now have an option to save you some more of the tedious overhead for generating your unit tests.

So, you have some options:

Overall, the extension has 10 features:

1) Retain memory of last directory
2) Allow you to choose which cfc to extend and retain it
3) Decide between tags and cfscript based unit test
4) Have stubs commented out or not
5) Includes required arguments
6) Optional to include all arguments
7) Make base assertions based off of return type
8) Make private methods public
9) Choose between "new" or "createObject"
10) Retains preferences
It may not seem like it's all that complicated, but point it to a large component and watch how much time that saves you. You can have it generate with all the arguments, all methods made public, and all you're left to do is populate a little bit of data and you're good to go!

(I know, right?)

Here's a shot of the results:

Base assertions and everything. FOR FREE!!!

Well, what are you waiting for? Go get it!

If you have any feedback, hit me up. I have one or two features in mind for a little bit down the road like being able to stub out an entire directory, etc...

Enjoy the weekend everyone ^__^


  1. Joshua,

    This sounds great but I'm having an issue getting it up and running. I installed using the instruction here but when I right click on a cfc and select Generat MXUnit tests I get "User action finished with the following error message: No response"

    Am I mising some configuration bit?


    1. I'd start by checking CFBuilder's error logs. I believe I also have some internal errors output to CF's actual error log. Depending on what your server home is, you may also have to install a copy of the extension to your C:\JRun4\servers\#youServerInstanceName#\cfusion-ear\cfusion-war folder to get it to run. If that's still not working for you, let me know and I'll see what I can do.

  2. I did as you suggested and got the same. The error being logged is "The server failed to respond with a valid HTTP response"

    1. Hit me up at . If you can, provide a stack trace.


Follow by Email