我使用
Eclipse IDE:面向Web开发人员的Eclipse Java EE IDE.版本:Indigo Release
我使用JUnit 4.对于项目属性> Java构建路径>库:我添加了JUnit4.同样在同一个标签下:Maven Dependencies>我有junit-4.8.2.jar
在pom.xml中我有:
junit
junit
4.8.2
test
基本上,我在过去几个月里使用JUnit编写单元测试!我需要做的就是创建一个测试类,添加如下测试方法:
@Test
public void testMethod(){
// Some test code
}
右键单击方法,运行方式> JUnit测试
这就是我需要做的就是运行我的单元测试或者进行Debug As> Junit Test调试我的单元测试.
世界上一切都很好!从昨天开始,当我在已经拥有的类中添加新的测试方法然后执行:右键单击方法,运行方式> JUnit测试
什么都没发生!我不能再运行或调试任何测试了!意思是我无法添加任何新的单元测试!
我还要补充一点,我通过Eclipse做了一个干净的构建,Eclipse看到了新编译的类,它包含了我的新测试方法.
由于我的配置都没有改变,我不知道出了什么问题!
有人有什么想法吗?任何帮助将不胜感激.
C:\Project>mvn eclipse:eclipse
[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-jar-pl
ugin/2.3.2/maven-jar-plugin-2.3.2.pom
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-jar-plu
gin/2.3.2/maven-jar-plugin-2.3.2.pom (6 KB at 10.9 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-plugin
s/21/maven-plugins-21.pom
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-plugins
/21/maven-plugins-21.pom (13 KB at 27.8 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-parent/20/mave
n-parent-20.pom
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/maven-parent/20/maven
-parent-20.pom (25 KB at 50.3 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-jar-pl
ugin/2.3.2/maven-jar-plugin-2.3.2.jar
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-jar-plu
gin/2.3.2/maven-jar-plugin-2.3.2.jar (32 KB at 71.4 KB/sec)
[INFO]
[INFO] Building myProject 3.0
[INFO] >>> maven-eclipse-plugin:2.8:eclipse (default-cli) @ myProject >>>
[WARNING] The artifact commons-email:commons-email:jar:1.1 has been relocated to
org.apache.commons:commons-email:jar:1.1
[INFO]
[INFO] --- xmlbeans-maven-plugin:2.3.3:xmlbeans (default) @ myProject ---
[INFO] All schema objects are up to date.
[INFO]
[INFO] <<< maven-eclipse-plugin:2.8:eclipse (default-cli) @ myProject <<<
[INFO]
[INFO] --- maven-eclipse-plugin:2.8:eclipse (default-cli) @ myProject ---
[INFO] Using Eclipse Workspace: null
[INFO] Adding default classpath container: org.eclipse.jdt.launching.JRE_CONTAIN
ER
[WARNING] While downloading commons-email:commons-email:1.1
This artifact has been relocated to org.apache.commons:commons-email:1.1.
Commons Email has been reassigned to the
org.apache.commons group as per the Maven 2 standards.
[INFO] Creating maven-eclipse.xml Ant file to handle resources
[INFO] Creating external launcher file
[INFO] File C:\myProjectProject\.project already exists.
Additional settings will be preserved, run mvn eclipse:clean if you want
old settings to be removed.
[INFO] Wrote Eclipse project for "myProject" to C:\myProjectProject.
[INFO] BUILD SUCCESS
[INFO] Total time: 6.823s
[INFO] Finished at: Tue Mar 13 13:16:52 PDT 2012
[INFO] Final Memory: 9M/152M