private void handleUserInteractionFailure( SeleniumHolder seleniumHolder, UserInteraction userInteraction, UserInteractionException e) { String msg = "Error invoking user interaction: " + userInteraction.toString() + "."; if (userInteraction.getElement() instanceof PageElement) { PageElement pe = (PageElement) userInteraction.getElement(); if (pe.getStatus().equals(TestPartStatus.FAIL)) { msg += "\n\nPage element " + pe.toString() + " not found."; } seleniumHolder.addResultByIsNot(pe, TestPartStatus.EXCEPTION, pe.isNot()); } Logger.error(msg, e); throw new UserInteractionException(msg); }
public static CustomTestStep loadFromFile(File file) { String xml = ""; try { String charset = TestPersistance.getCharset(file); xml = FileUtils.readFileToString(file, charset); } catch (FileNotFoundException e) { Logger.error("Error loading test.", e); throw new TestNotFoundException(e.getMessage()); } catch (IOException e) { ErrorHandler.logAndRethrow(e); } CustomTestStep customStep = null; try { customStep = (CustomTestStep) new CubicTestXStream().fromXML(xml); return customStep; } catch (StreamException e) { } if (customStep == null) customStep = new CustomTestStep(); return customStep; }