简体   繁体   English

使用JUnit自动化测试

[英]Automation of testing using JUnit

i am trying to automate manual testing of modules in my project. 我正在尝试自动对项目中的模块进行手动测试。 We are dealing with IBM Websphere Message queue software. 我们正在处理IBM Websphere消息队列软件。 We have a trigger component written in core java which when executed polls for availability of message in the configured queue. 我们有一个用核心Java编写的触发器组件,该组件在执行时会轮询已配置队列中消息的可用性。 Its an indefinite while loop that keeps the trigger component running. 它是一个不确定的while循环,可保持触发器组件运行。 I have written test cases in JUnit to put message in the queue and now will i be able to start/stop the trigger component on demand? 我已经在JUnit中编写了测试用例,以将消息放入队列中,现在我是否能够按需启动/停止触发器组件? Invoking the trigger component keeps it running and i am not getting the control back to check the expected output. 调用触发器组件可使它保持运行状态,而我没有将控件放回去检查预期的输出。 If i start it in thread then the log files to which the trigger component is supposed to update when processing the message is not getting updated. 如果我在线程中启动它,那么在处理消息时触发组件应该更新到的日志文件就不会更新。 How can i resolve this situation. 我该如何解决这种情况。 Your suggestion and directions is highly appreciated. 非常感谢您的建议和指导。 Thanks, -Vijay 谢谢,-Vijay

I would look at moving your manual build to a scripted build using something like Apache Ant and using the junit support, see http://ant.apache.org/manual/Tasks/junit.html . 我将看一下使用Apache Ant之类的东西并使用junit支持将您的手动构建迁移到脚本构建,请参见http://ant.apache.org/manual/Tasks/junit.html

Once you have your tests which you can run via Ant, you can integrate into a continuous integration container like Hudson (hudson-ci.org) and get it to schedule a build run on a timer. 一旦有了可以通过Ant运行的测试,就可以集成到诸如Hudson(hudson-ci.org)之类的连续集成容器中,并使其安排在计时器上运行的构建。 You can also schedule to run on a code check-in. 您还可以计划在代码签入中运行。

For more on continuous integration take a look at Martin Fowler's article, http://martinfowler.com/articles/continuousIntegration.html . 有关连续集成的更多信息,请参阅 Martin Fowler的文章http://martinfowler.com/articles/continuousIntegration.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM