org.fest.swing.junit.ant
Class ScreenshotOnFailureResultFormatter

java.lang.Object
  extended by org.fest.swing.junit.ant.XmlJUnitResultFormatter
      extended by 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.

Author:
Alex Ruiz

Constructor Summary
ScreenshotOnFailureResultFormatter()
           
 
Method Summary
protected  void onFailureOrError(junit.framework.Test test, Throwable error, XmlNode target)
          A test failed.
protected  void onStartTestSuite(org.apache.tools.ant.taskdefs.optional.junit.JUnitTest suite)
          Execution of the JUnit test suite started.
 
Methods inherited from class org.fest.swing.junit.ant.XmlJUnitResultFormatter
addError, addFailure, addFailure, endTest, endTestSuite, setOutput, setSystemError, setSystemOutput, startTest, startTestSuite, writeErrorAndStackTrace, xmlRootNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScreenshotOnFailureResultFormatter

public ScreenshotOnFailureResultFormatter()
Method Detail

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.

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.


Copyright © 2007-2010 FEST (Fixtures for Easy Software Testing). All Rights Reserved.