use of org.junit.runner.JUnitCore in project buck by facebook.
the class JUnitRunner method run.
@Override
public void run() throws Throwable {
Level stdOutLogLevel = Level.INFO;
Level stdErrLogLevel = Level.WARNING;
String unparsedStdOutLogLevel = System.getProperty(STD_OUT_LOG_LEVEL_PROPERTY);
String unparsedStdErrLogLevel = System.getProperty(STD_ERR_LOG_LEVEL_PROPERTY);
if (unparsedStdOutLogLevel != null) {
stdOutLogLevel = Level.parse(unparsedStdOutLogLevel);
}
if (unparsedStdErrLogLevel != null) {
stdErrLogLevel = Level.parse(unparsedStdErrLogLevel);
}
for (String className : testClassNames) {
final Class<?> testClass = Class.forName(className);
List<TestResult> results = new ArrayList<>();
RecordingFilter filter = new RecordingFilter();
if (mightBeATestClass(testClass)) {
JUnitCore jUnitCore = new JUnitCore();
Runner suite = new Computer().getSuite(createRunnerBuilder(), new Class<?>[] { testClass });
Request request = Request.runner(suite);
request = request.filterWith(filter);
jUnitCore.addListener(new TestListener(results, stdOutLogLevel, stdErrLogLevel));
jUnitCore.run(request);
}
// Combine the results with the tests we filtered out
List<TestResult> actualResults = combineResults(results, filter.filteredOut);
writeResult(className, actualResults);
}
}
use of org.junit.runner.JUnitCore in project jna by java-native-access.
the class GDI32UtilTest method main.
public static void main(String[] args) {
JUnitCore jUnitCore = new JUnitCore();
jUnitCore.run(GDI32UtilTest.class);
}
use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class CategoriesAndParameterizedTest method runsTestMethodWithCategory.
@Test
public void runsTestMethodWithCategory() {
Result result = new JUnitCore().run(SuiteWithParameterizedTestWithMethodWithCategory.class);
assertEquals(2, result.getRunCount());
assertEquals(0, result.getFailureCount());
}
use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class DisableOnDebugTest method whenRunWithPreJava5DebugArgumentsTestShouldFail.
@Test
public void whenRunWithPreJava5DebugArgumentsTestShouldFail() {
JUnitCore core = new JUnitCore();
Result result = core.run(PreJava5DebugArgumentsTest.class);
assertEquals("Should run the test", 1, result.getRunCount());
assertEquals("Test should not have failed", 0, result.getFailureCount());
}
use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class DisableOnDebugTest method whenRunWithPostJava5DebugArgumentsTestShouldFail.
@Test
public void whenRunWithPostJava5DebugArgumentsTestShouldFail() {
JUnitCore core = new JUnitCore();
Result result = core.run(PostJava5DebugArgumentsTest.class);
assertEquals("Should run the test", 1, result.getRunCount());
assertEquals("Test should not have failed", 0, result.getFailureCount());
}
Aggregations