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
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
# 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
To run plugin tests, simply use the plugin name as the
type (instead of
# Example: for a plugin named ical4j # Run Plugin tests (as located in /plugins/ical4j/tests/) $ wheels test type=ical4j
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 Host: 127.0.0.1 Port: 60004 URL: http://127.0.0.1:60004/rewrite.cfm?controller=wheels&action=wheels&view=tests&type=core&format=json&reload=true 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 ==================================================
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.
Updated over 4 years ago