This might be a sort of stupid question, but still trying to find my understanding on BDD Specflow . In my experience across Specflow - seen different companies using Specflow to capture scenarios/test across-
So say for example my feature below for System Integration test coverage-
Given An active account exists
When I fill up a form & submit a new investment (submitted but not approved)
Then Check the record inserted into a specific table
And new transaction displayed in Holdings report
And new transaction not displayed in cash balance report (as not yet approved)
In some companies they practice to break it down further-Component
Separate out above scenario to 2 features like below -
One validating till inserted to database
Given An active account exists
When I fill up a form & submit a new investment (submitted but not approved)
Then Check the record inserted into a specific table
The other Checking the reports
Given A new Investment is recorded
When we run the reports
Then new transaction displayed in Holdings report
And new transaction not displayed in cash balance report (as not yet approved)
Which of the above is right way of writing Specflow features? Whats best practice?
IMO, the better way as per BDD guidelines is second option that you wrote above. Because you are somewhat covering a different behavior in second scenario. Anytime scenario called for two when-then statements it is better to have separate scenarios. Check out here , this exactly addresses your point. You can even check tenses and see if they are correct in your scenarios above.