[coldbox-3.8.1] Testing & CFBuilder 2 MXUnit Plugin

I’m getting my butt kicked trying to figure out how to use the MXUnit plugin within CFBuilder 2 and could use any assistance anyone can provide.

The error I get when trying to run my unit test using the MXUnit plugin is:

coldfusion.xml.rpc.CFCInvocationException: [coldfusion.runtime.TemplateProxy$InvalidMethodNameException : The method TestCase was not found in component C:\ColdFusion9\wwwroot\Depts\Sales\tests\specs\unit\UtilitiesTest.cfc.Ensure that the method is defined, and that it is spelled correctly.]

If I run this unit test through a web browser using the Coldbox-provided runner.cfm the tests run properly.

I’ve got CF 9.02 running locally and a CB 3.8.1 app installed a couple subdirectories deep:

Directory paths:

  • C:\
  • ColdFusion9\
  • wwwroot\ ← web root for local CF 9.02
  • mxunit\ ← downloaded from internet…thought I might need it for some reason?!
  • Depts\
  • Sales\ ← This is the root of my CB app
  • coldbox\
  • handlers\
  • model\
  • tests\
  • resources\
  • RemoteFacade.cfc ← MXUnit plugin pointed here, ping works successfully.
  • specs\
  • unit\
  • UtilitiesTest.cfc ← Trying to test a Utilities.cfc model here, definition below
  • Application.cfc ← code below
  • runner.cfm

Here’s my unit test:
`
component extends=“coldbox.system.testing.BaseModelTest” model=“model.Utilities” appMapping=’/root’{
void function setup(){
super.setup();

// init the model object
model.init();
}

function testMyMethod() {
assertions here…
}
}
`

Here’s my testing Application.cfc:

`
component output=“false” {

// APPLICATION CFC PROPERTIES
this.name = “SalesTestingSuite” & hash(getCurrentTemplatePath());
this.sessionManagement = true;
this.sessionTimeout = createTimeSpan(0,0,30,0);
this.setClientCookies = true;

// Mappings Imports
import coldbox.system.*;

// COLDBOX STATIC PROPERTY, DO NOT CHANGE UNLESS THIS IS NOT THE ROOT OF YOUR COLDBOX APP
COLDBOX_APP_ROOT_PATH = getDirectoryFromPath(getCurrentTemplatePath());
// The web server mapping to this application. Used for remote purposes or static purposes
COLDBOX_APP_MAPPING = “”;
// COLDBOX PROPERTIES
COLDBOX_CONFIG_FILE = “”;
// COLDBOX APPLICATION KEY OVERRIDE
COLDBOX_APP_KEY = “”;

// Location Mappings
this.mappings[’/coldbox’] = COLDBOX_APP_ROOT_PATH.ReplaceFirst( “([^\/]+[\/]){1}$”, “” ) & “coldbox”;

// Create testing mapping
this.mappings[ “/tests” ] = getDirectoryFromPath( getCurrentTemplatePath() );
this.mappings[ “/mxunit” ] = this.mappings[’/coldbox’] & “system/testing/compat”;
// Map back to its root
rootPath = REReplaceNoCase( this.mappings[ “/tests” ], “tests(\|/)”, “” );
this.mappings["/root"] = rootPath;

// ORM Settings
this.mappings["/model"] = COLDBOX_APP_ROOT_PATH.ReplaceFirst( “([^\/]+[\/]){1}$”, “” ) & “model”;
this.ormEnabled = true;
this.datasource = “SalesDSN”;
this.ormSettings = {
cfclocation = “…/model”,
dbcreate = “none”,
dialect = “MicrosoftSQLServer”,
schema = “sales”,
logSQL = true,
flushAtRequestEnd = false,
autoManageSession = false,
eventHandling = true,
eventHandler = “model.ORMEventHandler”,
secondaryCacheEnabled = true,
useDBForMapping = false
};
}
`

Thanks for any guidance any can spot here. I’m sure there are many items out of place so don’t spare my feelings. I’ve looked at the TestBox wiki and the MXUnit plugin posts on this group but just can’t piece it together unfortunately.

Wes