use of org.junit.runner.Runner in project reddeer by eclipse.
the class RedDeerSuiteTest method testSingleTestWithoutConfiguration.
@Test
public void testSingleTestWithoutConfiguration() throws InitializationError {
System.setProperty(RedDeerProperties.CONFIG_FILE.getName(), REDDEER_SUITE_CONFIG);
SuiteConfiguration config = new SuiteConfiguration(SimpleTestClass.class);
List<Runner> runners = RedDeerSuite.createSuites(SimpleTestClass.class, config);
assertThat(runners.size(), is(1));
assertThat(runners, hasItem(new NamedSuiteMatcher("no-configuration")));
}
use of org.junit.runner.Runner in project reddeer by eclipse.
the class RedDeerSuiteTest method getTestCount.
private int getTestCount(@SuppressWarnings("rawtypes") Class suiteClass) throws Throwable {
SuiteConfiguration config = new SuiteConfiguration(suiteClass);
List<Runner> runners = RedDeerSuite.createSuites(suiteClass, config);
short testCount = 0;
for (Runner runner : runners) {
if (!(runner instanceof TestsWithoutExecutionSuite)) {
testCount += runner.getDescription().testCount();
}
}
return testCount;
}
use of org.junit.runner.Runner in project maven-surefire by apache.
the class JUnit4RunListenerTest method testTestStarted.
public void testTestStarted() {
RunListener jUnit4TestSetReporter = new JUnit4RunListener(new MockReporter());
Runner junitTestRunner = Request.classes("abc", STest1.class, STest2.class).getRunner();
RunNotifier runNotifier = new RunNotifier();
runNotifier.addListener(jUnit4TestSetReporter);
junitTestRunner.run(runNotifier);
}
use of org.junit.runner.Runner in project maven-surefire by apache.
the class JUnit4Provider method execute.
private static void execute(Class<?> testClass, Notifier notifier, Filter filter) {
final int classModifiers = testClass.getModifiers();
if (!isAbstract(classModifiers) && !isInterface(classModifiers)) {
Request request = aClass(testClass);
if (filter != null) {
request = request.filterWith(filter);
}
Runner runner = request.getRunner();
if (countTestsInRunner(runner.getDescription()) != 0) {
runner.run(notifier);
}
}
}
use of org.junit.runner.Runner in project vividus by vividus-framework.
the class AbstractTestRunner method main.
@SuppressWarnings("NoMainMethodInAbstractClass")
public static void main(String[] args) throws InitializationError {
Runner runner = new JUnit4(runnerClass);
Result result = new JUnitCore().run(runner);
int exitCode;
if (result.getFailureCount() > 0) {
Logger logger = LoggerFactory.getLogger(runnerClass);
result.getFailures().forEach(f -> {
logger.error("Failure: {}", f);
logger.atError().addArgument(f::getTrace).log("{}");
});
exitCode = ERROR_EXIT_CODE;
} else {
exitCode = calculateExitCode(BeanFactory.getBean(IRunStatusProvider.class).getRunStatus());
}
System.exit(exitCode);
}
Aggregations