ColdBox Unit Testing of the Model


I am just getting the unit testing. I have the integration tests where they seem to be working… what do I have to do to get this to work. I have tried several things and I keep getting errors. I cannot seem to get the object called… in the

component extends=“coldbox.system.testing.BaseTestCase” appMapping="/myapp"
// Test for getAll
public void function testGetAll()
obj = new model.tables.val_userType.val_userTypeService();
//obj = createObject(“component” ,“model.tables.val_userType.val_userTypeService()”); // model in folder /myapp/model/tables/val_userType/val_usertypeService.cfc
//this.mycomp = createObject(“component” ,“MyComponent”);
//var oUserType = populateModel(“val_userTypeService”);
//var userTypeList = rc.oUserType.getAll();


If I understand you correctly, you are having trouble creating a new “obj” with this line: " obj = new model.tables.val_userType.val_userTypeService(); ".



If your app is structed as outlined above you likely just need to create an application mapping to /model in your /test/Application.cfc. Your app may be seeking your “model” in “/test/model”.

Aaron Greenlee

Yes, I figured it was something simple I was overlooking… thanks.