org.specrunner.listeners.core
Class ScenarioFrameListener

java.lang.Object
  extended by org.specrunner.listeners.core.ScenarioFrameListener
All Implemented Interfaces:
INodeListener, ISpecRunnerListener

public abstract class ScenarioFrameListener
extends Object
implements INodeListener

Monitor for scenarios frames.

Author:
Thiago Santos.

Field Summary
static String ATT_EXECUTE
          Expected style for scenario execute priority.
protected  int checkpoint
          A checkpoint where in the general result the scenario starts.
static String CSS_SCENARIO
          Expected style for scenarios.
static String CSS_SCENARIO_FAILURE
          Expected style for failure scenarios.
static String CSS_SCENARIO_IGNORED
          Expected style for pending scenarios.
static String CSS_SCENARIO_PENDING
          Expected style for pending scenarios.
static String CSS_SCENARIO_SUCCESS
          Expected style for success scenarios.
static String CSS_TITLE
          Expected style for scenario titles.
static String FEATURE_EXECUTE_ENABLED
          Feature to accept execute for scenarios.
static String FEATURE_SHOW_TIME
          Feature to show time for scenarios.
protected  INodeHolder holder
          An auxiliary node holder.
protected  boolean ignored
          Indicate if scenario is ignored.
protected  IScenarioListener[] listeners
          Scenario listeners.
protected  String name
          The listener name.
protected  ENext next
          Result of onBefore(...)
protected  boolean pending
          Indicate if scenario is pending.
protected  nu.xom.Node scenario
          The node which holds the scenario.
protected  long startTime
          Time scenario has started.
protected  IResultSet subset
          The subset of general result for this scenario.
protected  nu.xom.Node title
          The node which holds the title.
 
Constructor Summary
ScenarioFrameListener(String name, Boolean execute, IScenarioListener... listeners)
          Creates a names scenario listener.
 
Method Summary
protected  void fireAfter(String title, nu.xom.Node node, IContext context, IResultSet result, Object instance)
          Fire listeners after scenarios.
protected  void fireBefore(String title, nu.xom.Node node, IContext context, IResultSet result, Object instance)
          Fire listeners before scenarios.
abstract  Object getInstance()
          The fixture instance.
 String getName()
          The listener name.
 IResultSet getResult()
          Get the result subset specific to this scenario.
 boolean isIgnored()
          Answer if the scenario is ignored.
 boolean isPending()
          Answer if the scenario is pending.
 void onAfter(nu.xom.Node node, IContext context, IResultSet result)
          Perform some action after plugin execution for a given node.
 ENext onBefore(nu.xom.Node node, IContext context, IResultSet result)
          Perform some action before building plugin for a given node.
 void reset()
          Reset listener state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FEATURE_SHOW_TIME

public static final String FEATURE_SHOW_TIME
Feature to show time for scenarios.


FEATURE_EXECUTE_ENABLED

public static final String FEATURE_EXECUTE_ENABLED
Feature to accept execute for scenarios.


CSS_SCENARIO

public static final String CSS_SCENARIO
Expected style for scenarios.

See Also:
Constant Field Values

CSS_SCENARIO_SUCCESS

public static final String CSS_SCENARIO_SUCCESS
Expected style for success scenarios.

See Also:
Constant Field Values

CSS_SCENARIO_FAILURE

public static final String CSS_SCENARIO_FAILURE
Expected style for failure scenarios.

See Also:
Constant Field Values

CSS_SCENARIO_PENDING

public static final String CSS_SCENARIO_PENDING
Expected style for pending scenarios.

See Also:
Constant Field Values

CSS_SCENARIO_IGNORED

public static final String CSS_SCENARIO_IGNORED
Expected style for pending scenarios.

See Also:
Constant Field Values

CSS_TITLE

public static final String CSS_TITLE
Expected style for scenario titles.

See Also:
Constant Field Values

ATT_EXECUTE

public static final String ATT_EXECUTE
Expected style for scenario execute priority.

See Also:
Constant Field Values

name

protected String name
The listener name.


listeners

protected IScenarioListener[] listeners
Scenario listeners.


holder

protected INodeHolder holder
An auxiliary node holder.


next

protected ENext next
Result of onBefore(...).


scenario

protected nu.xom.Node scenario
The node which holds the scenario.


title

protected nu.xom.Node title
The node which holds the title.


startTime

protected long startTime
Time scenario has started.


checkpoint

protected int checkpoint
A checkpoint where in the general result the scenario starts.


pending

protected boolean pending
Indicate if scenario is pending.


ignored

protected boolean ignored
Indicate if scenario is ignored.


subset

protected IResultSet subset
The subset of general result for this scenario.

Constructor Detail

ScenarioFrameListener

public ScenarioFrameListener(String name,
                             Boolean execute,
                             IScenarioListener... listeners)
Creates a names scenario listener. The scenario name must be the same of the corresponding scenario it is expected to monitor.

Parameters:
name - The scenario.
execute - Check if execute is enabled.
listeners - List of scenario listeners.
Method Detail

getInstance

public abstract Object getInstance()
The fixture instance.

Returns:
The fixture object, if it exists, null, otherwise.

reset

public void reset()
Description copied from interface: ISpecRunnerListener
Reset listener state.

Specified by:
reset in interface ISpecRunnerListener

getName

public String getName()
Description copied from interface: ISpecRunnerListener
The listener name. Used to distinguish between different listeners.

Specified by:
getName in interface ISpecRunnerListener
Returns:
The listener name.

onBefore

public ENext onBefore(nu.xom.Node node,
                      IContext context,
                      IResultSet result)
Description copied from interface: INodeListener
Perform some action before building plugin for a given node.

Specified by:
onBefore in interface INodeListener
Parameters:
node - The node.
context - The context.
result - The result.
Returns:
The next step on execution. If return is ENext.DEEP, the execution should go deeper.

fireBefore

protected void fireBefore(String title,
                          nu.xom.Node node,
                          IContext context,
                          IResultSet result,
                          Object instance)
                   throws SpecRunnerException
Fire listeners before scenarios.

Parameters:
title - The scenario title.
node - The scenario node.
context - The test context.
result - The result set.
instance - The fixture object, if it exists, null, otherwise.
Throws:
SpecRunnerException - On event errors.

onAfter

public void onAfter(nu.xom.Node node,
                    IContext context,
                    IResultSet result)
Description copied from interface: INodeListener
Perform some action after plugin execution for a given node.

Specified by:
onAfter in interface INodeListener
Parameters:
node - The node.
context - The context.
result - The result.

fireAfter

protected void fireAfter(String title,
                         nu.xom.Node node,
                         IContext context,
                         IResultSet result,
                         Object instance)
                  throws SpecRunnerException
Fire listeners after scenarios.

Parameters:
title - The scenario title.
node - The scenario node.
context - The test context.
result - The result set.
instance - The fixture object, if it exists, null, otherwise.
Throws:
SpecRunnerException - On event errors.

isPending

public boolean isPending()
Answer if the scenario is pending.

Returns:
true, if pending, false, otherwise.

isIgnored

public boolean isIgnored()
Answer if the scenario is ignored.

Returns:
true, if ignored, false, otherwise.

getResult

public IResultSet getResult()
Get the result subset specific to this scenario.

Returns:
The result subset.


Copyright © 2015. All rights reserved.