How to set up test?

Using commandbox embedded server I cannot run my test if I enable url rewriting usign --rewritesEnable flag.

If I try to run a test: I got this error:


Event: tests.specs
Routed URL: tests/specs/integration/HomeBDDTest.cfc/
Layout: N/A (Module: )
View: N/A
Timestamp: 04/08/2015 05:40:49 AM

This is an unfortunate limitation of Tuckey URL rewrites. The project hasn’t had a new version in a while so I’m not sure if it will ever get fixed.

You can see our default rewrite configuration here:

The rewrite engine is not supposed to kick in if the path points to an actual file or folder. However, that feature seems to not be working correctly according to Luis’ tests…

Here is the commit that supposedly added that feature:

Glancing at the code, there is debugging you can enable to figure out what’s happening. Feel free to dig in and try to figure out why it’s not working.



ColdBox Platform Evangelist
Ortus Solutions, Corp

ColdBox Platform:


I ran into this same issue a while back and the way I got around it was by doing the following. It may be a hack and ultimately not the way to go, but it at least got me around this issue until I could look into it in more detail.

In config/Routes.cfm I added:

if ( structKeyExists( url, ‘testRunner’ ) && url.testRunner ) {

Then in my integration tests I added:

beforeEach(function( currentSpec ){
// Setup as a new ColdBox request for this suite, VERY IMPORTANT. ELSE EVERYTHING LOOKS LIKE THE SAME REQUEST.
URL.testRunner = true;

Hope that helps a little.


You can add a custom rewrite config file that will exclude the “tests” directory. I have attached a sample one.

<?xml version="1.0" encoding="utf-8"?> ContentBox Media URLs ^/__media/.*$ ^/(.*)$ /index.cfm/$1 Generic Front-Controller URLs /(index.cfm|tests|robots.txt|osd.xml|flex2gateway|cfide|cfformgateway|railo-context|lucee|admin-context|modules/contentbox-dsncreator|modules/contentbox-installer|modules/contentbox|files|images|js|javascripts|css|styles|config).* \.(bmp|gif|jpe?g|png|css|js|txt|xls|ico|swf|woff|ttf|otf)$ ^/(.+)$ /index.cfm/$1

Luis Majano
Ortus Solutions, Corp
P/F: 1-888-557-8057
Direct: (909) 248-3408

ColdBox Platform:

ContentBox Platform:
Linked In:

Social: | | |

Thanks Luis, this configuration is the same generated by commandbox except the tests condition. Probably should be added to the template by default.

Unfortunately, I think that would then disallow the possibility of a handler called “tests”. We had quite a discussion over what to include by default in this JiRA ticket.

Everyone had a slightly different idea of what to do for default, so we left it pretty open and generic. I’d like to have the ability to ship CommandBox several default rewrite rule sets customized for ColdBox, CFWheels, ContentBox, etc. Once we implement server.json, it should be a little easier to declare a default rewrite file to use. Actually, I think THINK it will remember your last rewrite file automatically right now but I haven’t tested that specifically.



ColdBox Platform Evangelist
Ortus Solutions, Corp

ColdBox Platform: