Blog

Unit Testing with ColdBox, MXUnit, and CF9 ORM

Curt Gratz |  March 24, 2010

Self admittedly, I am new to Unit Testing. It is on my list of things to learn and implement into my development toolbox and workflow for 2010. So, officially, I have begun the process using the Base Test Case ColdBox has built in and the illustrious MXUnit of course.

All my testing was working great until I wanted to test something that was using CF9 ORM/Hibernate integration.

The first issue I had was that ColdBox creates a separate application for testings. That is, the test folder has its own application.cfc defined. Well, obviously by default, that application.cfc doesn't have ORM setup, which then of course caused me not to be able to test anything that relied on or used an ORM "persistent=true" cfc or did an EntityLoad or anything like that.

So, the workaround for this issue is pretty simple.

First, open up the application.cfc in the test folder, then setup a mapping to your base application your testings. Call it whatever you like, I called my mapping baseApp.

this.mappings["/baseApp"] = expandpath('../../');

You can change the pathing to match your given scenario.

Then you need to configure orm in the application.cfc.

this.ormenabled = "true"; this.datasource = "MyDSN"; this.ormsettings = {cfclocation=["/baseApp/model/ORM","/baseApp/modules"]};

And there you have it, ORM is now configured for your testing application and you can test away.

Read More

ColdBox Platform Utilities v1.5 For ColdFusion Builder Released

Luis Majano |  March 22, 2010
We have now released version 1.5 of the ColdBox Platform Utilities extension for ColdFusion Builder. As you might now ColdFusion Builder was also released this week and I am super excited as the extensions capabilities are just outstanding for a 1.0 release. This 1.5 updates all the application templates and now a...
Read More

LogBox 1.2 Released!

Luis Majano |  March 19, 2010
On the spirit of non-stop releases, here is LogBox version 1.2.  Apart from some bug fixes we have squeezed in some great new functionality, especially when dealing with configuring LogBox and portability. Check out our milestone tickets for further review. Version 1.2 Tickets
  • Added some new methods to the LogBoxConfig objec...
Read More

MockBox 1.2 Released!

Luis Majano |  March 19, 2010
I am happy to announce today a new release for MockBox: version 1.2. This can be downloaded standalone or via ColdBox 3.0.0 Nightly. This release brings in some more stability, faster code generation and some new functionality for you mock enthusiasts!

Read More


ColdBox 3.0.0 Means Simplicity!

Luis Majano |  March 19, 2010

I am preparing to release the M5 milestone for ColdBox 3.0.0 and I am really amazed at how simple ColdBox 3 is becoming not only in syntax but in principle. I am really excited about this release as it is a push forward in ALL areas of development. Lots of modularity and re-architecture has gone into the core and the results have been amazing. A speed and performance improvement of over 20-30% from 2.6.4 on same code bases have usually been seen and that is without adding the speed of engi...

Read More

MockBox - It's not just for unit testing

Curt Gratz |  March 19, 2010

MockBox can have many amazing uses.  One well documented use is in assistance in creating complicated unit tests insuring you are only testing one small unit of work, it can be used for many other interesting use cases.

One of the ways we find MockBox useful during our development cycle at Computer Know How is to Mock objects we haven't had the time to complete yet, but we do know what we expect as response.  This allows us to continue development without waiting for the piece of something we haven't done yet slow us down, but keep the method calls exactly as they will be in when the object is complete.

So, how do you use MockBox outside of the context of a unit test?  Well, its easy.  

Inside a ColdBox application.

//get an instance of mockbox to use for mocking things not 100% built yet inside a ColdBox app mockBox = createObject("component","coldbox.system.testing.MockBox").init();

Outside a ColdBox application.

//get an instance of mockbox to use for mocking things not 100% built yet outside a ColdBox app. mockBox = createObject("component","mockbox.system.testing.MockBox").init();

Now that MockBox is initialized, we can start mocking objects. Lets say we have a User Object that we haven't had time to build yet. Right now it looks really advanced with lots of cool properties and functions that we spent a ton of time on. Something like this.

cfcomponent hint="I am the User ORM cfc" /cfcomponent

Read More

Very interesting MockBox Post!

Luis Majano |  March 16, 2010
Brian Car over at this blog has written an excellent entry on the benefits of Mocking with MockBox.  If you are a newbie to mocking, or an expert mocker :) then head over to his blog and check it out: http://cfcommons.org/index.cfm/blog/2010/3/13/unit-testing-done-right-with-mock-objects


ColdBox UK Training Promotion

Luis Majano |  March 09, 2010
I will be taking lots of ColdBox books to the UK for our UK training and for scotch on the rocks.  Not only that, we are releasing a promotion today for the first 2 students that register for our UK...
Read More

ColdBox CF Builder Extension 1.4 Released

Luis Majano |  March 07, 2010

We are glad to announce another release to our Adobe ColdFusion Builder Extension: ColdBox Platform Utilities.  This release focuses on updating the core engine with updates, fixes and the following features:

Version 1.4
- Updated Application template versions to meet ColdBox 3.0.0 standards
- Lots of syntax updates and fixes to internal core and utilities
- Com...

Read More

ColdBox Training London, UK May SOTR

Luis Majano |  March 03, 2010

We have just opened the registration page for our new ColdBox 3 day training right after Scotch on the Rocks in London, UK.  The dates are from May 26-27-28 and I will be the trainer.  This is my first visit to SOTR so I am very excited to attend and also be able to train for the first time in the UK.  The course we will cover is CBOX-101, which ...

Read More