Blog

Brad Wood

December 18, 2017

Spread the word


Share your thoughts

For Christmas this year, why don't you give the gift of unit tests to everyone (including yourself) who may work on your app in the future.  Nothing else brings about the same amount of confidence in refactoring or assurance that your app still works on that new CF engine update you just installed.  While you use TestBox to write and run your tests, CommandBox has some commands built in to help you do it in style.  And most importantly, these CLI commands are perfect for automating your tests on your favorite CI server like Jenkins or Travis.

testbox run

There is a testbox run command available that will run your unit or integration tests from the command line. All you need is to have your server running (it doesn't have to be a CommandBox server).

Run your test suite like so (modify the runner URL to match your site).

testbox run "http://localhost:8080/tests/runner.cfm"

This will hit your runner URL and output a CLI-formatted report of your test results. If your test suite failed, the command will also return a failing exit code when being run from your native shell. This makes integrations with CI tools like Jenkins or Travis-CI very easy since a failing test will fail your build automatically.

Default runner URL

You can also set up the default runner URL in your box.json and it will be used for you. Setting the URL is a one-time operation.

package set testbox.runner="http://localhost:8080/tests/runner.cfm"
testbox run

Note that in CommandBox 4.0, you will be able to have relative runner URLs like /tests/runner.cfm which means you don't have to worry about the host or port.

Example Output

Here is an example of the non-verbose output.  Non-verbose only shows failing tests which can be handy when you have hundreds of tests and only care about the failing ones.

testbox run --noVerbose

Executing tests via http://127.0.0.1:55197/tests/runner.cfm?&recurse=true&reporter=json, please wait...
TestBox v2.5.0+107
---------------------------------------------------------------------------------
| Passed  | Failed  | Errored | Skipped | Time    | Bundles | Suites  | Specs   |
---------------------------------------------------------------------------------
| 8       | 0       | 0       | 0       | 112 ms  | 1       | 3       | 8       |
---------------------------------------------------------------------------------

Test Watcher

This is an extension of the testbox run command but will watch the files in a directory and run the default TestBox suite on any file change.  The watcher works great for IDEs that have an integrated terminal since you can edit your code and instantly see if you're testing are still passing as soon as you hit save.

testbox watch

In order for this command to work, you need to have started your server and configured the URL to the test runner in your box.json.

package set testbox.runner=http://localhost:8080/tests/runner.cfm
server start
testbox watch

You can also control what files to watch.

testbox watch **.cfc

If you need more control over what tests run and their output, you can set additional options in your box.json which will be picked up automatically by testbox run when it fires.

package set testbox.verbose=false
package set testbox.labels=foo
package set testbox.testSuites=bar
package set testbox.watchDelay=1000
package set testbox.watchPaths=/models/**.cfc

This command will run in the foreground until you stop it. When you are ready to shut down the watcher, press Ctrl+C

Add Your Comment

Recent Entries

ColdBox 8.1.0 Released — AI Routing, MCP, and BoxLang-First Power! 🚀

ColdBox 8.1.0 Released — AI Routing, MCP, and BoxLang-First Power! 🚀

We are thrilled to announce ColdBox 8.1.0, a targeted minor release packed with powerful new features, important improvements, and critical bug fixes across ColdBox, WireBox, and CacheBox. While minor in version number, this release delivers some truly exciting capabilities — especially for BoxLang developers building AI-powered applications.

Luis Majano
Luis Majano
April 14, 2026
ColdFusion Modernization for UK Universities Without Downtime

ColdFusion Modernization for UK Universities Without Downtime

Across the United Kingdom, many universities still rely on legacy ColdFusion and CFML systems to power student portals, enrollment platforms, research databases, payment gateways, and internal academic workflows.

These systems are often:

  • 15 to 25 years old
  • Mission-critical
  • Deeply integrated with student information systems
  • Running on older Adobe ColdFusion or Lucee versions
  • Tightly coupled monolithi...

Cristobal Escobar
Cristobal Escobar
April 13, 2026
BoxLang AI Series: Complete Guide to Building AI Agents

BoxLang AI Series: Complete Guide to Building AI Agents

The world of AI development is moving fast, but building real, production-ready AI agents doesn’t have to be complex.

This series walks you step by step through how to design, build, and deploy AI agents using BoxLang AI. Whether you’re exploring AI for the first time or looking to modernize your current applications, these guides will help you move from concept to implementation with clarity.


Start Here: A Practical Overview

If you’re new to BoxLang AI or want t...

Cristobal Escobar
Cristobal Escobar
April 13, 2026