开发者

BDD Top-Down Approach

I'm new in BDD world and I've been in some difficult trying to get the best from top-down approach, strongly recommended by many people. Considering this what would you recommend as a good start point to specify controller's behaviors? I mean, what need to be tested in a CRUD controller scenario for example?

Regards,

开发者_如何学Go

Alex


Does this make sense (you need to replace X and Y with something)?

  • Given no X in the database when controller creates X then X should be in the database.
  • Given no X in the database when controller creates X and database failes then X should not be in the database.
  • Given X in the database when controller creates Y with same keys as X then X should be in the database and Y should not be in the database.
  • Given X in the database when controller reads X then X should be available in the controller.
  • Given no X in the database when controller reads X then controller should report an error.
  • Given X in the database when X.a is changed by the controller then X.a should be updated in the database.
  • Given X in the database when X.a is changed by the controller to an invalid value then X.a should not be updated in the database and controller should report an error. Given X in the database when controller deletes X then X should no longer exists in database. Given no X in the database when controller deletes X then X should no longer exists in database and controller should not report an error.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜