Stories (aka user stories or scenarios) are told in terms of input messages (or triggers) and expected messages or values... these are part of the requirements and turn into automated tests.
On one beautiful summer eve, a guest arrived, so let's send that message:
send::
msg home.guest_arrived (name="Jane")
Naturally, the lights must have come on and Jane was greeted:
expect:: lights.on
expect:: (lightIntensity is "bright")
Also - make sure the chimes system greeted Jane - this will fail initially, until you have spec'd it out:
expect:: (greeting is "Greetings, Jane")
expect:: chimes.welcome (name is "Jane")
Let's see if John is greeted - he shouldn't be.
send::
msg home.guest_arrived (name="John")
expect:: (greeting not defined)
The implementation of these rules is in a-lights-spec, check it out!
Play with this: change some values, for instance Jane to Jim and see how things look when there are errors. Or comment out the chimes system etc...
You need to log in to post a comment!