|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectnet.thucydides.core.steps.BaseStepListener
public class BaseStepListener
Observes the test run and stores test run details for later reporting. Observations are recorded in an TestOutcome object. This includes recording the names and results of each test, and taking and storing screenshots at strategic points during the tests.
| Nested Class Summary | |
|---|---|
protected static class |
BaseStepListener.ScreenshotType
|
| Constructor Summary | |
|---|---|
BaseStepListener(Class<? extends org.openqa.selenium.WebDriver> driverClass,
File outputDirectory)
Create a step listener with a given web driver type. |
|
BaseStepListener(Class<? extends org.openqa.selenium.WebDriver> driverClass,
File outputDirectory,
Configuration configuration)
|
|
BaseStepListener(File outputDirectory)
|
|
BaseStepListener(File outputDirectory,
Configuration configuration)
|
|
BaseStepListener(File outputDirectory,
Pages pages)
Create a step listener using the driver from a given page factory. |
|
| Method Summary | |
|---|---|
boolean |
aStepHasFailed()
Should return true if a step failure has been logged. |
protected SystemClock |
getClock()
|
protected TestOutcome |
getCurrentTestOutcome()
|
org.openqa.selenium.WebDriver |
getDriver()
The currently-used WebDriver instance for these tests. |
Photographer |
getPhotographer()
|
protected WebdriverProxyFactory |
getProxyFactory()
|
Throwable |
getTestFailureCause()
If a test failed, what was the error. |
List<TestOutcome> |
getTestOutcomes()
A step listener should be able to return a set of test results at the end of the test run. |
void |
lastStepFailed(StepFailure failure)
Declare that a step has failed after it has finished. |
void |
notifyScreenChange()
|
void |
setDriver(org.openqa.selenium.WebDriver driver)
Used to update the webdriver driver for screenshots if a listener is reused between scenarios. |
void |
skippedStepStarted(ExecutedStepDescription description)
Called when a test step is about to be started, but this step is scheduled to be skipped. |
void |
stepFailed(StepFailure failure)
Called when a test step fails. |
void |
stepFinished()
Called when an test step has finished successfully |
void |
stepIgnored()
Called when a step will not be run, generally because a test method is annotated with Ignore. |
void |
stepIgnored(String message)
The step is marked as ignored with a descriptive message. |
void |
stepPending()
The step is marked as pending. |
void |
stepPending(String message)
The step is marked as pending with a descriptive message. |
void |
stepStarted(ExecutedStepDescription description)
A step within a test is called. |
void |
testFailed(TestOutcome testOutcome,
Throwable cause)
The test failed, but not while executing a step. |
void |
testFinished(TestOutcome result)
A test has finished. |
void |
testIgnored()
The test as a whole was skipped or ignored. |
void |
testStarted(String testMethod)
An individual test starts. |
void |
testSuiteFinished()
End of a test case or story. |
void |
testSuiteStarted(Class<?> startedTestSuite)
A test suite (containing a series of tests) starts. |
void |
testSuiteStarted(Story story)
Start a test run using a specific story, without a corresponding Java class. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BaseStepListener(File outputDirectory)
public BaseStepListener(Class<? extends org.openqa.selenium.WebDriver> driverClass,
File outputDirectory)
driverClass - a driver of this type will be usedoutputDirectory - reports and screenshots are generated here
public BaseStepListener(Class<? extends org.openqa.selenium.WebDriver> driverClass,
File outputDirectory,
Configuration configuration)
public BaseStepListener(File outputDirectory,
Configuration configuration)
public BaseStepListener(File outputDirectory,
Pages pages)
outputDirectory - reports and screenshots are generated herepages - a pages factory.| Method Detail |
|---|
protected WebdriverProxyFactory getProxyFactory()
protected TestOutcome getCurrentTestOutcome()
protected SystemClock getClock()
public void testSuiteStarted(Class<?> startedTestSuite)
testSuiteStarted in interface StepListenerstartedTestSuite - the class implementing the test suite (e.g. a JUnit test case)public void testSuiteStarted(Story story)
StepListener
testSuiteStarted in interface StepListenerpublic void testSuiteFinished()
StepListener
testSuiteFinished in interface StepListenerpublic void testStarted(String testMethod)
testStarted in interface StepListenertestMethod - the name of the test method in the test suite class.public void testFinished(TestOutcome result)
testFinished in interface StepListenerresult - the result of the test that just finished.public void stepStarted(ExecutedStepDescription description)
stepStarted in interface StepListenerdescription - the description of the test that is about to be runpublic void skippedStepStarted(ExecutedStepDescription description)
StepListener
skippedStepStarted in interface StepListenerdescription - the description of the test that is about to be run
(generally a class and method name)public void stepFinished()
StepListener
stepFinished in interface StepListenerpublic void stepFailed(StepFailure failure)
StepListener
stepFailed in interface StepListenerfailure - describes the test that failed and the exception that was thrownpublic void lastStepFailed(StepFailure failure)
StepListener
lastStepFailed in interface StepListenerpublic void stepIgnored()
StepListenerIgnore.
stepIgnored in interface StepListenerpublic void stepIgnored(String message)
StepListener
stepIgnored in interface StepListenerpublic void stepPending()
StepListener
stepPending in interface StepListenerpublic void stepPending(String message)
StepListener
stepPending in interface StepListenerpublic Photographer getPhotographer()
public List<TestOutcome> getTestOutcomes()
StepPublisher
getTestOutcomes in interface StepPublisherpublic void setDriver(org.openqa.selenium.WebDriver driver)
StepPublisher
setDriver in interface StepPublisherpublic org.openqa.selenium.WebDriver getDriver()
StepPublisher
getDriver in interface StepPublisherpublic boolean aStepHasFailed()
StepPublisher
aStepHasFailed in interface StepPublisherpublic Throwable getTestFailureCause()
StepPublisher
getTestFailureCause in interface StepPublisher
public void testFailed(TestOutcome testOutcome,
Throwable cause)
StepListener
testFailed in interface StepListenertestOutcome - The test outcome structure for the failing testcause - The exception that triggered the failurepublic void testIgnored()
StepListener
testIgnored in interface StepListenerpublic void notifyScreenChange()
notifyScreenChange in interface StepListener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||