模拟JMS - jUnit [英] Simulating JMS - jUnit
问题描述
我需要在通过maven / hudson执行自动化测试时模拟JMS行为。我正在考虑使用一些模拟框架,即Mockito来实现这个目标,但也许有一些更简单的工具可以完成这项任务?我已经阅读了一些关于ActiveMQ的内容,但从我发现它需要在使用它之前安装代理。在我的情况下,重要的是让一切都由maven运行,因为我没有任何权限在构建服务器上安装任何东西。
I need to simulate JMS behavior while performing automated tests via maven/hudson. I was thinking about using some mock framework i.e. Mockito to achieve that goal but maybe there is some easier tool which can accomplish this task? I have read a little bit about ActiveMQ but from what I have found out it requires to install broker prior using it. In my case it is important to have everything run by maven only because I don't have any privileges to install anything on the build server.
推荐答案
您可以在嵌入模式下运行ActiveMQ - 代理在您的应用程序中启动,并且队列是动态创建的。你只需要添加 activemq.jar
并运行几行代码。
You can run ActiveMQ in embedded mode - the broker starts within your application and queues are created on the fly. You just need to add activemq.jar
and run few lines of code.
另一方面,有一个 Mockrunner 库,它支持JMS - 虽然它主要是为单元测试设计的,而不是集成。
On the other hand there is a Mockrunner library that has support for JMS - although it was designed mainly for unit tests, not integration.
这篇关于模拟JMS - jUnit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!