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.

Screenshot of the Eclipse Mxunit plugin

History

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

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" )>
</cffunction>

Output Formats

  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

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

CFUnit - an alternate unit testing framework for CFML.

JUnit - JUnit, what MXUnit is modeled after.

External links

References

This article is issued from Wikipedia - version of the Friday, August 14, 2015. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.