ColdBox 3b and MXUnit

Hi, I'm running ColdBox 3.0.0 (Beta 1 - Proverbs 20:3), ColdFusion 9
and the latest MXUnit. When I create an application using the
ColdFusion Builder extension, and run the generated test (http://
localhost/cb_skeleton/test/integration/generalTest.cfc?
method=runTestRemote) it loads
http://localhost/CFIDE/componentutils/cfcexplorer.cfc?method=getcfcinhtml&name=cb_skeleton.test.integration.generalTest&path=/cb_skeleton/test/integration/generalTest.cfc

Just to check that it wasn't a problem with MXUnit I ran
http://localhost/mxunit/tests/samples/MyComponentTest.cfc?method=runTestRemote
and that loads the results in the browser as I would expect.

Can anyone spot something wrong with my setup?

Thanks,

- John

Hi John,

I would suggest to get Latest code from SVN, couple of very important
unit-test issues been fixed.
One of the issue was "incorrect path".

http://www.coldboxframework.com/index.cfm/download/svnaccess
Try and let us know

Thanks
Sana

Hi Sana,

Thanks for the reply, I've updated to the ColdBox nightly build,
created a new "Advanced" ColdBox application using the ColdFusion
Builder extension and I get a different error now.

I can run the app in the browser fine (http://localhost/cb_skeleton),
but when I call the unit test at:
http://localhost/cb_skeleton/test/integration/mainTest.cfc?method=runTestRemote

I get this error:

The handlers directory:
C:\xampp\htdocs\cb_skeleton\test\integration\handlers does not exist
please check your application structure or your Application Mapping.

The error occurred in C:\xampp\htdocs\coldbox\system\core\util\Util.cfc: line 67
Called from C:\xampp\htdocs\coldbox\system\services\HandlerService.cfc: line 277
Called from C:\xampp\htdocs\coldbox\system\services\HandlerService.cfc: line 36
Called from C:\xampp\htdocs\coldbox\system\services\LoaderService.cfc: line 98
Called from C:\xampp\htdocs\coldbox\system\Coldbox.cfc: line 65
Called from C:\xampp\htdocs\cb_skeleton\Application.cfc: line 35
65 : <cfargument name="type" type="string" required="no"
default="Framework">
66 : <!--- ************************************************************* --->
67 : <cfthrow type="#arguments.type#" message="#arguments.message#"
detail="#arguments.detail#">
68 : </cffunction>
69 :

Browser Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US)
AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.25 Safari/532.0
Remote Address 127.0.0.1
Referrer
Date/Time 15-Oct-09 08:46 AM
Stack Trace
at cfUtil2ecfc662210879$funcTHROWIT.runFunction(C:\xampp\htdocs\coldbox\system\core\util\Util.cfc:67)
at cfHandlerService2ecfc1638307594$funcREGISTERHANDLERS.runFunction(C:\xampp\htdocs\coldbox\system\services\HandlerService.cfc:277)
at cfHandlerService2ecfc1638307594$funcONCONFIGURATIONLOAD.runFunction(C:\xampp\htdocs\coldbox\system\services\HandlerService.cfc:36)
at cfLoaderService2ecfc1863477479$funcCONFIGLOADER.runFunction(C:\xampp\htdocs\coldbox\system\services\LoaderService.cfc:98)
at cfColdbox2ecfc1334215415$funcLOADCOLDBOX.runFunction(C:\xampp\htdocs\coldbox\system\Coldbox.cfc:65)
at cfApplication2ecfc83660629$funcONAPPLICATIONSTART.runFunction(C:\xampp\htdocs\cb_skeleton\Application.cfc:35)

coldfusion.runtime.CustomException: The handlers directory:
C:\xampp\htdocs\cb_skeleton\test\integration\handlers does not exist
please check your application structure or your Application Mapping.
  at coldfusion.tagext.lang.ThrowTag.doStartTag(ThrowTag.java:142)
  at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2722)
  at cfUtil2ecfc662210879$funcTHROWIT.runFunction(C:\xampp\htdocs\coldbox\system\core\util\Util.cfc:67)
  at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
  at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
  at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
  at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
  at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
  at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
  at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:490)
  at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:336)
  at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2360)
  at cfHandlerService2ecfc1638307594$funcREGISTERHANDLERS.runFunction(C:\xampp\htdocs\coldbox\system\services\HandlerService.cfc:277)
  at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
  at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
  at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
  at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
  at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
  at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
  at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
  at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2582)
  at cfHandlerService2ecfc1638307594$funcONCONFIGURATIONLOAD.runFunction(C:\xampp\htdocs\coldbox\system\services\HandlerService.cfc:36)
  at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
  at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
  at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
  at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
  at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
  at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
  at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
  at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:490)
  at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:336)
  at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2360)
  at cfLoaderService2ecfc1863477479$funcCONFIGLOADER.runFunction(C:\xampp\htdocs\coldbox\system\services\LoaderService.cfc:98)
  at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
  at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
  at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
  at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
  at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
  at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
  at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
  at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:490)
  at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:336)
  at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2360)
  at cfColdbox2ecfc1334215415$funcLOADCOLDBOX.runFunction(C:\xampp\htdocs\coldbox\system\Coldbox.cfc:65)
  at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
  at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
  at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
  at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
  at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
  at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
  at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
  at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2582)
  at cfApplication2ecfc83660629$funcONAPPLICATIONSTART.runFunction(C:\xampp\htdocs\cb_skeleton\Application.cfc:35)
  at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
  at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
  at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
  at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
  at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
  at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
  at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
  at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:490)
  at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:336)
  at coldfusion.runtime.AppEventInvoker.invoke(AppEventInvoker.java:88)
  at coldfusion.runtime.AppEventInvoker.onApplicationStart(AppEventInvoker.java:211)
  at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:224)
  at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
  at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:74)
  at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
  at coldfusion.filter.PathFilter.invoke(PathFilter.java:87)
  at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27)
  at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
  at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
  at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
  at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
  at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
  at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
  at coldfusion.xml.rpc.CFCServlet.invoke(CFCServlet.java:138)
  at coldfusion.xml.rpc.CFCServlet.doGet(CFCServlet.java:264)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
  at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
  at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
  at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
  at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
  at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
  at jrun.servlet.FilterChain.service(FilterChain.java:101)
  at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
  at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
  at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
  at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
  at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
  at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
  at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
  at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
  at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

Can you post your test please.

Also you coldbox.xml that you are using for testing and the app. And a simple app layout.

Luis,

Thats the exact same problem I am getting as well, I haven’t had time to zip mine upto you as yet either.

Ok,

I think I figured it out. The problem lies in that the request still get’s intercepted by the ColdBox’s Application’s aplication.cfc

Therefore, it tries to start up the app when you are doing your cfc tests.

So the solution, is to add an Application.cfc/cfm to your tests directory with the basics. here is mine:

This resolved my handlers not found issue.

Hi Luis,

Thanks for the reply. Unfortunately, adding the Application.cfc
doesn't solve the handlers does not exist error I was getting. When I
call the url with of without Application.cfc in the test directory I
get:

http://localhost/cb_skeleton/test/integration/generalTest.cfc?method=runtestremote

The handlers directory:
redirect:\cb_skeleton\index.cfm\\cb_skeleton\test\integration\handlers
does not exist please check your application structure or your
Application Mapping.

I don't have any mappings set up and I did a refresh install of
ColdFusion 9 to make sure. I've attached the skeleton ColdBox 3
application I'm using to test.

Thanks for your help,

- John

cb_skeleton.zip (23.9 KB)

Will test your sample code soon and see why you are getting errors.

Also,

please note that I will update the code to match the new standards in 3.0.0 that exist in the SVN. I will go over them once I check the app out.

Thanks Luis! If I can get the line debugger running on my ancient
laptop I'll see if I can spot anything that helps.

Here are my results

  1. I copied the app to my root as /cb_skeleton
  2. Opened the generalTest.cfc and modified it for the new conventions:
//Call the super setup method to setup the app. super.setup();

//EXECUTE THE APPLICATION START HANDLER: UNCOMMENT IF NEEDED AND FILL IT OUT.
//getController().runEvent(“main.onAppInit”);

//EXECUTE THE ON REQUEST START HANDLER: UNCOMMENT IF NEEDED AND FILL IT OUT
//getController().runEvent(“main.onRequestStart”);

Basically, I add an annotation called: “appMapping=”/cb_skeleton"" that makes the test point to the root of the coldbox app.

  1. I imported the project to eclipse
  2. Right clicked on it and went to mxunit properties added my wsdl url and added “cb_skeleton” as my mapping path.
  3. Right clicked on the generalTest.cfc and said: Run MXUnit test.

It runs and completes.

I then run it via the URL and also works.
http://cfcbox.lmajano/cb_skeleton/test/integration/generalTest.cfc?method=runTestRemote

Second Test: Railo 3.1

So I don’t know what you are doing that does not allow this, but I tested it under both engines and it works. Please let me know what you find.

cb_skeleton.zip (23.8 KB)

Thanks Luis,

I ran your code and still get errors, so I think it must be something about my set up. For your info; I’m running on Windows, using Apache and ColdFusion 9 as a standalone install.

I’ve been stepping through the code and one thing that struck me as odd is that on line C:\xampp\htdocs\coldbox\system\testing\BaseTestCase.cfc:63

var appRootPath = expandPath(instance.AppMapping);

The variables is being set to “C:\ColdFusion9\wwwroot”. instance.AppMapping is a blank string. That path is my ColdFusion install, not my webroot. As you can see, the code being executed is C:\xampp\htdocs\coldbox\system\testing\BaseTestCase.cfc.

Weird. I will dig deeper and see if I can find out anymore.

2009/10/20 Luis Majano <lmajano@gmail.com>

Yes, that is weird John,

Please let me know what could be the culprit here.

I’ve tested this code on a couple of windows servers (CF8 & 9) and get the same thing.

#ExpandPath(“”)# // returns CF web root (C:\ColdFusion9\wwwroot)

#ExpandPath(“/”)# // returns application web root (C:*apache***htdocs)

So, if I don’t add the appMapping annotation, or use appMapping=“” (as I’m running from the webroot), it fails. Throwing the error:
“HandlerService.HandlersDirectoryNotFoundException: The handlers directory: redirect:\cb_skeleton\index.cfm\cb_skeleton\test\integration\handlers does not exist please check your application structure or your Application Mapping.”

However if I do appMapping=“/” (or a sub folder like “/cb_skeleton”) it is fine.

HTH

  • John

P.S. ColdBox 3 is awesome!

This is definitely weird then. What do you think we should do?

  1. Document this
  2. When the appMapping is blank, automatically set it to “/”

What are your thoughts?

Hey Luis,

That’s why Windows is great - always keeps you on your toes :slight_smile:

I did modify the setup() method of BaseTestCase.cfc to trap it when I was debugging and that seemed to do the trick. The extra code is minimal so personally I’d add it. I can guarantee that someone won’t read the docs first.

  • John