wheels test

Run unit tests from the command line

With wheels test we can test either you app, run core tests (if available) or run tests for a specific plugin. Remember, this command needs to run against a running server.

$ wheels test [type] [servername] [reload] [debug] [format]

type should be either app,core or a plugin name

servername is the name of the running server: whilst we will try and work this out by default, it's often easier to specify the servername as defined in your server.json file. You can of course have multiple servers running, so you might be testing against Lucee and Adobe ColdFusion, and have two different servers running on different ports.

reload (boolean) whether to add ?reload=true to the test URL: defaults to true

debug (boolean) whether to force display test results: by default, passed tests are hidden; but if you still want to see the list of tests run, set this to true.

format Defaults to json which is what Commandbox requires to output properly, but if for some reason you're experiencing a problem, you can force the return to be html

Running your application's Tests

# Run Your App tests (as located in /tests/)
$ wheels test app

# Run Your App tests against a different running server
$ wheels test app myServerName

# With a named arguments
$ wheels test type=app servername=myServerName reload=false

Running Plugin Tests

To run plugin tests, simply use the plugin name as the type (instead of app or core)

# Example: for a plugin named ical4j
# Run Plugin tests (as located in /plugins/ical4j/tests/) 
$ wheels test type=ical4j

Running CFWheels Core Tests

If you're on the CFWheels master branch, you can run the core tests (located in /wheels/tests/ against any of the predefined server.json files provided in the master branch. Note, these tests aren't available in the standard releases.

# Run CFWheels core tests against [email protected]
# In this example, lucee4 is the name of the server as defined in 
# server-lucee4.json found in the root
$ wheels test core lucee4

# or against Adobe 2016
$ wheels test core cf2016

# typical output:

Type:       core
Server:     lucee4
Name:       lucee4
Config:     D:\cfwheels/server-lucee4.json
Port:       60004
Debug:      false
Reload:     true
Format:     json
================CORE Tests =======================
Executing tests, please wait...
Please wait...
================ Tests Complete: All Good! =============
================ Results: =======================
Output from 1341 tests hidden
================ Summary: =======================
= Tests: 1341
= Cases: 280
= Errors: 0
= Failures: 0
= Successes: 1341

Things to watch out for...

Bear in mind that running tests from the CLI means that your unit tests are being executed as a user without cookies, and therefore without a session: so any tests which reference the session/cookie scope may fail.