From Wikipedia, the free encyclopedia
Jump to: navigation, search

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.

Screenshot of the Eclipse Mxunit plugin


MXUnit was first released in 2007. As of 2013 the current version is v2.1.3 [1] It is the most widely used Unit testing framework in the Coldfusion, Railo and Lucee communities, many examples can be found today not only on the projects website but also on many popular ColdFusion blogs [2]

MXUnit Assertion Example[edit]

The below Asserts true if the desired condition is met, otherwise it'll return false indicating the test has failed.

<cffunction name="clearPrivilegesShouldClearPrivilegesFromObject">
    <cfset  obj = createObject("component","myObject")>
    <cfset obj.addPrivilege("EditUsers")>
    <cfset assertTrue( StructCount(obj.getPrivileges()),  "Guard assertion: Ensure we're starting out with privileges before testing clearPrivileges()")>
    <cfset  result = obj.clearPrivileges()>
    <cfset assertTrue( StructIsEmpty(obj.getPrivileges()), "clearPrivileges Should Have Emptied The Structure of privileges but didn't" )>

Output Formats[edit]

  1. HTML Format
  2. ExtJs Format (deprecated)
  3. XML Format
  4. JUnit Report XML
  5. ColdFusion Query Format
  6. ColdFusion Array format

Platforms and license[edit]

Screenshot of MXUnit tests running in the Sublime Text IDE

Versions 1.x are licensed under GPL and versions 2.x are licensed under the MIT open source license.[3]

MXUnit is supported on Lucee, Railo (Two popular open source CFML engines) and Adobe's Coldfusion application servers.

It has supported IDE plugins for both Eclipse IDE and Sublime Text

See also[edit]

CFUnit - an alternate unit testing framework for CFML.

JUnit - JUnit, what MXUnit is modeled after.

External links[edit]