- The file is a component (a .cfc file)
- The filename either starts or ends with "Test"
- The component extends mxunit.framework.TestCase or extends a component that eventually extends mxunit.framework.TestCase
- The TestCase can contain setUp() and tearDown() functions that will run prior to and after each and every test
- (MXUnit 2.0) The TestCase can contain beforeTests() and afterTests() functions that will be run once before and once after all tests
- The TestCase can contain any number of public methods. Those public methods are considered tests regardless of their name, and MXUnit will run them as tests. Failures will be recorded as failures; errors as errors; and successes as successes
- Inside of your tests, you make assertions on the results of functions that you call on your component under test
- Any private methods are not considered tests and will not be run by MXUnit
- To very quickly get started, you can run the test by loading it in the browser and suffixing it with "?method=runTestRemote", like so:
- http://localhost/myapp/tests/MyTest.cfc?method=runTestRemote
- All the other ways of running tests, including in the Eclipse plugin, in a DirectoryTestSuite, or with ANT, are covered elsewhere in the docs
Study this TestCase skeleton to learn more
MyTest.cfc