java.lang.Object
com.carrotsearch.ant.tasks.junit4.listeners.json.JsonReport
All Implemented Interfaces:
AggregatedEventListener

public class JsonReport extends Object implements AggregatedEventListener
A report listener that produces a single JSON file for all suites and tests.
  • Field Details

  • Constructor Details

    • JsonReport

      public JsonReport()
  • Method Details

    • setFile

      public void setFile(File file)
      Output file for the report file. The name of the output file will also trigger how the report is written. If the name of the output file ends with ".htm(l)?" then the output file is a HTML file and CSS/JS scaffolding is also written to visualize the JSON model. If the name of the file ends with ".json(p)?" a JSON file is written.
    • setJsonpMethod

      public void setJsonpMethod(String method)
      Sets wrapper method name for JSONP. If set to non-empty value, will change the output format to JSONP. The name of the JSONP function for the HTML wrapper must be "testData".
      See Also:
      • "http://en.wikipedia.org/wiki/JSONP"
    • setProjectName

      public void setProjectName(String projectName)
      Set project name for the output model.
    • setOutputStreams

      public void setOutputStreams(boolean outputStreams)
      Include output streams? Mind that with large outputs the report may OOM.
    • setOuter

      public void setOuter(JUnit4 junit4)
      Description copied from interface: AggregatedEventListener
      Link to the container. Listener can throw BuildException if parameter validation doesn't succeed, for example.
      Specified by:
      setOuter in interface AggregatedEventListener
    • removeExtension

      private String removeExtension(String name)
    • getProjectName

      private String getProjectName()
      Return the project name or the default project name.
    • onSuiteResult

      public void onSuiteResult(AggregatedSuiteResultEvent e)
      Emit information about a single suite and all of its tests.
    • onQuit

      public void onQuit(AggregatedQuitEvent e)
      All tests completed.
    • copyScaffolding

      private void copyScaffolding(File targetFile) throws IOException
      Copy HTML/JS/CSS scaffolding to a targetFile's directory.
      Throws:
      IOException