tags:

views:

68

answers:

1

Hi guys,

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,

Alex

+1  A: 

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.
Cellfish