使用 Scala 规范对 Spring 应用程序进行单元测试

发布于 2024-10-10 09:49:34 字数 217 浏览 0 评论 0原文

我们拥有高度依赖 Spring 框架的大型基础设施。最近我开始用 Scala 编写代码并使用 Specs 进行测试。这一切都很棒,但在某些时候我需要使用依赖于 Spring 的功能(例如基于 HibernateDaoSupport 的 DAO)。

有人设法使用 SpringJUnit4ClassRunner 类来运行 Specs 测试吗?对于如何实现这一目标,有人有不同的方向吗?

谢谢

We have a large infrastructure that's highly dependent on Spring Framework. Recently I began writing code in Scala and test it using Specs. This is all great but at some point I need to use Spring-dependent features (Such as a HibernateDaoSupport-based DAO).

Has anyone managed to use the SpringJUnit4ClassRunner class to run Specs tests? Does anyone have a different direction as to how to achieve this goal?

Thanks

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

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

发布评论

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

评论(1

完美的未来在梦里 2024-10-17 09:49:34

我曾在类似尴尬的场景中与班级跑步者斗争过一次,然后我创建了一个 MethodRule 实现我认为名为 TemporarySpringContext 也可以解决您的问题。

I've struggled with the class runner in a similarly awkward scenario once and then I created a MethodRule implementation called TemporarySpringContext that could also solve your problem I think.

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