views:

633

answers:

4

Hello

I'm trying to run JUnit4 test cases on Eclipse 3.4.2 but it's not even starting for me. I am sure that I properly have 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

I'm not sure how to figure out what exactly generating this NullPointerException. Some pointers would be appreciated

A: 

Your code works fine for me.

Eclipse Version: 3.4.1 Build id: M20080911-1700

I right click on the .java file RunAs JUnit Test

OpenSource
A: 

Have you looked in the Eclipse error log? You can see it by opening the "Error Log" view.

http://help.eclipse.org/help32/topic/org.eclipse.pde.doc.user/guide/tools/views/error%5Flog.htm

Stephen C
Couldn't find that view. Problems view is unrelated, this is an eclipse INTERNAL error, problems view just shows errors in the project.
Hugo
I said the Errors view ... not the Problems view.
Stephen C
Sorry, you're right. I don't have an Errors view though :/
Hugo
A: 

I was able to fix this just by deleting the workspace and the Eclipse directory and starting over.

I love computers

Mike
Did you re-import the project, or re-build in by manually dragging files? Sound like a lot of work that just avoids the problems, doesn't solve it.
Hugo
+1  A: 

Thanks that solved my problem too. The problem started when i removed an old simulator, and created a new one. Fix: Like the OP says remove the workspace, make sure to keep the projects inside it :) then import them back to eclipse "Sound like a lot of work" ? Took me less than half a minute !!!

aryaxt