gintool / gin

GI in No Time - a Simple Microframework for Genetic Improvement
MIT License
43 stars 20 forks source link

Only tests with annotations will be run with LocalSearch and their timeout modified #84

Open justynapt opened 2 years ago

justynapt commented 2 years ago

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.

justynapt commented 2 years ago

agreed to update to Junit5, keep timeout via annotations, look into parameterised test issue, do not support custom test classes (not junit)