net.thucydides.core.steps
Class StepEventBus

Package class diagram package StepEventBus
java.lang.Object
  extended by net.thucydides.core.steps.StepEventBus

public class StepEventBus
extends Object

An event bus for Step-related notifications. Use this to integrate Thucydides listeners with testing tools. You create a listener (e.g. an instance of BaseStepListener, or your own), register it using 'registerListener', and then implement the various methods (testStarted(), stepStarted()). Thucydides will call these events on your listener as they occur. You can register a new Thucydides listener by implementing the StepListener interface and placing your class in the classpath. Thucydides will automatically detect the listener and add it to the registered listeners. It will load custom listeners automatically when a test starts for the first time.


Constructor Summary
StepEventBus(ScreenshotProcessor screenshotProcessor)
           
 
Method Summary
 boolean areStepsRunning()
           
 boolean aStepInTheCurrentTestHasFailed()
           
 void clear()
           
 boolean currentTestIsPending()
           
 void dropAllListeners()
           
 void dropListener(StepListener stepListener)
           
protected  List<StepListener> getAllListeners()
           
static StepEventBus getEventBus()
          The event bus used to inform listening classes about when tests and test steps start and finish.
 boolean isCurrentTestDataDriven()
           
 void lastStepFailed(StepFailure failure)
           
 void notifyScreenChange()
           
 void reenableWebdriverCalls()
           
 StepEventBus registerListener(StepListener listener)
          Register a listener to receive notification at different points during a test's execution.
 void skippedStepStarted(ExecutedStepDescription executedStepDescription)
          Record a step that is not scheduled to be executed (e.g.
 void stepFailed(StepFailure failure)
           
 void stepFinished()
           
 void stepIgnored()
           
 void stepPending()
           
 void stepPending(String message)
           
 void stepStarted(ExecutedStepDescription executedStepDescription)
          Start the execution of a test step.
 void temporarilySuspendWebdriverCalls()
           
 void testFailed(Throwable cause)
          The test failed, but not during the execution of a step.
 void testFinished()
           
 void testFinished(TestOutcome result)
           
 void testIgnored()
           
 void testPending()
          Mark the current test method as pending.
 void testStarted(String testName)
           
 void testStarted(String newTestName, Class<?> testClass)
           
 void testStarted(String newTestName, Story story)
           
 void testSuiteFinished()
           
 void testSuiteStarted(Class<?> testClass)
           
 void testSuiteStarted(Story story)
           
 boolean webdriverCallsAreSuspended()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StepEventBus

@Inject
public StepEventBus(ScreenshotProcessor screenshotProcessor)
Method Detail

getEventBus

public static StepEventBus getEventBus()
The event bus used to inform listening classes about when tests and test steps start and finish. There is a separate event bus for each thread.


registerListener

public StepEventBus registerListener(StepListener listener)
Register a listener to receive notification at different points during a test's execution. If you are writing your own listener, you shouldn't need to call this method - just set up your listener implementation as a service (see http://download.oracle.com/javase/6/docs/api/java/util/ServiceLoader.html), place the listener class on the classpath and it will be detected automatically.


testStarted

public void testStarted(String testName)

testStarted

public void testStarted(String newTestName,
                        Story story)

testStarted

public void testStarted(String newTestName,
                        Class<?> testClass)

getAllListeners

protected List<StepListener> getAllListeners()

testSuiteStarted

public void testSuiteStarted(Class<?> testClass)

testSuiteStarted

public void testSuiteStarted(Story story)

clear

public void clear()

testFinished

public void testFinished()

testFinished

public void testFinished(TestOutcome result)

aStepInTheCurrentTestHasFailed

public boolean aStepInTheCurrentTestHasFailed()

isCurrentTestDataDriven

public boolean isCurrentTestDataDriven()

stepStarted

public void stepStarted(ExecutedStepDescription executedStepDescription)
Start the execution of a test step.


skippedStepStarted

public void skippedStepStarted(ExecutedStepDescription executedStepDescription)
Record a step that is not scheduled to be executed (e.g. a skipped or ignored step).


stepFinished

public void stepFinished()

stepFailed

public void stepFailed(StepFailure failure)

lastStepFailed

public void lastStepFailed(StepFailure failure)

stepIgnored

public void stepIgnored()

stepPending

public void stepPending()

stepPending

public void stepPending(String message)

dropListener

public void dropListener(StepListener stepListener)

dropAllListeners

public void dropAllListeners()

webdriverCallsAreSuspended

public boolean webdriverCallsAreSuspended()

reenableWebdriverCalls

public void reenableWebdriverCalls()

temporarilySuspendWebdriverCalls

public void temporarilySuspendWebdriverCalls()

testFailed

public void testFailed(Throwable cause)
The test failed, but not during the execution of a step.

Parameters:
cause - the underlying cause of the failure.

testPending

public void testPending()
Mark the current test method as pending. The test will stil be executed to record the steps, but any webdriver calls will be skipped.


currentTestIsPending

public boolean currentTestIsPending()

testIgnored

public void testIgnored()

areStepsRunning

public boolean areStepsRunning()

notifyScreenChange

public void notifyScreenChange()

testSuiteFinished

public void testSuiteFinished()


Copyright © 2011-2012 Wakaleo Consulting. All Rights Reserved.