The Chisimba PHPUnit Test Case Builder generates PHP test case classes for any Chisimba module.
It implements a code pattern analyzer that classifies code into logical groups like Data Management, Utility, Callback and Display methods.
These code groupings are then transferred to a single PHPUnit skeleton class divided into the logical associations. All the standard, known asserts are added to the code making it ready for phpunit to process on the fly.
It creates a file with the following checks:
- Uses the register.conf file to check against the current environment for dependencies.
- Uses the live database structures to construct wrapper code for individual table field checks.
- The Data Management Tests are broken down logically into Add/Edit/Delete sections and uses the table field checks to verify expected data (Uses table field data type to produce test data)
This provides a solid base for the developer to start unit testing from as the last step would be to peruse the skeleton and logically select the proper assertions to use. The benefits of having logically inclined test cases include the ability to make core changes and see the rippling effects, identify possible problematic areas (e.g. fields as arguments in insert/edit that do not match up to database field names), identify optimization targets and improve overall integrity of your module.
For display/ui testing, there are plans to integrate and automate selenium test code generation as PHPUnit already has some form of support for this.
Stay tuned for progress.