Created
February 22, 2013 14:52
-
-
Save dave-shawley/5013968 to your computer and use it in GitHub Desktop.
Little helper function that runs a bunch of named tests back-to-back calling setUp() and tearDown() methods. Very useful for spot checking unit test coverage in Eclipse but not nearly general purpose.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void runTestsNamed(String... testNames) throws Exception { | |
for (int i=0; i<testNames.length; ++i) { | |
Method testCase = this.getClass().getMethod(testNames[i]); | |
testCase.invoke(this); | |
if ((i + 1) < testNames.length) { | |
tearDown(); | |
setUp(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment