This is due to implmentation of JUnitBridge.annotateTestWithTimeout and TestRunner.testsForClass methods which assume each individual Junit test is annotated. This is to avoid running setup/cleanup as a test, I think. Temporary workaround is to get all declared methods and only run those that start with "test" in its name, i.e:
add the following at line 84 in TestRunner (and import java.lang.reflect.Method;):
if (methods.size()==0) { for (Method eachTestMethod : clazz.getDeclaredMethods()) { if (eachTestMethod.getName().startsWith("test")) { String methodName = eachTestMethod.getName(); UnitTest test = new UnitTest(testClassName, methodName); tests.add(test); } } }
Need a cleaner solution.
This is due to implmentation of JUnitBridge.annotateTestWithTimeout and TestRunner.testsForClass methods which assume each individual Junit test is annotated. This is to avoid running setup/cleanup as a test, I think. Temporary workaround is to get all declared methods and only run those that start with "test" in its name, i.e: add the following at line 84 in TestRunner (and
import java.lang.reflect.Method;
):if (methods.size()==0) { for (Method eachTestMethod : clazz.getDeclaredMethods()) { if (eachTestMethod.getName().startsWith("test")) { String methodName = eachTestMethod.getName(); UnitTest test = new UnitTest(testClassName, methodName); tests.add(test); } } }
Need a cleaner solution.