使用 Scala 规范对 Spring 应用程序进行单元测试
我们拥有高度依赖 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我曾在类似尴尬的场景中与班级跑步者斗争过一次,然后我创建了一个 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.