|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.fest.swing.testng.listener.AbstractTestListener
org.fest.swing.testng.listener.ScreenshotOnFailureListener
public class ScreenshotOnFailureListener
Understands a TestNG listener 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
To use this listener, we just need to make TestNG aware of it. The following is an example using Ant:
<testng listeners="org.fest.swing.testng.listener.ScreenshotOnFailureListener" outputDir="${target.test.results.dir}" haltOnFailure="true" verbose="2">
<classfileset dir="${target.test.classes.dir}" includes="**/*Test.class" />
<classpath location="${target.test.classes.dir}" />
<classpath location="${target.classes.dir}" />
<classpath refid="test.classpath" />
</testng>
You can find more information here.
| Constructor Summary | |
|---|---|
ScreenshotOnFailureListener()
Creates a new . |
|
| Method Summary | |
|---|---|
void |
onStart(ITestContext context)
Gets the output directory from the given context after the test class is instantiated and before any configuration method is called. |
void |
onTestFailure(ITestResult result)
When a test fails, this method takes a screenshot of the desktop and adds an hyperlink to the screenshot it in the HTML test report. |
| Methods inherited from class org.fest.swing.testng.listener.AbstractTestListener |
|---|
onFinish, onTestFailedButWithinSuccessPercentage, onTestSkipped, onTestStart, onTestSuccess |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ScreenshotOnFailureListener()
ScreenshotOnFailureListener.
| Method Detail |
|---|
public void onStart(ITestContext context)
onStart in interface ITestListeneronStart in class AbstractTestListenercontext - the given method context.public void onTestFailure(ITestResult result)
onTestFailure in interface ITestListeneronTestFailure in class AbstractTestListenerresult - contains information about the failing test.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||