OK, so my first difference from your code to mine is we are only using
2.6.3, so we still have the coldbox.xlm.cfm file.
folders you'll care about:
+coldbox
+dashboard
+system
+beans
+cache
+config
+extras
+antisamy
+javaloader
+livewire
+testing
basemxunittest.cfc
basetest.cfc
+transfer
coldboxfactory.cfc
coldboxproxy.cfc
+includes
+interceptors
+plugins
+services
+testing
+mock
+mockutils
+stubs
baseHandlerTest.cfc
baseModelTest.cfc
baseTestCase.cfc
+util
+config
application.cfm
coldbox.xml.cfm
modelmappings.cfm
routes.cfm
+handlers
+includes
+interceptors
+layouts
+models
+mxunit
+plugins
+test
+integration
mainTest.cfc
+mocks
+resources
remoteFacade.cfc
+unit
application.cfc
testSuite.cfm
+views
I want to be able to set application variables in the test/
application.cfc file (if I can) since many of the models use
application variables. I figure I can do this because of the headless
setup?
I figured for mainTest.cfc I could either extend the
coldbox.system.testing.BaseMXUnitTestor since I added in the test
folder in system i thought i could use
coldbox.system.testing.BaseHandlerTest, but I am not really sure if
this will work in 2.6.3?
I also want to test my models not just handlers but not sure how to
set up a unit test for that, so I thought i'd start with handlers
since that seems documented.
Below is my mainTest.cfc, when I run this in builder i get the can't
find component or interface. when i run this in the browser, i get the
The getSetting method was not found. The error occurred in C:
\LOCALSERVER\icert-DEV\coldbox\system\testing\BaseTestCase.cfc: line
336:
<cfcomponent extends="coldbox.system.testing.BaseTestCase">
<cffunction name="setUp" returntype="void" output="false">
<cfscript>
//Setup ColdBox Mappings For this Test
setAppMapping("/");
setConfigMapping(ExpandPath(instance.AppMapping & "/config/
coldbox.xml.cfm"));
dump(getConfigMapping());
// Call the super setup method to setup the app.
super.setup();
// Any preparation work will go here for this test.
</cfscript>
</cffunction>
<cffunction name="testonAppInit" returntype="void" output="false"
access="remote">
<cfscript>
var event = "";
//Place any variables on the form or URL scope to test the handler.
//URL.name = "luis"
event = execute("main.onAppInit");
//Do your asserts below
</cfscript>
</cffunction>
</cfcomponent>
Not sure if I am trying to mix 3.0/3.5 code into my 2.6.3 code base,
or if I am just not setting something up right?
when I run this test, it works:
<cfcomponent extends="coldbox.system.extras.testing.BaseMXUnitTest">
<cffunction name="setUp" returntype="void" output="false">
<cfscript>
//Setup ColdBox Mappings For this Test
setAppMapping("\");
setConfigMapping(ExpandPath(instance.AppMapping & "/config/
coldbox.xml.cfm"));
// Call the super setup method to setup the app.
super.setup();
// Any preparation work will go here for this test.
</cfscript>
</cffunction>
<cffunction name="Testsplash" returntype="void" output="false">
<cfscript>
var event = "";
//Place any variables on the form or URL scope to test the handler.
//URL.name = "luis"
event = execute("ehSearch.splash");
//Do your asserts below
//assertEquals("ehSearch.splash",
event.getValue("setnextevent",""), "This totally failed!!");
assertEquals("", event.getValue("setnextevent",""), "This totally
failed!!");
</cfscript>
</cffunction>
cfc function called:
<cffunction name="splash" access="public" returntype="void"
output="false"
hint="I show a portal splash page.">
<cfargument name="Event" type="coldbox.system.beans.requestContext">
<cfset event.setLayout("Layout.Portal")>
<cfset Event.setView("Portal/vwPortalSplash")>
</cffunction>
now that function does nothing, but it ran. but the only test that
ran
Does this provide enough info?
thanks
dan