Testing Methods
BaseSpec
It is important to get familiar with TestBox before adventuring into ColdBox testing. Therefore, we suggest you reference the TestBox Docs (https://testbox.ortusbooks.com/primers/testbox-bdd-primer) or the TestBox API Docs (http://apidocs.ortussolutions.com/testbox/current). Below you can see a few of the common methods available to you.
We highly encourage you to use expectations instead of assertions in order to use more human and fluent syntax: https://testbox.ortusbooks.com/in-depth/expectations
BaseTestCase
As we have seen that our BaseTestCase
inherits from the BaseSpec
you get all the goodness of TestBox. However, the BaseTestCase
also has a wealth of methods to assist in your testing adventures:
https://apidocs.ortussolutions.com/coldbox/current/?coldbox/system/testing/BaseTestCase.html
Here are some useful methods:
ColdBox TestBox Matchers
ColdBox also automatically adds several custom matchers to TestBox, so it can help you get nice expectations:
toHaveStatus()
Checks if the ColdBox response object has a matched status code.
toHaveInvalidData()
Expectation for testing against cbValidation
invalid data fields returned in a Restful response by looking into the response object.
toRedirectTo()
The expectation for testing if an event returns a relocation.
Last updated