c# - How can I know required data for later steps in SpecFlow? -


my problem following:

some of scenarios need save state of model after loaded compare later. serializing objects , compare them later in test. not want serialize state in every test - have negative impact on performance of tests. how can know if data necessary?

i thought of using tags, information should hidden feature file. not want forced write @saveinitialstate on every test need it.

edit

here 1 sample test needs information

given have loaded model when action , undo last action loaded model unchanged 

serialization here chosen way because model has no possibility cloned , not want introduce new production code tests. serialization can done in tests only.

you might trying wrong kind of testing here or @ least use wrong tool kind of testing.

specflow tool designed in commonly known bdd more accurately called specification example. basic idea of provide concrete examples of interesting cases test functionality of application.

these examples need explicit. saying then loaded model unchanged implicit. instead use case like.

given editing bob's details when change bob's age 42 , undo changes bob should aged 24 

please note, using trick here of using pre-defined example. idea developers , bas on team knows bob 24 yrs old , works on helpdesk. have defined known example upfront can avoid saying

given create new person , person should called bob , person should aged 24 , person should work on desk 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -