DAO 的集成测试是否应该在应用程序服务器中完成?

发布于 2024-09-04 11:04:46 字数 317 浏览 4 评论 0原文

我正在开发一个三层应用程序,正在为持久层中的 DAO 创建集成测试。当应用程序在 Websphere 或 JBoss 中运行时,我希望使用这些应用程序服务器的连接池和事务管理器。当应用程序在 Tomcat 或 Jetty 中运行时,我们将使用 C3P0 进行池化,使用 Atomikos 进行事务处理。

由于这些不同的子系统,DAO 是否应该在完全配置的应用程序服务器环境中进行测试,或者我们应该在集成测试服务层时处理这些问题?目前我们计划建立一个简单的 JDBC 数据源,使用非 JTA(即资源本地)事务进行 DAO 集成测试,因此不涉及应用程序服务器......但这让我想知道我们不会发现的环境问题。

I have a three tier application under development and am creating integration tests for DAOs in the persistence layer. When the application runs in Websphere or JBoss I expect to use the connection pooling and transaction manager of those application servers. When the application runs in Tomcat or Jetty, we'll be using C3P0 for pooling and Atomikos for transactions.

Because of these different subsystems, should the DAO's be tested in a fully configured application server environment or should we handle those concerns when integration testing the service layer? Currently we plan on setting up a simple JDBC data source with non-JTA (i.e. resource-local) transactions for DAO integration testing, thus no application server is involved....but this leaves me wondering about environmental problems we won't uncover.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

听,心雨的声音 2024-09-11 11:04:46

除了使用单元测试测试每个模块之外,集成测试还应该测试模块组。

我不想迂腐,但理论上这是黑盒的系统测试通过 QA 进行测试。

对于较小的项目,这可能不可行

Besides testing each module using unittests, the integration test should test groups of modules.

I don't want to be pedantic but in therorie this is folowed by system test for black box testing by QA.

For smaller projects this may not be feasible

初懵 2024-09-11 11:04:46

我认为你的这种思路是正确的。如果可能,您应该设置一个运行生产环境的持续集成服务器(例如Hudson)。这样,您就可以使用 Tomcat 等以相当高的信心进行开发,针对本地设置运行测试,并且当您签入代码时,请确保针对实际情况运行相同的测试。

I think you're on the right track with this line of thinking. If possible you should set up a continuous integration server (e.g. Hudson) that runs your production environment. That way you can develop with pretty high confidence using Tomcat etc., running tests against your local setup, and when you check in your code be sure that those same tests are being run against the real deal.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文