use of org.testng.IReporter in project seleniumRobot by bhecquet.
the class SeleniumTestsContext method setReporterPluginClasses.
public void setReporterPluginClasses(String classNames) {
if (classNames != null) {
List<Class<IReporter>> reporterClasses = new ArrayList<>();
for (String className : classNames.split(",")) {
try {
Class<IReporter> clazz = (Class<IReporter>) Class.forName(className);
if (!IReporter.class.isAssignableFrom(clazz)) {
throw new ClassCastException();
}
reporterClasses.add(clazz);
} catch (ClassNotFoundException e) {
throw new ConfigurationException(String.format("Class %s cannot be loaded: %s", className, e.getMessage()));
} catch (ClassCastException e) {
throw new ConfigurationException(String.format("Class %s does not implement IReporter interface", className));
}
}
setAttribute(REPORTER_PLUGIN_CLASSES, reporterClasses);
} else {
setAttribute(REPORTER_PLUGIN_CLASSES, new ArrayList<>());
}
}
Aggregations