Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Test Annotations

Test bundle annotations appMapping, configMapping, loadColdBox, and unloadColdBox control the test application.

Here are the annotations you can add to your testing bundle class to change behavior:

Annotation
Type
Required
Default
Description

appMapping

string

false

/

The application mapping of the ColdBox application to test. By defaults it maps to the root. Extremely important this mapping is a slash notation that points to the root of the ColdBox application to test.

configMapping

string

false

{appMapping}/config/Coldbox.cfc

The configuration file to load for this test, which by convention uses the same configuration as the application uses. This is a dot notation path to a configuration class.

loadColdBox

boolean

false

true

By default the base test case will load the virtual application into the applicationscope so all specs can execute

unloadColdBox

boolean

false

true

The base test case will unload the virtual application from the application scope after all specs have executed.

Examples

@appMapping( "/apps/MyApp" )
class extends="coldbox.system.testing.BaseTestCase" {}

@appMapping( "/apps/MyApp" )
@configMapping( "apps.MyApp.test.resources.Config" )
class extends="coldbox.system.testing.BaseTestCase" {}
component extends="coldbox.system.testing.BaseTestCase" appMapping="/apps/MyApp"{}

component extends="coldbox.system.testing.BaseTestCase"
    appMapping="/apps/MyApp" 
    configMapping="apps.MyApp.test.resources.Config"{}

Caution The AppMapping setting is the most important one. This is how your test connects to a location of a ColdBox application to test.

Last updated

Was this helpful?