PageRenderTime 41ms CodeModel.GetById 20ms app.highlight 1ms RepoModel.GetById 19ms app.codeStats 0ms

/SampleApplication/ColdBox3/test/readme.txt

http://github.com/bobsilverberg/ValidateThisColdBoxPlugin
Plain Text | 51 lines | 38 code | 13 blank | 0 comment | 0 complexity | a23068aa47f3fc9fb667e2c389b993cc MD5 | raw file
 1********************************************************************************
 2Copyright 2005-2007 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
 3www.coldboxframework.com | www.luismajano.com | www.ortussolutions.com
 4********************************************************************************
 5
 6ColdBox Unit Testing
 7
 8The following test cases have been created for testing of event handlers, please
 9note that the controller created is the ColdBox's testcontroller.
10
11The code speaks for itself. Just make sure you tests inherit from the base test
12according to testing framework. 
13
14Then create a setup method that follows the following pattern:
15
16<cffunction name="setUp" returntype="void" access="private">
17	<cfscript>
18	//Persist Framework in application scope for test.
19	THIS.PERSIST_FRAMEWORK = true or false;
20	
21	//Setup ColdBox Mappings For this Test
22	setAppMapping("/applications/coldbox/ApplicationTemplate");
23	setConfigMapping(ExpandPath(instance.AppMapping & "/config/config.xml.cfm"));
24		
25	//Call the super setup method to setup the app.
26	super.setup();
27		
28	//EXECUTE THE APPLICATION START HANDLER: UNCOMMENT IF NEEDED AND FILL IT OUT.
29	//getController().runEvent("ehMain.onAppInit");
30
31	//EXECUTE THE ON REQUEST START HANDLER: UNCOMMENT IF NEEDED AND FILL IT OUT
32	//getController().runEvent("ehMain.onRequestStart");
33	</cfscript>
34</cffunction>
35
36
37Structure:
38-integration
39	- GeneralTest.cfc - The test case for the General.cfc handler
40 	- MaintTest.cfc - The test case for the Main.cfc handler
41 -unit
42 	- For all your unit test cases.
43 -mocks
44 	- For any mock testing or mock objects.
45
46
47SPECIAL CONSIDERATIONS:
48Make sure that if you are using any relative paths in your application, that they become
49absolute. This is because the unit testing occurs inside of the unit testing framework
50which is outside of this app root. So please remember for unit testing to use absolute
51mappings on files or references. I recommend also using a test configuration file.