模拟对象与测试数据库 [英] Mock Objects vs Test Database
本文介绍了模拟对象与测试数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
与具有已知数据的静态测试数据库相比,使用模拟对象有什么优势,并且在对数据库进行测试时使用事务确保没有任何变化.
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 the database.
推荐答案
您可以两者都做.使用模拟对象测试您的BLL逻辑,然后使用测试数据库测试您的DAL逻辑.这样一来,如果出现故障,您可以轻松查看问题出在哪里,而导致测试失败.
You can do both. Use mock objects to test you BLL logic and then use a test database to test your DAL logic. That way if something breaks you can easily see where the problem lies by which test fails.
这篇关于模拟对象与测试数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文