astra.unit.TestRunner Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of astra-unittest Show documentation
Show all versions of astra-unittest Show documentation
Unit Testing framework for ASTRA
package astra.unit;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import org.reflections.Reflections;
import astra.core.ASTRAClass;
public class TestRunner {
public static void main(String[] args) throws InstantiationException, IllegalAccessException {
List tests = new LinkedList();
Reflections reflections = new Reflections("");
Set> javaClasses = reflections.getSubTypesOf(ASTRAClass.class);
for (Class extends ASTRAClass> javaClass : javaClasses) {
ASTRAClass astraClass = javaClass.newInstance();
for (Class parent : astraClass.getParents()) {
if (parent.getCanonicalName().equals("astra.unit.ASTRAUnitTest")) {
tests.add(javaClass.getCanonicalName());
}
}
}
TestSuite suite = new TestSuite(tests.toArray(new String[tests.size()]));
suite.execute();
TestSuite.displayResults(suite);
}
}