specflow - BDD how to isolate a test that depends on data -
i'd honest, new this.
say have following scenario:
scenario: user grid displays information users given application have @ least 1 user when go user grid page should see list of user data in user grid
how ensure keep test isolated scenario while know application contains no user data @ start of test?
i can see following options far:
- add create user scenario before firing scenario. (this breaks isolation.)
- have code check on
have @ least 1 user
, , inserts if doesn't. (never seen done on internet yet, normal or practice?)
i think test abstract. try being little more concrete. if use:
given add user called bob when view users grid page should see bob in user list
then think more obvious need use option 2. might consider
given add user called bob , add user called bill ....
or if prefer
given add accounts team ...
don't forget specflow bindings methods behind scenes can
[given ("i add accounts team")] public void giveniaddanaccountsteam() { giveniaddausercalled("bob"); giveniaddausercalled("bill"); }
don't forget bdd giving examples. examples should have need describe need test scenario, don't make weak. find makes easier write scenarios, if make objects known instances, such bob, isn't admin has permissions see accounts data. way when discussing scenarios knows how bob should appear on user list.
Comments
Post a Comment