TestBox from the CLI

Install the TestBox CLI, run your suite, watch for changes, and pick output formats.

On this page

TestBox is the BDD and TDD testing framework. In this lesson you will install the CLI module and run your tests from the terminal.

Install

box install testbox-cli

Then list what it adds:

box testbox help

Run your tests

testbox run hits your test runner URL and prints a CLI formatted report. Your application server must be running, though it does not have to be a CommandBox server.

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

If you do not pass a URL, the default is /tests/runner.cfm. To change it once, store it in your box.json:

box package set testbox.runner="/tests/runner.cfm"
box testbox run

A relative path makes CommandBox take the host and port from your server settings.

Exit codes

If any test fails, testbox run returns a failing exit code. That is what lets CI fail a build on a red test.

Output formats

Ask for several report formats at once and write them to a file:

box testbox run outputformats=json,antjunit,simple
box testbox run outputformats=json,antjunit,simple outputFile=myresults

Watch mode

testbox watch reruns the suite whenever a file changes. It needs your server running and the runner configured.

box testbox watch
box testbox watch **.cfc

Tune it from box.json:

box package set testbox.watchDelay=1000
box package set testbox.watchPaths=/models/**.cfc

Press Ctrl+C to stop.

More options

Settings such as verbose, labels and testSuites can live in box.json under testbox, or be passed on the command. For the full list for your version, ask the command itself:

box testbox run help

Recap

  • box install testbox-cli adds the testbox namespace.
  • testbox run prints results and fails with a non-zero exit code on failures.
  • testbox watch reruns on change, and outputformats produces reports for other tools.
Edit this page Download Markdown Last updated Nov 30, 2026, 8:08:15 PM Report an issue
Lesson 14 of 15 - Learn CommandBox