Preparing data for a SpecFlow scenario [closed]

别等时光非礼了梦想. 提交于 2019-12-08 04:26:12

问题


I'm going to test a complex scenario which expects several other steps to have performed prior to it.

For example , it can be equivalent to have proper data in a warehouse before goods are taken our from it. So in order for fetching to happen, it must first be made sure that there are products in the warehouse and there is a fetch-order. There may be seperate screens to insert products to the warehouse. So before I start testing the fetch scenarios i have to be ready with those.

What would be the best method to be ready with this data? I basically could think of two options.

  1. Go through the actual screens to prepare the data.

  2. Have a DB snapshot with prepared data to perform the wanted scenario.

I'm not sure which way I should move forward and would like to hear similar experiences from the people who have tried something like this.


回答1:


I would go with option 2 - you are testing some use case and you should not involve use cases tested by another tests. Test consists of some code driving the test and data used to perform the test. So if you need special data for the test you should have them prepared upfront instead of creating them by application logic.




回答2:


The other thing you could do is have a framework that inserts that data into the database. This way it can be reused in other scenarios and would be quicker than restoring a database every scenario



来源:https://stackoverflow.com/questions/6662235/preparing-data-for-a-specflow-scenario

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!