What is best suited for testing php database integration?

Hello,
I am writing my integration tests, so I would like to know what is best suited for integrating database php site testing testing? Should I add and delete data in settings () and teardown () respectively for each test, or should only test data be entered in the test database before any testing?
I am not asking which tools to use, but rather an approach. Thanks in advance.

+4
source share
1 answer

in my opinion, the strategy that will be used in the tests is a very personal decision of the team. Usually in my projects I use BDD (Behavior driven development) to provide API functionality.

For example (CRUD Features):

  • I create new data using the service (banana.create)
  • I list all the data (banana.list) and check if new data exists in
  • I use a filter (banana.list? Id = xxx) and check if the response structure is normal
  • I delete the line (banana.delete) and check it with the list service ...

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

But the main thing is difficult in the design of the application ... not in tests: D

[] 's

0
source

Source: https://habr.com/ru/post/1346786/


All Articles