protected void generateExceptionReport(Throwable exception, ITestNGMethod method) { m_out.print("<div class=\"stacktrace\">"); m_out.print(Utils.shortStackTrace(exception, true)); m_out.println("</div>"); }
protected void writeStackTrace(Throwable throwable) { writer.print("<div class=\"stacktrace\">"); writer.print(Utils.shortStackTrace(throwable, true)); writer.print("</div>"); }
protected void writeStackTrace(Throwable throwable) { writer.print("<div class=\"stacktrace\">"); writer.print(Utils.shortStackTrace(throwable, true)); writer.print("</div>"); }
protected void generateExceptionReport(Throwable exception) { m_out.print("<div class=\"stacktrace\">"); m_out.print(Utils.shortStackTrace(exception, true)); m_out.println("</div>"); }
/** * @return an array of two strings: the short stack trace and the long stack trace. * @deprecated - Please consider using : * <ul> * <li>{@link Utils#longStackTrace(Throwable, boolean)} - for getting full stack trace</li> * <li>{@link Utils#shortStackTrace(Throwable, boolean)} - for getting short stack trace</li> * </ul> */ @Deprecated public static String[] stackTrace(Throwable t, boolean toHtml) { return new String[] { shortStackTrace(t, toHtml), longStackTrace(t, toHtml) }; }
/** * @return an array of two strings: the short stack trace and the long stack trace. * @deprecated - Please consider using : * <ul> * <li>{@link Utils#longStackTrace(Throwable, boolean)} - for getting full stack trace * <li>{@link Utils#shortStackTrace(Throwable, boolean)} - for getting short stack trace * </ul> */ @Deprecated public static String[] stackTrace(Throwable t, boolean toHtml) { return new String[] {shortStackTrace(t, toHtml), longStackTrace(t, toHtml)}; }
private void logExceptions(String status, List<ITestResult> results) { results.forEach( tr -> { Throwable throwable = tr.getThrowable(); logResult(status, tr, throwable != null ? Utils.shortStackTrace(throwable, false) : null); }); }
private void createFailureElement(XMLStringBuffer doc, ITestResult tr) { Properties attrs= new Properties(); Throwable t= tr.getThrowable(); if(t != null) { attrs.setProperty(XMLConstants.ATTR_TYPE, t.getClass().getName()); String message= t.getMessage(); if((message != null) && (message.length() > 0)) { attrs.setProperty(XMLConstants.ATTR_MESSAGE, encodeAttr(message)); // ENCODE } doc.push(XMLConstants.FAILURE, attrs); doc.addCDATA(Utils.shortStackTrace(t, false)); doc.pop(); } else { doc.addEmptyElement(XMLConstants.FAILURE); // THIS IS AN ERROR } }
stackTrace = "<div><pre>" + Utils.shortStackTrace(tw, true) + "</pre></div>";
private void createFailureElement(XMLStringBuffer doc, ITestResult tr) { Properties attrs = new Properties(); Throwable t = tr.getThrowable(); if (t != null) { attrs.setProperty(XMLConstants.ATTR_TYPE, t.getClass().getName()); String message = t.getMessage(); if ((message != null) && (message.length() > 0)) { attrs.setProperty(XMLConstants.ATTR_MESSAGE, encodeAttr(message)); // ENCODE } doc.push(XMLConstants.FAILURE, attrs); doc.addCDATA(Utils.shortStackTrace(t, false)); doc.pop(); } else { doc.addEmptyElement(XMLConstants.FAILURE); // THIS IS AN ERROR } }
sb.append("SKIPPED"); stackTrace = itr.getThrowable() != null ? Utils.shortStackTrace(itr.getThrowable(), false) : ""; break; case FAILURE: sb.append("FAILED"); stackTrace = itr.getThrowable() != null ? Utils.shortStackTrace(itr.getThrowable(), false) : ""; break; case SUCCESS:
stackTrace = "<div><pre>" + Utils.shortStackTrace(tw, true) + "</pre></div>";
sb.append("SKIPPED"); stackTrace = itr.getThrowable() != null ? Utils.shortStackTrace(itr.getThrowable(), false) : ""; break; case FAILURE: sb.append("FAILED"); stackTrace = itr.getThrowable() != null ? Utils.shortStackTrace(itr.getThrowable(), false) : ""; break; case SUCCESS:
private void addTestResultException(XMLStringBuffer xmlBuffer, ITestResult testResult) { Throwable exception = testResult.getThrowable(); if (exception != null) { Properties exceptionAttrs = new Properties(); exceptionAttrs.setProperty(XMLReporterConfig.ATTR_CLASS, exception.getClass().getName()); xmlBuffer.push(XMLReporterConfig.TAG_EXCEPTION, exceptionAttrs); if (!Utils.isStringEmpty(exception.getMessage())) { xmlBuffer.push(XMLReporterConfig.TAG_MESSAGE); xmlBuffer.addCDATA(exception.getMessage()); xmlBuffer.pop(); } XMLReporterConfig.StackTraceLevels level = calculateStackTraceLevels(testResult); switch (level) { case SHORT: xmlBuffer.push(XMLReporterConfig.TAG_SHORT_STACKTRACE); xmlBuffer.addCDATA(Utils.shortStackTrace(exception, false)); xmlBuffer.pop(); break; case FULL: xmlBuffer.push(XMLReporterConfig.TAG_FULL_STACKTRACE); xmlBuffer.addCDATA(Utils.longStackTrace(exception, false)); xmlBuffer.pop(); break; default: //everything else is ignored for now. } xmlBuffer.pop(); } }
private static void generateReport(ITestResult result) { StringBuilder builder = new StringBuilder(); String clsname = result.getTestClass().getRealClass().getName() + "."; String methodname = result.getMethod().getMethodName() + "()"; builder.append(clsname).append(methodname); Object[] parameters = result.getParameters(); if (parameters != null && parameters.length != 0) { builder.append(" Parameters:").append(Arrays.toString(parameters)); } Throwable throwable = result.getThrowable(); builder.append("\nException:\n"); builder.append(Utils.shortStackTrace(throwable, false)); builder.append("\n\n"); System.err.println(builder.toString()); } }
String stackTrace = ""; if (ex != null && m_verbose >= 2) { stackTrace = Utils.shortStackTrace(ex, false); String stackTrace= ""; if (ex != null && m_verbose >= 2) { stackTrace= Utils.shortStackTrace(ex, false); logResult("SKIPPED", tr, throwable != null ? Utils.shortStackTrace(throwable, false) : null);
private void addTestResultException(XMLStringBuffer xmlBuffer, ITestResult testResult) { Throwable exception = testResult.getThrowable(); if (exception != null) { Properties exceptionAttrs = new Properties(); exceptionAttrs.setProperty(XMLReporterConfig.ATTR_CLASS, exception.getClass().getName()); xmlBuffer.push(XMLReporterConfig.TAG_EXCEPTION, exceptionAttrs); if (!Utils.isStringEmpty(exception.getMessage())) { xmlBuffer.push(XMLReporterConfig.TAG_MESSAGE); xmlBuffer.addCDATA(exception.getMessage()); xmlBuffer.pop(); } XMLReporterConfig.StackTraceLevels level = calculateStackTraceLevels(testResult); switch (level) { case SHORT: xmlBuffer.push(XMLReporterConfig.TAG_SHORT_STACKTRACE); xmlBuffer.addCDATA(Utils.shortStackTrace(exception, false)); xmlBuffer.pop(); break; case FULL: xmlBuffer.push(XMLReporterConfig.TAG_FULL_STACKTRACE); xmlBuffer.addCDATA(Utils.longStackTrace(exception, false)); xmlBuffer.pop(); break; default: // everything else is ignored for now. } xmlBuffer.pop(); } }
stackTrace.append(Utils.shortStackTrace(tr.getThrowable(), true)); xsb.addOptional(D, stackTrace.toString() + "\n", C, "stack-trace");
String stackTrace = ""; if (ex != null && m_verbose >= 2) { stackTrace = Utils.shortStackTrace(ex, false); String stackTrace = ""; if (ex != null && m_verbose >= 2) { stackTrace = Utils.shortStackTrace(ex, false);
stackTrace.append(Utils.shortStackTrace(tr.getThrowable(), true)); xsb.addOptional(D, stackTrace.toString() + "\n", C, "stack-trace");