自动化集成测试C ++应用程序与数据库 [英] Automated integration testing a C++ app with a database

查看:173
本文介绍了自动化集成测试C ++应用程序与数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我引入自动化集成测试,到现在为止只被人工测试了成熟的应用。

I am introducing automated integration testing to a mature application that until now has only been manually tested.

该应用程序是基于Windows和谈判,以一个MySQL数据库。

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?

如果您需要查询数据库的结果(和它听起来像你可能做的),那么我同意克里斯K,但我会尽力每个测试用例后重建数据库,而不只是每间套房。

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.

这有助于避免危险交互测试

至于工具,我会建议 CppUnit的。你是不是真的做单元测试,但它不应该的问题作为的xUnit框架应该给你设置和拆除框架,你需要自动设置您的测试治具

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.

如果您有兴趣进一步研究,看看的xUnit测试模式的。这是一本好书和良好的网站,这种事情。

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.

和感谢自动化:)

尼克

这篇关于自动化集成测试C ++应用程序与数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆