org.testng.internal.Utils.stackTrace()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(145)

本文整理了Java中org.testng.internal.Utils.stackTrace()方法的一些代码示例,展示了Utils.stackTrace()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.stackTrace()方法的具体详情如下:
包路径:org.testng.internal.Utils
类名称:Utils
方法名:stackTrace

Utils.stackTrace介绍

暂无

代码示例

代码示例来源:origin: org.w3/ldp-testsuite

private void createExceptionProperty(Throwable thrown, Resource resource) {
  if (thrown.getClass().getName().contains(SKIP))
    resource.addProperty(DCTerms.description, thrown.getMessage());
  else
    resource.addLiteral(DCTerms.description,
        Utils.stackTrace(thrown, false)[0]);
}

代码示例来源:origin: org.w3/ldp-testsuite

protected void printErrorDetails(ITestResult tr) {
  errors.append("\n[FAILURE] ");
  errors.append(tr.getTestClass().getRealClass().getSimpleName());
  errors.append(".");
  errors.append(tr.getName());
  errors.append("\n");
  String description = tr.getMethod().getDescription();
  if (description != null) {
    errors.append("\n");
    errors.append(WordUtils.wrap(description, 78));
    errors.append("\n");
  }
  Throwable thrown = tr.getThrowable();
  if (thrown != null) {
    errors.append("\n");
    errors.append(Utils.stackTrace(thrown, false)[0]);
    errors.append("\n");
  }
}

代码示例来源:origin: org.infinispan/infinispan-commons-test

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.stackTrace(t, false)[0]);
   doc.pop();
 } else {
   doc.addEmptyElement(XMLConstants.FAILURE); // THIS IS AN ERROR
 }
}

代码示例来源:origin: tarun3kumar/seleniumtestsframework

final String fullStackTrace = Utils.stackTrace(t, false)[1];
failureMessage.append(fullStackTrace).append("\n");

代码示例来源:origin: com.hotels/heat-core-utils

private void setFailedTcAttribute(XMLStringBuffer doc, ITestResult failedTestCase) {
  Properties attributesFailedTestSuites = new Properties();
  String tcName = ((HashMap<String, String>) failedTestCase.getParameters()[0]).get(PROP_TEST_ID);
  attributesFailedTestSuites.setProperty(XMLConstants.ATTR_NAME, tcName);
  long elapsedTimeMillis = failedTestCase.getEndMillis() - failedTestCase.getStartMillis();
  testRunningTotalTime += elapsedTimeMillis;
  Throwable t = failedTestCase.getThrowable();
  doc.push(XMLConstants.TESTCASE, attributesFailedTestSuites);
  if (t != null) {
    attributesFailedTestSuites.setProperty(XMLConstants.ATTR_TYPE, t.getClass().getName());
    String message = t.getMessage();
    if ((message != null) && (message.length() > 0)) {
      attributesFailedTestSuites.setProperty(XMLConstants.ATTR_MESSAGE, encodeAttr(message)); // ENCODE
    }
    doc.push(XMLConstants.FAILURE, attributesFailedTestSuites);
    doc.addCDATA(Utils.stackTrace(t, false)[0]);
    doc.pop();
  } else {
    doc.addEmptyElement(XMLConstants.FAILURE); // THIS IS AN ERROR
  }
  doc.pop();
}

代码示例来源:origin: HotelsDotCom/heat

private void setFailedTcAttribute(XMLStringBuffer doc, ITestResult failedTestCase) {
  Properties attributesFailedTestSuites = new Properties();
  String tcName = ((HashMap<String, String>) failedTestCase.getParameters()[0]).get(PROP_TEST_ID);
  attributesFailedTestSuites.setProperty(XMLConstants.ATTR_NAME, tcName);
  long elapsedTimeMillis = failedTestCase.getEndMillis() - failedTestCase.getStartMillis();
  testRunningTotalTime += elapsedTimeMillis;
  Throwable t = failedTestCase.getThrowable();
  doc.push(XMLConstants.TESTCASE, attributesFailedTestSuites);
  if (t != null) {
    attributesFailedTestSuites.setProperty(XMLConstants.ATTR_TYPE, t.getClass().getName());
    String message = t.getMessage();
    if ((message != null) && (message.length() > 0)) {
      attributesFailedTestSuites.setProperty(XMLConstants.ATTR_MESSAGE, encodeAttr(message)); // ENCODE
    }
    doc.push(XMLConstants.FAILURE, attributesFailedTestSuites);
    doc.addCDATA(Utils.stackTrace(t, false)[0]);
    doc.pop();
  } else {
    doc.addEmptyElement(XMLConstants.FAILURE); // THIS IS AN ERROR
  }
  doc.pop();
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-utils-test-support

sb.append("SKIPPED");
  stackTrace = itr.getThrowable() != null
      ? Utils.stackTrace(itr.getThrowable(), false)[0] : "";
  break;
case FAILURE:
  sb.append("FAILED");
  stackTrace = itr.getThrowable() != null
      ? Utils.stackTrace(itr.getThrowable(), false)[0] : "";
  break;
case SUCCESS:

代码示例来源:origin: io.brooklyn/brooklyn-utils-test-support

sb.append("SKIPPED");
  stackTrace = itr.getThrowable() != null
      ? Utils.stackTrace(itr.getThrowable(), false)[0] : "";
  break;
case FAILURE:
  sb.append("FAILED");
  stackTrace = itr.getThrowable() != null
      ? Utils.stackTrace(itr.getThrowable(), false)[0] : "";
  break;
case SUCCESS:

代码示例来源:origin: org.w3/ldp-testsuite

private void createThrownTable(Throwable thrown) throws IOException {
  html.table(class_("indented"));
  html.tr(class_("center")).th(class_("Failed")).content("[FAILED TEST]")
      ._tr();
  html.tr().td(class_("throw")).content(Utils.stackTrace(thrown, false)[0])._tr();
  html._table();
}

相关文章