简体   繁体   English

Jenkins的Junit Test Hang

[英]Junit Test Hang in Jenkins

we run our junit tests in Eclipse seems fine, but when we move it to hudson or jenkins, the tests seems hangs there never returns. 我们在Eclipse中运行junit测试似乎很好,但是当我们将其移至hudson或jenkins时,这些测试似乎挂在那里,永不返回。 its definitely the same code, I just wandering whats the difference between running tests in Eclipse and Hudson. 它绝对是相同的代码,我只是在Eclipse和Hudson中运行测试之间的区别。

In eclipse you usually just run one test class or one test method. 在Eclipse中,您通常只运行一种测试类或一种测试方法。 A "fresh" Java Virtual machine is started and stopped for this test. 将启动和停止“新” Java虚拟机以进行此测试。

I suppose that Jenkins runs all tests in one Java Virtual machine. 我想Jenkins在一台Java虚拟机中运行所有测试。 This can make a huge difference. 这可以产生巨大的变化。

Try to run all test outside eclipse and outside hudson at once (should be simple if you have a maven project). 尝试同时在eclipse和hudson外部运行所有测试(如果您有Maven项目,这应该很简单)。 What is the result? 结果是什么? Maybe you can configure your test run to fork the Java VM on each test (this is possible with maven by configuring the surefire plugin). 也许您可以配置测试运行以在每个测试中派生Java VM(通过配置surefire插件,这对于maven来说是可能的)。

My guess would be to look at the memory limit. 我的猜测是查看内存限制。 Try to increase the memory limit of the maven process started from Jenkins. 尝试增加从詹金斯开始的Maven进程的内存限制。

My other guess would be to look whether the Maven build from Jenkins is allowed to execute submodules parallel. 我的另一个猜测是看看是否允许Jenkins的Maven构建并行执行子模块。 If yes, it might cause some race conditions that are hard to find. 如果是,这可能会导致某些难以找到的比赛条件。

Are the tests executed in the same way in Eclipse and in Hudson? 在Eclipse和Hudson中是否以相同的方式执行测试? My guess is that the tests are executed one by one (or class by class) in Eclipse, and by a build script such as Maven or Ant in Hudson? 我的猜测是,测试是在Eclipse中一个接一个地执行(或一个类一个接一个地执行),并且是由Hudson中的Maven或Ant这样的构建脚本执行的? What happens if you execute the test suite from a terminal on your local machine? 如果从本地计算机上的终端执行测试套件,会发生什么情况?

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

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