use of org.junit.runner.JUnitCore in project randomizedtesting by randomizedtesting.
the class TestJUnit3MethodProvider method testJUnit3Overrides.
@Test
public void testJUnit3Overrides() throws Exception {
Result r = new JUnitCore().run(new RandomizedRunner(S3.class));
Assert.assertEquals(0, r.getFailureCount());
Assert.assertEquals(1, r.getRunCount());
}
use of org.junit.runner.JUnitCore in project robovm by robovm.
the class RoboVMAllTests method main.
public static void main(String[] args) throws Exception {
System.out.println("JUnit version " + Version.id());
JUnitCore core = new JUnitCore();
core.addListener(new TextListener(System.out) {
@Override
public void testStarted(Description description) {
System.out.print(description + " ... ");
}
@Override
public void testFinished(Description description) {
System.out.println();
}
@Override
public void testFailure(Failure failure) {
System.out.print("FAILED!");
}
@Override
public void testIgnored(Description description) {
System.out.println("IGNORED!");
}
});
core.run(suite(Pattern.compile(args.length > 0 ? args[0] : ".*"), Pattern.compile(args.length > 1 ? args[1] : " "), false));
}
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 mockito by mockito.
the class MockInjectionUsingConstructorTest method constructor_is_called_for_each_test_in_test_class.
@Test
public void constructor_is_called_for_each_test_in_test_class() throws Exception {
// given
junit_test_with_3_tests_methods.constructor_instantiation = 0;
JUnitCore jUnitCore = new JUnitCore();
jUnitCore.addListener(new TextListener(System.out));
// when
jUnitCore.run(junit_test_with_3_tests_methods.class);
// then
assertThat(junit_test_with_3_tests_methods.constructor_instantiation).isEqualTo(3);
}
use of org.junit.runner.JUnitCore in project mockito by mockito.
the class VerificationCollectorImplTest method should_invoke_collector_rule_after_test.
@Test
public void should_invoke_collector_rule_after_test() {
JUnitCore runner = new JUnitCore();
Result result = runner.run(VerificationCollectorRuleInner.class);
assertThat(result.getFailureCount()).isEqualTo(1);
assertThat(result.getFailures().get(0).getMessage()).contains("1. Wanted but not invoked:");
}
Aggregations