What is MXUnit?
MXUnit is a unit testing framework for CFML developers, modeled after other xUnit frameworks (JUnit, etc). MXUnit honors the major XUnit conventions but deviates and enhances to provide a more enjoyable, idiomatic CF test experience.
Why MXUnit?
Several fine unit testing frameworks exist for ColdFusion. Why choose MXUnit?
At its core, MXUnit grew around the concept of making things easier for the person writing the tests. We believe people shy away from unit testing because the perception (sometimes justified!) is that it's too inconvenient. We sought to change that.
Convenience features
- Easy to see your data with cfoutput, cfdump, and debug()
- Easy to see your cfcatch struct when errors occur
- Test [single methods] inside a test case
- Easy "directory runner" for running entire directories of tests
- Easy to test private functions in your components
- Ability to [switch to message-first style assertions] to help ease transition from other frameworks
In addition to convenience features, MXUnit contains all the essential components of any unit testing framework:
Framework Must-Haves
Test Generator for existing components
Eclipse Plugin with built-in help and keyboard shortcuts
Ant Integration
Plugin architecture for creating custom assertions
Many different output formats
- Basic HTML results
- ExtJS "fancy" grid results
- XML results
- JUnitReport XML results (for use with the ANT task and the JUnitReport Ant Task)
- Query results
Active Development
- We're actively developing MXUnit and have more convenience features in the works. A sample:
- Easier exception testing
- Easier auto-rollback for tests that access databases
- JUnit 4 style "Hamcrest" assertions (assertThat(....))
- Customizable test generation