Writing a test for CiviCRM usually consists of three steps:
1. Figuring out a test case scenario
2. Preparing test data set
3. Writing the test
Figuring out a test case scenario
First step is making a decision about what should be tested.
TODO (two ways - extending the coverage of existing tests or writing new ones, testing specific classes (BAOs preferred) or testing specific scenarios)
Preparing test data set
TODO (look around in dataset directory to see if there is no relevant datasets already cleated that will be useful for your test)
Example of Flat XML data set
Example of XML data set
For more information about Database testing, refer to phpUnit documentation.
Writing the test
Start off with creating a class, like in below example.
TODO ()
