use of org.junit.runners.model.InitializationError in project cucumber-jvm by cucumber.
the class ExamplesRunner method buildRunners.
private static List<Runner> buildRunners(Runtime runtime, CucumberExamples cucumberExamples, JUnitReporter jUnitReporter) {
List<Runner> runners = new ArrayList<Runner>();
List<CucumberScenario> exampleScenarios = cucumberExamples.createExampleScenarios();
for (CucumberScenario scenario : exampleScenarios) {
try {
ExecutionUnitRunner exampleScenarioRunner = new ExecutionUnitRunner(runtime, scenario, jUnitReporter);
runners.add(exampleScenarioRunner);
} catch (InitializationError initializationError) {
initializationError.printStackTrace();
}
}
return runners;
}
use of org.junit.runners.model.InitializationError in project cucumber-jvm by cucumber.
the class FeatureRunner method buildFeatureElementRunners.
private void buildFeatureElementRunners() {
for (CucumberTagStatement cucumberTagStatement : cucumberFeature.getFeatureElements()) {
try {
ParentRunner featureElementRunner;
if (cucumberTagStatement instanceof CucumberScenario) {
featureElementRunner = new ExecutionUnitRunner(runtime, (CucumberScenario) cucumberTagStatement, jUnitReporter);
} else {
featureElementRunner = new ScenarioOutlineRunner(runtime, (CucumberScenarioOutline) cucumberTagStatement, jUnitReporter);
}
children.add(featureElementRunner);
} catch (InitializationError e) {
throw new CucumberException("Failed to create scenario runner", e);
}
}
}
use of org.junit.runners.model.InitializationError in project Main by SpartanRefactoring.
the class MetaTester method runChild.
@Override
@SuppressWarnings("unused")
protected void runChild(final FrameworkMethod __, final RunNotifier n) {
if (hasRan)
return;
final Class<?> newTestClass = new ASTTestClassGenerator(testClass).generate(testClass.getSimpleName() + "_Meta", sourceFile);
final TestSuite suite = new TestSuite(newTestClass);
suite.run(new TestResult());
try {
new BlockJUnit4ClassRunnerWithParametersFactory().createRunnerForTestWithParameters(new TestWithParameters(" ", new TestClass(newTestClass), an.empty.list())).run(n);
} catch (final InitializationError ignore) {
/**/
}
// Uncomment this to run the original test as well
/* super.runChild(method, notifier); */
hasRan = true;
}
use of org.junit.runners.model.InitializationError in project android by JetBrains.
the class GuiTestSuiteRunner method getGuiTestClasses.
@NotNull
private static Class<?>[] getGuiTestClasses(@NotNull Class<?> suiteClass) throws InitializationError {
List<File> guiTestClassFiles = Lists.newArrayList();
File parentDir = getParentDir(suiteClass);
String packagePath = suiteClass.getPackage().getName().replace('.', File.separatorChar);
int packagePathIndex = parentDir.getPath().indexOf(packagePath);
assertThat(packagePathIndex).isGreaterThan(-1);
String testDirPath = parentDir.getPath().substring(0, packagePathIndex);
findPotentialGuiTestClassFiles(parentDir, guiTestClassFiles);
List<Class<?>> guiTestClasses = Lists.newArrayList();
ClassLoader classLoader = suiteClass.getClassLoader();
for (File classFile : guiTestClassFiles) {
String path = classFile.getPath();
String className = path.substring(testDirPath.length(), path.indexOf(DOT_CLASS)).replace(File.separatorChar, '.');
try {
Class<?> testClass = classLoader.loadClass(className);
if (isGuiTest(testClass)) {
guiTestClasses.add(testClass);
}
} catch (ClassNotFoundException e) {
throw new InitializationError(e);
}
}
return guiTestClasses.toArray(new Class<?>[guiTestClasses.size()]);
}
use of org.junit.runners.model.InitializationError in project jena by apache.
the class ManifestSuite method oneManifest.
private Runner oneManifest(final Manifest manifest, List<Runner> r) {
// Recurse
for (Iterator<String> iter = manifest.includedManifests(); iter.hasNext(); ) {
try {
r.add(oneManifest(new Manifest(iter.next()), new ArrayList<Runner>()));
} catch (JenaException ex) {
r.add(new ErrorReportingRunner(null, ex));
}
}
itemHandler.setTestRunnerList(r);
manifest.apply(itemHandler);
try {
return new Suite((Class<?>) null, r) {
@Override
protected String getName() {
return manifest.getName();
}
};
} catch (InitializationError e) {
return new ErrorReportingRunner(null, e);
}
}
Aggregations