当我的构建路径中有junit-4.3.1.jar时,为什么Eclipse使用JUnit 3? [英] Why is Eclipse using JUnit 3 when I have junit-4.3.1.jar in my build path?
问题描述
我在Ubuntu Linux上使用Ganymede,并且我的构建路径中有junit-4.3.1.jar.创建新测试时,单击文件>新建> Java>"JUnit 4测试用例",但是当它运行时,Eclipse似乎正在使用JUnit3.我相信是这种情况,因为它忽略了我的注释.
I'm using Ganymede on Ubuntu Linux and I have junit-4.3.1.jar in my build path. I click File > New > Java > "JUnit 4 Test Case" when I create a new test, but when it's run, Eclipse appears to be using JUnit 3. I believe this is the case because it's ignoring my annotations.
当我删除所有test *方法时,JUnit会抱怨未找到测试".如果对已经创建的另一个测试执行相同的操作,则JUnit可以正常运行并找到名为createTask()的测试.因此,它似乎有时使用JUnit 3,而其他时候使用JUnit 4.
When I remove all test* methods, JUnit complains "No tests found". If I do the same with another test I already created, JUnit runs fine and finds my test named createTask(). So, it appears to be using JUnit 3 at times, and JUnit 4 at others.
如何强制Eclipse Ganymede使用JUnit 4?
How do I force Eclipse Ganymede to use JUnit 4?
推荐答案
我通过这找到了答案链接:
在扩展AbstractTransactionalSpringDataSourceTest(或任何它)时,Spring显然与JUnit 4.3.1不兼容.因此,我升级到JUnit 4.6(b/c 4.5有问题),并使用了基于注释的配置,瞧,一切都很好.
Spring is apparently incompatible with JUnit 4.3.1 when extending AbstractTransactionalSpringDataSourceTest (or whatever it is). So, I upgraded to JUnit 4.6 (b/c 4.5 has issues) and used the annotation-based configuration, and voila, all is well.
谢谢.
这篇关于当我的构建路径中有junit-4.3.1.jar时,为什么Eclipse使用JUnit 3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!