use of org.junit.runner.Runner in project junit4 by junit-team.
the class SuiteTest method suiteTestCountIsCorrect.
@Test
public void suiteTestCountIsCorrect() throws Exception {
Runner runner = Request.aClass(All.class).getRunner();
assertEquals(2, runner.testCount());
}
use of org.junit.runner.Runner in project junit4 by junit-team.
the class SingleMethodTest method filteringAffectsPlan.
@Test
public void filteringAffectsPlan() throws Exception {
Runner runner = Request.method(OneTimeSetup.class, "one").getRunner();
assertEquals(1, runner.testCount());
}
use of org.junit.runner.Runner in project ceylon-compiler by ceylon.
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-compiler by ceylon.
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());
}
use of org.junit.runner.Runner in project ceylon-compiler by ceylon.
the class CeylonModuleRunner method createFailingTest.
void createFailingTest(List<Runner> moduleRunners, final String testName, final Exception ex) {
final Description description = Description.createTestDescription(getClass(), testName);
Runner runner = new Runner() {
@Override
public Description getDescription() {
return description;
}
@Override
public void run(RunNotifier notifier) {
notifier.fireTestStarted(description);
notifier.fireTestFailure(new Failure(description, ex));
notifier.fireTestFinished(description);
}
};
moduleRunners.add(runner);
}
Aggregations