Package org.fest.swing.junit.ant
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
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
informCannotTakeScreenshots
(org.fest.swing.image.ImageException error) 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, tests, writeErrorAndStackTrace, xmlRootNode
-
Field Details
-
screenshotXmlWriter
-
-
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 classXmlJUnitResultFormatter
- Parameters:
suite
- the JUnit test suite.
-
informCannotTakeScreenshots
private void informCannotTakeScreenshots(org.fest.swing.image.ImageException error) -
onFailureOrError
A test failed. This method embeds a screenshot of the desktop if the failing test is a GUI test.- Overrides:
onFailureOrError
in classXmlJUnitResultFormatter
- 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.
-