Hi Liz,

 


this is a pretty interesting point. When Tony and I did the game of live
with JBehave we run across a similar problem. Our outcomes tended to boil
down to "cell is alive" or "cell is dead". We solved this, as you're
suggesting in your post, by adding the cell in question to the world. So the
entry at "cell" always pointed to the cell in question.  It's of course a
bit like a mock, in that it makes you outcome related stuff to the givens. 

 

BTW: Shouldn't the world be a typed object rather than a map or could the
contents of the world be rendered in the output?

 

Hope this Helps,

 

Felix

 

  _____  

From: Elizabeth Keogh [mailto:[EMAIL PROTECTED] 
Sent: 28 November 2006 14:24
To: [email protected]
Subject: [jbehave-dev] Scenario components and ambiguity: a dilemma

 

Hi all,

I've run into a little problem with one of my stories; text below.

The outcome "the glyph segments should become junk" appears in two stories,
but in one of them another glyph has already been dropped - so the Junk will
differ between them. Implementation (for the first scenario only) also
below.

I'd welcome suggestions as to how to resolve this. My current idea is to add
a context to the World, so that we can find out which Scenario we're running
in and act accordingly.

What do you think?

Liz.

PS: I hope you don't mind that I'm continuing with the game development.
When I stop finding new things that I need to have in the framework, I'll
stop writing games; until then I assume that anything find that I need is
something that our users might need too.

--

Story: the player drops the glyph

As a game player
I want to drop the glyph
So that  I can save time

Scenario: the player drops the glyph into an empty pit

Given the first glyph is displayed on the board
When the player presses the drop key
Then the glyph should fall to the bottom
When time passes
Then the glyph segments should become junk
and the next glyph should appear

Scenario: the player drops the glyph onto junk

Given the player drops the glyph into an empty pit
When the player presses the drop key
Then the glyph should fall onto the junk
and the glyph segments should become junk
and the next glyph should appear

--

public class TheGlyphSegmentsShouldBecomeJunk extends HellboundOutcome {

    private Segments expectedSegments;
    private Color expectedColor;

    public void setExpectationIn(World world) {
        
        expectedSegments = new Segments(
                new Segment(2, 11),
                new Segment(3, 11),
                new Segment(4, 11),
                new Segment(3, 12)
        );
        expectedColor = Hellbound.COLORMAP.getColorFor(GlyphType.JUNK);
    }

    public void verifyAnyTimeIn(World world) {
        RenderedPit pit = getPit(world);
        Ensure.that(pit, contains(expectedSegments, expectedColor));
    }

}

--

Elizabeth Keogh
[EMAIL PROTECTED]
http://www.livejournal.com/users/sirenian

--------------------------------------------------------------------- To
unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email 

Reply via email to