tags:

views:

76

answers:

3

my java test do not compile, I run it and have : no junit tests could not find main class (specified in run-configuration)

A: 

Can you write your code? How you are trying to run the test? In which enviroment? Junit and JDK versions?

And every other information that will be helpful :P

Thomas Sofras
public class Test1 { @BeforeClass public static void setupOnce() { final Thread thread = new Thread() { public void run() { Main.main(new String[]{"-rtebase", "C:\\my appli", "-windows"}); } }; try { thread.start(); } catch (Exception ex) { } }
from eclipse3.5 , click on run test as junit (version 4)it says no main class as specify class that I have put when I I configured project from (run->run configuration->main class in the java application
A: 

You don't have any @Test methods in your class.

JUnit4 looks for methods annotated with @Test - if it doesn't find any in a class, it omits that class completely.

Péter Török
A: 

I agree with Peter

@Test 
    public void testSomeBehavior() { 
        assertEquals("Empty list should have 0 elements", 0, emptyList.size()); 
    } 

Thomas Sofras
my code is correct it worked yesterday I have not make any modification in code