tygerpatch / Pepper

An acceptance test tool based on JBehave and Cucumber that runs through JUnit.
0 stars 0 forks source link

Object-Oriented Analysis & Design #5

Open tygerpatch opened 11 years ago

tygerpatch commented 11 years ago

interface Step   public void run( )

A Step needs the following in order to run:

// Given, When, Then are Steps class Given implements Step class When implements Step class Then implements Step

// Note: And steps have the same role as the previously executed step. // Therefore, it is not necessary to have a separate And step class.

Should there be a GivenListener (which implements the RunListener interface)? Perhaps make each Step implementation automatically have an appropriate RunListener. That way you don't have to remember to call PepperRunnerListener's setLine method.

// A Scenario is made up of a series of Steps class Scenario   private List<Step> steps   public void addStep(Step step)   public void run( )

// A Scenario Template is a Scenario whose Steps have variable content specified by a Content Table class ScenarioTemplate extends Scenario

class ScenarioTemplate   public void addContentTable(ContentTable table)   public void run( )

class ContentTable   // Key: String - the table's header values (ie. placeholders)   // Value: List<String> - the data in each row for that header   Map <String, List<String>>

  // Given a step has some placeholder in it   // And we have run the Scenario Template x number of times   // When I call ContentTable's getData method   // Then I should be told the value for that placeholder and iteration   public String getData(String placeholder, int row)

// Since a ContentTable doesn't contain step definitions, it doesn't have a run method.

  public void addHeaderRow(String row)   public void addDataRow(String row)

// A Feature has one or more Scenarios class Feature   List<Scenario> scenarios