# Class TestReporting

java.lang.Object
com.codename1.testing.TestReporting

public class TestReporting extends Object
Test reports can be overriden to provide custom test reporting options you can replace the test reporter on the device by sending the build argument build.testReporter='com.x.MyTestReporterClass'.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TestReporting()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `finishedTestCase(UnitTest test, boolean passed)`

  ###### Deprecated

  `void`
  `finishedTestCase(String testName, boolean passed)`
  Invoked when a unit test has completed
  `static TestReporting`
  `getInstance()`
  Gets the test reporting instance
  `void`
  `logException(Throwable err)`
  Indicates an error from the current test case
  `void`
  `logMessage(String message)`
  Indicates a message from the current test case
  `static void`
  `setInstance(TestReporting i)`
  Sets the test reporting instance to a subclass of this class.
  `void`
  `startingTestCase(UnitTest test)`

  ###### Deprecated

  `void`
  `startingTestCase(String testName)`
  Invoked when a unit test is started
  `void`
  `testExecutionFinished()`

  ###### Deprecated

  `void`
  `testExecutionFinished(String testSuiteName)`
  Callback to indicate the test execution has finished allowing for a report to be generated if appropriate
  `void`
  `writeReport(OutputStream os)`

  ###### Deprecated

  `void`
  `writeReport(String testSuiteName, OutputStream os)`
  Writes a test report to the given stream

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### TestReporting

    public TestReporting()

- ## Method Details

  - ### getInstance

    public static TestReporting getInstance()
    Gets the test reporting instance

  - ### setInstance

    public static void setInstance(TestReporting i)

    Sets the test reporting instance to a subclass of this class.

    ###### Parameters

    - `i`: the new instance

  - ### startingTestCase

    public void startingTestCase(String testName)
    Invoked when a unit test is started

  - ### startingTestCase

    public void startingTestCase(UnitTest test)

    ###### Deprecated

    this method is no longer invoked by the testing framework; please use `#startingTestCase(String)`

  - ### logMessage

    public void logMessage(String message)

    Indicates a message from the current test case

    ###### Parameters

    - `message`: the message

  - ### logException

    public void logException(Throwable err)

    Indicates an error from the current test case

    ###### Parameters

    - `err`: the error message

  - ### finishedTestCase

    public void finishedTestCase(String testName, boolean passed)

    Invoked when a unit test has completed

    ###### Parameters

    - `testName`: the name of the test case

    - `passed`: true if the test passed and false otherwise

  - ### finishedTestCase

    public void finishedTestCase(UnitTest test, boolean passed)

    ###### Deprecated

    this method is no longer invoked by the testing framework; please use `boolean)`

  - ### writeReport

    public void writeReport(String testSuiteName, OutputStream os) throws IOException

    Writes a test report to the given stream

    ###### Parameters

    - `testSuiteName`: the name of the test suite

    - `os`: the destination stream

    Throws:
      `IOException`

  - ### writeReport

    public void writeReport(OutputStream os) throws IOException

    ###### Deprecated

    this method is no longer invoked by the testing framework; please use `OutputStream)`

    Throws:
      `IOException`

  - ### testExecutionFinished

    public void testExecutionFinished(String testSuiteName)
    Callback to indicate the test execution has finished allowing for a report to be generated if appropriate

  - ### testExecutionFinished

    public void testExecutionFinished()

    ###### Deprecated

    this method is no longer invoked by the testing framework; please use `#testExecutionFinished(String)`