简体   繁体   English

无法在Eclipse Indigo中运行JUnit

[英]Can't run JUnit in Eclipse Indigo

I create simple Java Application project with src and test folders. 我用srctest文件夹创建一个简单的Java Application项目。 src folder consists of the class which I test and test folder consists of the class where I describe test. src文件夹包含我测试的类,而test文件夹包含我描述测试的类。 When I start testing, using JUnit 4 I get: Could not find the main class: org.eclipse.jdt.internal.junit.runner.RemoteTestRunner. 当我开始测试时,使用JUnit 4,我得到: 找不到主类:org.eclipse.jdt.internal.junit.runner.RemoteTestRunner。 Program will exit. 程序将会退出。 error. 错误。 All JAR files are presented in my project. 所有JAR文件都显示在我的项目中。

What did I miss in my project? 我在项目中错过了什么?

That is a class that is part of the Eclipse plugin, it sounds like you have a corrupted installation of Eclipse. 该类是Eclipse插件的一部分,听起来好像您的Eclipse安装已损坏。 Try with a fresh installation. 尝试全新安装。

远景:在项目的“构建路径”设置中,包含test.java文件的测试文件夹是否也被声明为源文件夹?

All JUnit tests should be written as follows: 所有JUnit测试应编写如下:

@Test    //This is very very important

public void testAbc()
{
//Test Abc() here....
}

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

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