Dashboard > GreenPepper Seeds > ... > GreenPepper Intepreters > Action Interpreter
  GreenPepper Seeds Log In View a printable version of the current page.  
  Action Interpreter
Added by Christian Lapointe, last edited by Laurent Cobos on Jun 27, 2007  (view change)
Labels: 

 GreenPepperAnonymous access is denied. You must log in to use GreenPepper.

Action Interpreter

Import
com.greenpepper.interpreter.flow.action

The ActionInterpreter verifies the execution of a sequence of actions. It is intended to be used for specifying programmatic tasks, ones that cannot be clearly expressed using business-level specifications, like batch processing, GUI testing and the like.

Specifying the fixture

The ActionInterpreter follows the general rules for interpreter and fixture selection and fixture naming.

Once an ActionInterpreter starts interpreting a specification document, it carries out the actions in all of the following tables with the selected fixture. Consequently, each subsequent table doesn't need to explicitly declare an interpreter and a fixture.

Begin Info

Each row is interpreted by the ActionInterpreter using the following rules:

  • The first cell specifies which action (multiple words will result in a concatenation using camel casing) to take on the system under test
  • All cells other than the first one are parameters passed to the action specified in the first cell

On execution:

  • The first cell is marked as success if the action returns true
  • The first cell is marked as failure if the action returns false or throws an exception
  • The first cell is marked as error if no matching action is found on the fixture.
End Info

Interpretation flow

As already stated, a business workflow may span several tables. The ActionInterpreter goes through all tables one by one, down to the end of the specification document. For each table, it executes the workflow one row at a time, reading cells from left to right.

rule for interpretation order
tables order of interpretation?
[ action ][ some fixture ]
[ perform ][ action 1 ]
[ perform ][ action 2 ]
[ perform ][ action 3 ]
****
[ perform ][ action 4 ]
****
[ perform ][ action 5 ]
[ perform ][ action 6 ]
action 1, action 2, action 3, action 4, action 5, action 6

Actions

Each row represents an action to perform on the system under test.

The ActionInterpreter expects actions to be composed of keywords and data. The first cell of a row specifies which action to take on the system under test. If that cell contains more than one word, they will be camel cased and concatenated to form the action name. During execution, the interpreter will try to find a method on the current fixture with a name matching this action. All cells other than the first are expected to contain data that will be added to the action (passed as method arguments) during the test execution. No formatting will occur on data cells.

To execute the action on the system under test, the ActionIntepreter follows the rules of action access resolution rules.
Ex: The name of an action can be made of more than one word, but all in the first cell:

rule for row structure
row action name? parameters?
[ Click Button ][ Submit ] clickButton Submit

Ex: An action can receive more than one parameter:

rule for row structure
row action name? parameters?
[ are compatible ][ donor blood type ][ recipient blood type ] areCompatible donor blood type, recipient blood type

Rules for annotations

When an action does not return a boolean value and executes normally, no cell is annotated:

rule for cell annotation
row action returns cells marked right? cells marked wrong? cells marked exception?
[ action name ][ data ] void [] [] []

When an action returns a boolean value, the name of that action are annotated right if the action returns true:

rule for cell annotation
row action returns cells marked right? cells marked wrong? cells marked exception?
[ action name ][ data ] true 1 [] []

If it returns false, the action name is annotated wrong:

rule for cell annotation
row action returns cells marked right? cells marked wrong? cells marked exception?
[ action name ][ data ] false [] 1 []

If it throws an exception, the first keyword only is annotated exception:

rule for cell annotation
row action returns cells marked right? cells marked wrong? cells marked exception?
[ action name ][ data ] error [] [] 1

If the action name does not match a method name on the current fixture, the first keyword only is annotated exception:

rule for cell annotation
row action throws an exception cells marked right? cells marked wrong? cells marked exception?
[ invalid name ][ data ] some exception [] [] 1

DEMONSTRATION LICENSE - This Confluence site is for demonstration purposes only. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.4.3 Build:#705 Mar 21, 2007) - Bug/feature request - Contact Administrators