I have a bunch of test classes which I want to execute by running the jar file,for that purpose I am using Classpathsuite. It runs fine in the IDE,and all tests in the package are executed. but when I try to run it by jar file, I get this output. Command : java -jar projectname.jar
Time: 0.002
OK (0 tests)
Here's the code for the main class:
@RunWith(ClasspathSuite.class)
public class MySuite {
public static void main(String[] args){
JUnitCore junit = new JUnitCore();
junit.addListener(new TextListener(printStreamObj));
junit.run(MySuite.class);
}
}
I have checked the jar file, and it does contain the testclasses (all of them are placed in main) so it is not an access issue. Why aren't the test classes executed?