use of org.junit.runner.Runner in project junit5 by junit-team.
the class TestClassRequestResolver method determineRunnerTestDescriptor.
private RunnerTestDescriptor determineRunnerTestDescriptor(Class<?> testClass, Runner runner, List<RunnerTestDescriptorAwareFilter> filters, UniqueId engineId) {
RunnerTestDescriptor runnerTestDescriptor = createCompleteRunnerTestDescriptor(testClass, runner, engineId);
if (!filters.isEmpty()) {
if (runner instanceof Filterable) {
Filter filter = createOrFilter(filters, runnerTestDescriptor);
Runner filteredRunner = runnerTestDescriptor.toRequest().filterWith(filter).getRunner();
runnerTestDescriptor = createCompleteRunnerTestDescriptor(testClass, filteredRunner, engineId);
} else {
Runner runnerToReport = (runner instanceof RunnerDecorator) ? ((RunnerDecorator) runner).getDecoratedRunner() : runner;
logger.warn(() -> //
"Runner " + runnerToReport.getClass().getName() + " (used on " + testClass.getName() + //
") does not support filtering" + " and will therefore be run completely.");
}
}
return runnerTestDescriptor;
}
use of org.junit.runner.Runner in project pinpoint by naver.
the class ForkedPinpointPluginTest method runTests.
private static Result runTests(Class<?> testClass, String testId) throws InitializationError {
JUnitCore junit = new JUnitCore();
junit.addListener(new PrintListener());
Runner runner = new ForkedPinpointPluginTestRunner(testClass, testId);
Result result = junit.run(runner);
return result;
}
use of org.junit.runner.Runner in project pinpoint by naver.
the class PinpointPluginTestSuite method filter.
@Override
public void filter(Filter filter) throws NoTestsRemainException {
synchronized (childrenLock) {
List<Runner> children = new ArrayList<>(getFilteredChildren());
for (Iterator<Runner> iter = children.iterator(); iter.hasNext(); ) {
Runner each = iter.next();
if (shouldRun(filter, each)) {
try {
filter.apply(each);
} catch (NoTestsRemainException e) {
iter.remove();
}
} else {
iter.remove();
}
}
filteredChildren = Collections.unmodifiableCollection(children);
if (filteredChildren.isEmpty()) {
throw new NoTestsRemainException();
}
}
}
use of org.junit.runner.Runner in project ceylon by eclipse.
the class CeylonModuleRunner method makeModuleRunnerInNewJvm.
private void makeModuleRunnerInNewJvm(final ModuleSpecifier module) {
final Description description = Description.createTestDescription(getClass(), "Run " + module.module() + " in new JVM");
Runner runner = new Runner() {
@Override
public Description getDescription() {
return description;
}
@Override
public void run(RunNotifier notifier) {
notifier.fireTestStarted(description);
try {
String moduleName = module.module();
String version = Module.DEFAULT_MODULE_NAME.equals(moduleName) ? null : module.version();
String runClass = module.runClass();
if (runClass.isEmpty())
runClass = moduleName + ".run_";
runModuleInNewJvm(moduleName, version, runClass);
} catch (Exception x) {
x.printStackTrace();
notifier.fireTestFailure(new Failure(description, x));
}
notifier.fireTestFinished(description);
}
};
children.put(runner, description);
}
use of org.junit.runner.Runner in project ceylon by eclipse.
the class CeylonModuleRunner method postCompile.
private void postCompile(Context context, ErrorCollector listener, String moduleName, File srcDir, String[] dependencies, Set<String> removeAtRuntime, String[] modulesUsingCheckFunction, String[] modulesUsingCheckModule) throws Exception {
// now fetch stuff from the context
PhasedUnits phasedUnits = LanguageCompiler.getPhasedUnitsInstance(context);
List<Runner> moduleRunners = new LinkedList<Runner>();
// Get a class loader for the car
// XXX Need to use CMR if the module has dependencies
URL[] carUrls = getCarUrls(moduleName, dependencies, removeAtRuntime, outRepo);
URLClassLoader cl = classLoaderForModule(carUrls);
Runnable moduleInitialiser = getModuleInitialiser(moduleName, carUrls, dependencies, removeAtRuntime, cl);
if (cl != null) {
loadCompiledTests(moduleRunners, srcDir, cl, phasedUnits, moduleName, modulesUsingCheckFunction, modulesUsingCheckModule);
}
CeylonTestGroup ceylonTestGroup = new CeylonTestGroup(moduleRunners, moduleName, moduleInitialiser);
children.put(ceylonTestGroup, ceylonTestGroup.getDescription());
}
Aggregations