Hi folks.

So I spent the last couple of days with joejoejoe, and as usual he's managed to simplicate* jbehave.

I want to make a couple of major changes to the Story infrastructure, which will have a large "span" (ie. will touch a whole bunch of classes). This means you'll have to leave me to it for a bit - otherwise we'll be in merge hell.

So please check in what you currently have and I'll get cracking. This should be in before 0.9.

Details below.

Cheers,
Dan

* Simplicate: to find a simple way of doing a complicated thing.


Briefly:

A Scenario will be wired together in an assemble() method rather than in the constructor.

There are no limits on the ordering of givens, events or outcomes in a scenario. Each of them is simply a ScenarioComponent (thanks Liz for already creating this abstraction), and the scenario will simply be a sequence of Steps (slightly changing the semantic of Step).

Executing the Scenario then simply becomes a case of iterating over the Steps (be they Givens, Events or Outcomes) and performing them, then iterating backwards and undoing them.

There will be three methods, given(Given), when(Event), then(Outcome), with possibly some syntactic sugar so you can have given(Given, Given, ...) or something.

Rationale:

1. There is already an explosion of constructor signatures for Scenario. This will only get worse.

2. Wiring things together in a constructor, means you can't use any instance methods. There are a bunch of static methods already appearing in ScenarioUsingMiniMock. These should be instance methods (and should go away).

3. We already have two patterns for scenarios, namely Given-When-Then, and Given-{When-Then}-{When-Then}.... There are no doubt many more, such as when you want to verify something on the way through an acceptance test that isn't the outcome itself:

Given I navigate to the login screen
And I enter username "dan"
And I enter password "secret"
And I click submit button
Then I should be on the "Welcome" page [just a sanity check]
When I request my account balance
Then the value of the "balance" field should be $100 [the actual test]

4. The scenario code becomes a lot more readable. We played around with it until almost all the syntax went away. It's arguably more readable than the rbehave version.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to