com.googlecode.jslint4java.formatter
Class JUnitXmlFormatter

java.lang.Object
  extended by com.googlecode.jslint4java.formatter.XmlFormatter
      extended by com.googlecode.jslint4java.formatter.JUnitXmlFormatter
All Implemented Interfaces:
JSLintResultFormatter

public class JUnitXmlFormatter
extends XmlFormatter
implements JSLintResultFormatter

After a bit of experimentation, this seems to be the best way to represent JSLint output in JUnit format:

 
 <testsuite failures="0" time="0.131" errors="0" skipped="0" tests="1" name="good.js">
   <testcase time="0.022" classname="com.googlecode.jslint4java" name="good.js"/>
 </testsuite>
 
 <testsuite failures="1" time="0.2" errors="0" skipped="0" tests="1" name="bad.js">
   <testcase time="0.078" classname="com.googlecode.jslint4java" name="bad.js">
     <failure message="Found 11 problems" type="java.lang.AssertionError">
 prettify.js:54:8:['PR_SHOULD_USE_CONTINUATION'] is better written in dot notation.
 prettify.js:57:8:['PR_TAB_WIDTH'] is better written in dot notation.
 prettify.js:63:8:['PR_normalizedHtml'] is better written in dot notation.
 prettify.js:68:3:Bad line breaking before '='.
 prettify.js:68:12:['PR'] is better written in dot notation.
 prettify.js:75:3:Bad line breaking before '='.
 prettify.js:75:12:['prettyPrintOne'] is better written in dot notation.
 prettify.js:81:3:Bad line breaking before '='.
 prettify.js:81:12:['prettyPrint'] is better written in dot notation.
 prettify.js:81:29:Expected an identifier and instead saw 'void'.
 prettify.js:81:29:Stopping, unable to continue. (5% scanned).
     </failure>
   </testcase>
 </testsuite>
 
After a bit of testing in pulse and hudson, this appears to give reasonable output.


Constructor Summary
JUnitXmlFormatter()
           
 
Method Summary
 String format(JSLintResult result)
          Convert JSLintResult into a suitably formatted String representation.
protected  String root()
          The name of the root element.
 
Methods inherited from class com.googlecode.jslint4java.formatter.XmlFormatter
attr, escape, footer, header
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.googlecode.jslint4java.formatter.JSLintResultFormatter
footer, header
 

Constructor Detail

JUnitXmlFormatter

public JUnitXmlFormatter()
Method Detail

format

public String format(JSLintResult result)
Description copied from interface: JSLintResultFormatter
Convert JSLintResult into a suitably formatted String representation.

Specified by:
format in interface JSLintResultFormatter

root

protected String root()
Description copied from class: XmlFormatter
The name of the root element.

Specified by:
root in class XmlFormatter


Copyright © 2007-2012. All Rights Reserved.