自动化集成测试C ++应用程序与数据库 [英] Automated integration testing a C++ app with a database
问题描述
我要对一个成熟的应用程序引入自动化集成测试,直到现在才进行手动测试。
该应用程序是基于Windows的,并与MySQL数据库通信。 / p>
最好的方法是什么(包括推荐的工具的详细信息),以便在发生的数据库事务方面保持测试彼此独立?
如何验证结果?
如果你需要查询数据库(听起来你可能会这么做)的结果,那么我同意Kris K,除非我会努力重建数据库后每
这有助于避免危险交互测试
对于工具,我建议 CppUnit 。你不是真的做单元测试,但它不重要,因为xUnit框架应该给你设置和拆卸框架,你需要自动设置你的测试夹具
很明显,这可能会导致运行缓慢的测试,具体取决于您的数据库
如果您有兴趣进一步研究,请查看 XUnit测试模式。
感谢自动化:)
这是一本好书,尼克
I am introducing automated integration testing to a mature application that until now has only been manually tested.
The app is Windows based and talks to a MySQL database.
What is the best way (including details of any tools recommended) to keep tests independent of each other in terms of the database transactions that will occur?
(Modifications to the app source for this particular purpose are not an option.)
How are you verifying the results?
If you need to query the DB (and it sounds like you probably do) for results then I agree with Kris K, except I would endeavor to rebuild the DB after every test case, not just every suite.
This helps avoid dangerous interacting tests
As for tools, I would recommend CppUnit. You aren't really doing unit tests, but it shouldn't matter as the xUnit framework should give you the set up and teardown framework you'll need to automatically set up your test fixture
Obviously this can result in slow-running tests, depending on your database size, population etc. You may be able to attach/detach databases rather than dropping/rebuilding.
If you're interested in further research, check out XUnit Test Patterns. It's a fine book and a good website for this kind of thing.
And thanks for automating :)
Nick
这篇关于自动化集成测试C ++应用程序与数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!