I am doing a tutorial on execute server test cases by using a driver class. The Eclipse error pane showed error message: java.lang.Exception: No runnable methods. The error message occurred when driver class tried to run exceptionTesting class.
Based pm this post: java.lang.exception no runnable methods junit. It seems like @Test annotation should be used in the test class or updating Junit Jar file to most current version will solve the issue.
Junit Jar file version: 4.11
Please review my code and advise me what modification shall I do to avoid the error message. Thanks!
Driver Class:
import org.junit.runner.*;
import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
basicAnnotation.class,
personTest.class,
exceptionTesting.class
})
public class UnitTestDriver {
}
exceptionTesting class
import org.junit.*;
import org.junit.Test;
public class exceptionTesting
{
public class junitTest2{
@Test (expected = ArithmeticException.class)
public void divisionWithException(){
int i = 1/0;
}
}
}