Handy Hint for running TestBox Tests

- 1 min

Last year I migrated my ColdFusion unit tests from MXUnit test to TestBox, and it's been a great decision.

While I'm developing I generally run the test I'm working on in my web browser, calling the runRemote method, as shown below:

http://localhost/tests/MyTest.cfc?method=runRemote

However it's generally very inconvenient to have to type in the URL for each test, and I've been looking for a better way to run them.

Today I realised that with directory browsing enabled in Apache, and rewrite rule I can easily navigation to the file in my browser and run it with only a few mouse clicks.

Here's the rewrite rule I use:


RewriteCond %{REQUEST_URI} ^/tests/(.*).cfc$
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^/(.*)$ $1?method=runRemote [R=301,L]

Now I simply call up http://localhost/tests in my browser, then navigate to the file I'm working on, click on it, and the tests run.

I thought I'd share this tip in case it's of use to others. Please let me know if you find it useful, or have any questions.

Andrew Myers

Andrew Myers

Web Developer

comments powered by Disqus
rss facebook twitter github youtube mail spotify instagram linkedin google pinterest medium vimeo