Mocking vs. Test DB?

前端 未结 8 2087
无人及你
无人及你 2020-12-29 20:44

Earlier I asked this question How to correctly unit test my DAL?, one thing left unanswered for me is if to really test my DAL is to have a Test DB, then what is the role of

8条回答
  •  梦毁少年i
    2020-12-29 21:39

    It's not only the state of the DB you must consider, it's also availability. If your DB is offline why should all of your DAL tests fail?

    What you need to test is that your DAL issues the correct commands in order to create / retrieve / update / delete. You don't need to execute SQL for this, you can just use an object persistence framework and check that you give it the correct instructions.

提交回复
热议问题