开发者

what is best practice for integration testing a database driven php?

Greetings;

I am writing my integration tests so I would like to know what is the best practice for integration testing a database driven php site? Should I add and delete data in setup() and teardown() respectively for every test or should my test database just have the test data entered prior to any testing?

I am not asking about what tools to use but rather the app开发者_运维技巧roach. Thanks in advance.


in my point of view the strategy to be used in tests, is a very personal decision of team. Usually in my projects I use BDD (Behavior driven development) to assurance the functionalities of API.

For example (Features of CRUD):

  • I create a new data using the service (banana.create)
  • I list all datas (banana.list) and check if the new data exists in then
  • I list using filter (banana.list?id=xxx) and check if the structure of response is ok
  • I delete the row (banana.delete) and check it using the service of list...

And for specifics components of model I use TDD (Test driven development) using the concepts of mock...

But, the main difficult are in design of application... not in tests :D

[]'s

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜