Hello-
I was at Into the Box and got fired up about implementing Testbox. However I find myself stuck getting started….I am trying to test a method in a cfc using this: http://wiki.coldbox.org/wiki/TestBox-unit-primer.cfm I cannot find where to tell it what cfc it should be testing and how to have access to that model. I thought it was slick how the mxUnit worked (http://wiki.coldbox.org/wiki/Testing.cfm#Model_Object_Testing) and just am wondering if I am missing something with TestBox or if I just need to use mockbox or wirebox to bring in the object to call methods on ? Or do I still use the http://wiki.coldbox.org/wiki/Testing.cfm#Model_Object_Testing style? Any examples you have up would be great as I could not find any on any of the Testbox primers… Thanks!!
My current code for testbox….my cfc is called UDFs and the method I am trying to test is addNumbers:
component displayName=“UDFsTest” {
/*********************************** LIFE CYCLE Methods ***********************************/
function beforeTest(){
}
function afterTest(){
structClear( application );
}
function setup(){
}
/*********************************** TDD SUITES ***********************************/
function testaddNumbers(){
$assert.isEqual( 4, addNumbers(3) );
}
}
From the UDFs cfc:
component output=“false” displayname=“UDFS” hint=“I contain user defined functions” {
public any function init(){
return this;
}
public numeric function addNumbers ( required numeric num ){
return 2 + num;
}
}