Hi,
I'm trying to upgrade Eclipse from
JUnit 3.8.1 to JUnit 4.8.1. Since I couldn't do it through Help > Software Updates, I downloaded the junit-4.8.1.jar file from the junit.org site, copied the file to the Eclipse plugins directory and updated the JUNIT_HOME classpath variable accordingly:
C:/bea92/workshop92/eclipse/plugins/junit-4.8.1.jar
After these changes I was able to run an JUnit 3.8 version of a simple junit
test. However, running an JUnit 4 version of a similar test using annotations did NOT work. When I run it, I get an error shown at the bottom of this posting.
The junit class is very simple and could be run from anyone's PC:
package com.bofa.news.upstream;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
public class SimpleTest {
List<
String> msgTasks = null;
@Before
protected void setUp() throws Exception {
msgTasks = new ArrayList<String>();
}
@Test
public void testGetAllUpdates() {
msgTasks.add(new String("Str1"));
msgTasks.add(new String("Str2"));
assertEquals("must be size 2", msgTasks.size(), 2);
}
}
Here's the error trace:
junit.framework.AssertionFailedError: No tests found in com.bofa.news.upstream.SimpleTest
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.TestSuite$1.runTest(TestSuite.java:97)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Please note that the tests are executed from within Eclipse version 3.1.2 which is part of the BEA Workshop version 9.2.0.0.
Any help will be greatly appreciated.
- Erik