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