We are starting SpecFlow implementation and we are trying to find the best practice regarding a feature which required an awaiting state during the flow.
Should we use one scenario with several When/Then to test the Feature? Or should we use two scenarios with a shared context?
Let's take the following fictive example: A contract creation following a product sale. Steps from the contract management products view:
- (When) An event is received with contract creation details
- (Then) System A create a process for the new contract
- (And) System A asks for the Client information to System B (Awaiting state occurs there)
- (When) System A receives Client information
- (Then) System A packages all contract-related information and publish them to other system
Implementation above is just to give you an idea of our problem.
Should we go with a big sceario like this:
- When An event is received with contract creation details
- Then System A create a process for the new contract
- And System A asks for the Client information to System B
- When System A receives Client information from System B
- Then System A packages all contract-related information and publish them to other system
Or with two distinct scenarios like this:
1 - Acknowledged contract creation
- When An event is received with contract creation details
- Then System A create a process for the new contract
- And System A asks for the Client information to System B
2 - Contract creation publication
- When System A receives Client information from System B
- Then System A packages all contract-related information and publish them to other system
We are not sure what is the best practice to follow in this particular case.
Find best practice for SpecFlow features required awaiting steps and multiple systems interractions
It seems to me the first two parts are setup, the second part the action, and the last part the effect. So:
Or if everything is triggered by the first step, then it would be a single
Whenfollowed by aThenand a fewAndafter that.You may at that point consider using the
*keyword. If specflow supports it.