bdd - Given-When-Then with multiple possible Thens? -


i discovered concept of bdd , i'm trying understand how write user stories right way. suppose need test application against external state may not possible stipulate via given, such instead of single then might have multiple:

given [state] when [some action]   , [some other action] [outcome a]   , [outcome a']   or [outcome b]   , [outcome b'] 

is reasonable story tell in bdd? in case, a , b both reasonable, expected outcomes given state , actions, , acceptable outcomes.

if system has non-deterministic behaviour, appropriate.

however, computer systems have deterministic behaviour, if you're developing software (rather using bdd on, say, human system of interaction), want specify more precisely.

you can mock out or write own stubs context in givens. instance, in tetris game used develop jbehave, replaced random seed used in real game known seed purposes of scenario. able add lines like:

given our current shape "t"
, next shape "s" <-- can know because it's fixed seed

you can similar dates, third-party systems, existing production systems, etc.

i therefore expect have 2 scenarios:

given [state]
and [state leading a]
when [some action]
, [some other action]
[outcome a]
, [outcome a']

and b:

given [state]
and [state leading b]
when [some action]
, [some other action]
[outcome b]
, [outcome b']

conversations around different contexts in system works , how lead different outcomes @ heart of bdd. helps illustrate system's behaviour.

however, if system far out of control can't use deterministically, , if chosen tool supports using "or", automating way fine. still specific possible in conversations, though. there will be context means code outcome b context instead of outcome a; otherwise make outcome outcome, say, "job done".


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -