Is it bad practice to run tests on a database instead of on fake repositories?

前端 未结 11 1357
傲寒
傲寒 2020-12-10 04:01

I know what the advantages are and I use fake data when I am working with more complex systems.

What if I am developing something simple and I can easily set up my e

11条回答
  •  长情又很酷
    2020-12-10 04:36

    The downsides to running tests against your database is lack of speed and the complexity for setting up your database state before running tests.

    If you have control over this there is no problem in running the tests directly against the database; it's actually a good approach because it simulates your final product better than running against fake data. The key is to have a pragmatic approach and see best practice as guidelines and not rules.

提交回复
热议问题