TestResult Output Formats
Clone this wiki locally
MXUnit TestResult output formats
MXUnit 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:
- HTML Format
- ExtJs Format (deprecated)
- XML Format
- JUnit Report XML
- ColdFusion Query Format
- ColdFusion Array format
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:
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.
Following are simple examples of how to handle the various output types.
Note that in order to toggle between HTML and ExtJs format, pass in a URL.output=\[‘html’\|‘extjs’\]] to your TestSuite
1. HTML Format
The HTML output is basic preformatted HTML:
3. XML Format
This is basic raw XML format that can be transformed into custom HTML output.
``` !assets/outputs-3.png! *4. JUnit Report XML* This is an XML format that is used by [[Ant's JunitReport Task|http://ant.apache.org/manual/OptionalTasks/junitreport.html]]. 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.
<cfoutput query="q"> #q.component#, #q.testStatus# ... </cfoutput>
The available columns names: COMPONENT, CONTENT, DATETIME, DEBUG, ERROR, NUMBER, TESTNAME, TESTSTATUS, TIME, TRACE.
Summary data members ( 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
``` !assets/outputs-5.png! *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[["component"]#, #a["testStatus"|]]# ... </cfoutput>