Skip to content

Instantly share code, notes, and snippets.

@koic
Created April 1, 2010 09:39
Show Gist options
  • Save koic/351603 to your computer and use it in GitHub Desktop.
Save koic/351603 to your computer and use it in GitHub Desktop.
Get test method names from TestCase.
import junit.framework.TestSuite;
import org.junit.runner.Description;
import org.junit.runner.JUnitCore;
import org.junit.runner.notification.RunListener;
public class Main {
public static void main(String[] args) {
JUnitCore core = new JUnitCore();
core.addListener(new RunListener() {
public void testFinished(Description description) throws Exception {
System.out.println(description.getMethodName());
}
});
TestSuite suite = new TestSuite();
suite.addTest(TestCaseClass.class);
core.run(suite);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment