MX Unit reports coldbox main controller has not been initialized

I’m just starting to use CB and MXUnit and thought I would start by testing my models. My list and get methods word find but but when I try use in the update method MXUnit reports the following error.
ColdBox Controller Not Found

The coldbox main controller has not been initialized


component extends=“coldbox.system.testing.BaseModelTest” model=“app2.model.user” {
property name=“model” inject=“user”;

void function setup(){

// init the model object

void function list() {
var result = model.list();
assertIsQuery( result );

void function get() {
var result = model.get( 14 );
//Get an invalid user ID number.
assert( isNull(result) );

//Get a valid user ID number.
result = model.get( 148 );
assert( not isNull( result ) );
assertEquals( result.getuser_id(), 148, “Error getting user id” ); //Check that the id number can be retrieved.

void function update() {
//Get a valid user ID number.
var result = model.get( 148 );
assert( not isNull( result ) );

assert( result.getpassword() eq ‘’ );

void function add_delete() {
fail(‘No tests designed yet.’);


component persistent=“true” extends=“coldbox.system.orm.hibernate.ActiveEntity” table=“users” {
property name=“USER_ID” fieldtype=“id” column=“user_id” generator=“native” setter=“false”;
property name=“USERNAME” ormtype=“string” unique=“true” length=“20”;
property name=“PASSWORD” ormtype=“string” length=“50”;
property name=“ACTIVE_DATE” ormtype=“date”;
property name=“INACTIVE_DATE” ormtype=“date”;

Opps I forgot add the version to the subject CB 3.5

Does your unit tests directory have an Application.cfc ?

How is the unit tests relate is structure to your application and web root?


The unit testing is setup in the standard test folder of the application.

I just noticed that it did not extend coldbox so I added extends=“coldbox.system.coldbox” and got the following error.

Config file not located in conventions: config.Coldbox

What I’ve setup of the application using the user model works but not in the test environment.

Below is my /app2/test/application.cfc file

// ORM Settings this.ormEnabled = true; this.datasource = "mydatasource";

rootPath = replacenocase(replacenocase(getDirectoryFromPath(getCurrentTemplatePath()),“test\”,""),“test/”,"");

//this.mappings["/root"] = rootPath;
this.mappings["/test"] = getDirectoryFromPath(getCurrentTemplatePath());

this.ormSettings = {

logSQL = true,
flushAtRequestEnd = false,
autoManageSession = false,
eventHandling = true,
eventHandler = “coldbox.system.orm.hibernate.WBEventHandler”,
skipCFCWithError = true
//secondarycacheenabled = true
//cacheprovider = “ehCache”

public boolean function onRequestStart(String targetPage){
// ORM Reload

return true;

The Application.cfc should be kept at a minimum, then what you need to do is have that application.cfc extend your root application, this is not the way I do it but it looks like that is your problem.

So you might understand it better, because you are extending ColdBox in the Application.cfc, this basically is the working directory and ColdBox is trying to find the configuration from the current directory.

Which doesn’t exist, and the error reflects that.

I am not sure if you are using Eclipse with CFEclipse or CFBuilder, but either way you will be better setting up the remote facade for mxunit in there, gives greater control on running your tests inside your ide. I find this a better method for productivity.