MXUnit Unit Testing framework for ColdFusion developers Download Details Home Support BlogMXUnit provides a high level of flexibility by providing test results in various output formats. Some of these are preformatted, such as HTML, and others are raw to allow developers to generate customizable output formats.
The available TestResult output formats are:
We will use the MXUnit example found in the installation package mxunit/samples/MyTestSuite.cfm as the base TestResults. You may want to refer to your local TestResult API for details; e.g., http://localhost:8500/mxunit/doc/api/
The syntax for generating the various types of output is:
<cfset output = results.getResultsOutput( ['html', 'extjs', 'xml', 'junitxml', 'query', 'array'] ) /> <cfoutput>#output#<cfoutput>Note: Since the above
query and array types are complex data structures, you will get an error by trying to print those directly, as illustrated above. You most likely be computing other outputs if you use those types.1. HTML Format
The HTML output is basic preformatted HTML:
<cfoutput>#results.getResultsOutput( 'html' )#<cfoutput>
2. ExtJs Format
ExtJs is a rich user interface set of APIs written in JavaScript.
<cfoutput>#results.getResultsOutput( 'extjs' )#<cfoutput>

3. XML Format
This is basic raw XML format that can be transformed into custom HTML output.
<cfoutput>#results.getResultsOutput( 'xml' )#<cfoutput>

4. JUnit Report XML
This is an XML format that is used by Ant's JunitReport Task. Also see the MXUnit Ant Task for usage information.
<cfoutput>#results.getResultsOutput( 'junitxml' )#<cfoutput>

5. ColdFusion Query Format
Returns a CF Query object that you can loop over as if it were a database query.
<cfset q = results.getResultsOutput( 'query' ) /> <cfoutput query="q"> #q.component#, #q.testStatus# ... </cfoutput>The available columns names:
COMPONENT, CONTENT, DATETIME, DEBUG, ERROR, NUMBER, TESTNAME, TESTSTATUS, TIME, TRACE.q = results.getResultsOutput('query') ) :q.testRuns = How many tests were run,q.failures = How many tests fail,q.errors = How many errors occurred,q.successes = How many successes occurred,q.totalExecutionTime = How long it took, in milliseconds, to run all the tests<cfdump var="#results.getResultsOutput( 'query' )#" />

6. ColdFusion Array Format
This is how internal test results are stored within the TestResult component.
To access specific members, you can execute the following:
<cfset a = results.getResultsOutput( 'array' ) /> <cfoutput> #a[1]["component"]#, #a[1]["testStatus"]# ... </cfoutput>
<cfdump var="#results.getResultsOutput( 'array' )#" />
