Installing and using the framework
Requirements
- CFMX 6.1 or BlueDragon 6.1
- Mach II v1.0.9 (optional)
Installation
- Install Mach II (v1.0.9) if you want to use the TestRunner.
- Extract the code into your web root. For example
/webserver/wwwroot/CFTestingKit
. - Create a mapping to the CFTestingKit folder. For example
CFTestingKit
maps to/webserver/wwwroot/CFTestingKit
. - Never deploy the framework and the test cases on a production instance, but on test and staging environments.
See the Getting Started tutorial for more information.
Getting started
A test case defines the fixture to run multiple tests. To define a test case:
- create component extending
CFTestingKit.TestCase
; - implement test methods;
- optionally define instance variables that store the state of the fixture;
- optionally initialize the fixture state by overriding
setUp
; - optionally clean-up after a test by overriding
tearDown
.
Test methods prefixed with test
, such as <cffunction name="testSomething"></cffunction>
are automatically recognized as test cases by the CFTestingKit framework.
Using TestRunner
TestRunner is a user interface for running the test cases. It scans the web root and displays a list of available test cases.
The test cases must be installed in a (test)
folder.
For example /webserver/wwwroot/MyCalculator/(test)/MathTest.cfc
.
The ()
provide a visual cue to remind you to not deploy the
test cases on a production instance.
The TestRunner is not mandatory. You can write your own user interface by exploiting the TestSuite and TestResult components. See the online tutorial for more information.