Class ScreenshotOnFailureResultFormatter

java.lang.Object
org.fest.swing.junit.ant.XmlJUnitResultFormatter
org.fest.swing.junit.ant.ScreenshotOnFailureResultFormatter
All Implemented Interfaces:
junit.framework.TestListener, org.apache.tools.ant.taskdefs.optional.junit.JUnitResultFormatter, org.apache.tools.ant.taskdefs.optional.junit.JUnitTaskMirror.JUnitResultFormatterMirror

public final class ScreenshotOnFailureResultFormatter extends XmlJUnitResultFormatter
Understands a JUnit XML report formatter that takes a screenshot when a GUI test fails.

Note: A test is consider a GUI test if it is marked with the annotation GUITest.

  • Field Details

  • Constructor Details

    • ScreenshotOnFailureResultFormatter

      public ScreenshotOnFailureResultFormatter()
  • Method Details

    • onStartTestSuite

      protected void onStartTestSuite(org.apache.tools.ant.taskdefs.optional.junit.JUnitTest suite)
      Execution of the JUnit test suite started. Internally, this method creates the writer responsible for embedding a screenshot of the desktop in the XML report.
      Overrides:
      onStartTestSuite in class XmlJUnitResultFormatter
      Parameters:
      suite - the JUnit test suite.
    • informCannotTakeScreenshots

      private void informCannotTakeScreenshots(org.fest.swing.image.ImageException error)
    • onFailureOrError

      protected void onFailureOrError(junit.framework.Test test, Throwable error, XmlNode target)
      A test failed. This method embeds a screenshot of the desktop if the failing test is a GUI test.
      Overrides:
      onFailureOrError in class XmlJUnitResultFormatter
      Parameters:
      test - the failing test.
      error - the cause of the failure or error.
      target - the element in the XML report containing information about the failure.