I'm trying to run JUnit4 test cases on Eclipse 3.4.2 but it's not even starting for me. I have the junit-4.7.jar in my build path and the test application.
Here is a simple example that illustrates my problem
package test;
import org.junit.Before;
import org.junit.Test;
public class UTest {
@Test
public void test() {
}
@Before
public void setUp() throws Exception {
}
}
This compiles fine
Then I do "Run JUnit Test case" from Eclipse and I get an error dialog with this message
"Launching UTest' has encountered a problem
An internal error occurred during: "Launching UTest".
java.lang.NullPointerException
What causes these NullPointerExceptions? What am I doing wrong?
In Eclipse, you create a JUnit test case by selecting in the main window menubar File -> New -> JUnit Test Case. Once you clicked on the item, a big dialog should pop out. In the pop up you can choose the JUnit version (4 is the one we use) and the package and class name of your test case.
JUnit simplifies the Unit testing process in Java with visual indicators and a Unit testing framework. JUnit use in the Eclipse IDE is convenient and quick to configure.
If you right click in Project Explorer and choose New, you see a much shorter menu that doesn't include the Junit option. Needs to be done in Package Explorer view...
ini does no do the trick , best way will be to close any other applications running , after that open Task Manager , and close JAVA services running . Restart the eclipse . NOTE :- This will close the programs using Java if they are open .
What worked for me after trying everything:
It works :)
I was able to fix this just by deleting the workspace and the Eclipse directory and starting over.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With