|
||||||||||
| 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,
com.google.inject.Injector injector)
|
|
BaseStepListener(File outputDirectory,
Pages pages)
Create a step listener using the driver from a given page factory. |
|
BaseStepListener(File outputDirectory,
WebdriverManager webdriverManager)
|
|
| Method Summary | |
|---|---|
void |
addIssuesToCurrentStory(List<String> issues)
|
void |
addTagsToCurrentStory(List<TestTag> tags)
|
void |
assumptionViolated(String message)
|
boolean |
aStepHasFailed()
Should return true if a step failure has been logged. |
void |
exampleFinished()
An example has finished. |
void |
exampleStarted(Map<String,String> data)
A new example has just started. |
protected SystemClock |
getClock()
|
protected TestOutcome |
getCurrentTestOutcome()
|
org.openqa.selenium.WebDriver |
getDriver()
The currently-used WebDriver instance for these tests. |
StepEventBus |
getEventBus()
|
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()
|
protected ScreenshotPermission |
screenshots()
|
void |
setDriver(org.openqa.selenium.WebDriver driver)
Used to update the webdriver driver for screenshots if a listener is reused between scenarios. |
void |
setEventBus(StepEventBus eventBus)
|
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 |
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 |
takeScreenshot()
Take a screenshot now. |
void |
testFailed(TestOutcome testOutcome,
Throwable cause)
The test failed, but not while executing a step. |
void |
testFinished(TestOutcome outcome)
A test has finished. |
void |
testIgnored()
The test as a whole was skipped or ignored. |
void |
testRetried()
The last test run is about to be restarted |
void |
testStarted(String testMethod)
An individual test starts. |
void |
testSuiteFinished()
End of a test case or story. |
boolean |
testSuiteRunning()
|
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. |
void |
updateCurrentStepTitle(String updatedStepTitle)
|
void |
useExamplesFrom(DataTable table)
The current scenario is a data-driven scenario using test data from the specified table. |
| 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(File outputDirectory,
com.google.inject.Injector injector)
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,
WebdriverManager webdriverManager)
public BaseStepListener(File outputDirectory,
Pages pages)
outputDirectory - reports and screenshots are generated herepages - a pages factory.| Method Detail |
|---|
public void setEventBus(StepEventBus eventBus)
public StepEventBus getEventBus()
protected ScreenshotPermission screenshots()
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 boolean testSuiteRunning()
public void addIssuesToCurrentStory(List<String> issues)
public void addTagsToCurrentStory(List<TestTag> tags)
public 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 updateCurrentStepTitle(String updatedStepTitle)
public void testFinished(TestOutcome outcome)
testFinished in interface StepListeneroutcome - the result of the test that just finished.public void testRetried()
StepListener
testRetried in interface StepListenerpublic 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 stepPending()
StepListener
stepPending in interface StepListenerpublic void stepPending(String message)
StepListener
stepPending in interface StepListenerpublic void assumptionViolated(String message)
assumptionViolated 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 StepListenerpublic void takeScreenshot()
public void useExamplesFrom(DataTable table)
useExamplesFrom in interface StepListenerpublic void exampleStarted(Map<String,String> data)
StepListener
exampleStarted in interface StepListenerpublic void exampleFinished()
StepListener
exampleFinished in interface StepListener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||