By installing the CommandBox TestBox CLI you can get access to our CommandBox runner. The CommandBox runner leverages the HTTP(s) protocol to test against any server. By default it will inspect your box.json
for a default
runner or try to connect to /tests/runner.cfm
by default.
To see all the running options run the following in your CLI shell:
It can also produce reports for you in JSON, HTML, and JUNIT.
If you type testbox run --help
you can see all the arguments you can set for running your tests. However, please note that you can also pre-set them in your box.json
under the testbox
entry:
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.
You can also use a relative path and CommandBox will look up the host and port from your server settings.
The default runner URL of the testbox run
command is /tests/runner.cfm
so there's actually no need to even configure it if you're using the default convention location for your runner.
You can define multiple URLs for your runners by using a JSON array of objects. Each key will be a nice identifier you can use via the runner=key
argument in the command.
Then you can just pass in the name:
More Commands:
The CLI also comes with a code watcher and runner. It will watch any paths for you, and if it detects any changes, it will run the tests you want.
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
.
You can also control what files to watch.
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.
This command will run in the foreground until you stop it. When you are ready to shut down the watcher, press Ctrl+C
.