Mock Objects vs Test Database

后端 未结 6 1903
庸人自扰
庸人自扰 2021-02-19 20:42

What\'s the advantage of using mock objects in comparison to a static test database that has known data and using transactions to make sure nothing changes when testing against

6条回答
  •  长发绾君心
    2021-02-19 21:00

    If you can ensure that the static test db doesn't change during testing then I think static test db is better than mock objects. But, then it depends on what you want to test and the complexity of the code being tested. I would go with mock objects as they are simpler to maintain compared with a db.

提交回复
热议问题