本文整理了Java中org.testng.internal.Utils.escapeHtml()
方法的一些代码示例,展示了Utils.escapeHtml()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.escapeHtml()
方法的具体详情如下:
包路径:org.testng.internal.Utils
类名称:Utils
方法名:escapeHtml
暂无
代码示例来源:origin: org.testng/testng
private static String buildStackTrace(Throwable t, boolean toHtml, StackTraceType type) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);
pw.flush();
String stackTrace = sw.getBuffer().toString();
if (type == StackTraceType.SHORT && !isTooVerbose()) {
stackTrace = filterTrace(sw.getBuffer().toString());
}
if (toHtml) {
stackTrace = escapeHtml(stackTrace);
}
return stackTrace;
}
代码示例来源:origin: org.testng/testng
protected void writeReporterMessages(List<String> reporterMessages) {
writer.print("<div class=\"messages\">");
Iterator<String> iterator = reporterMessages.iterator();
assert iterator.hasNext();
if (Reporter.getEscapeHtml()) {
writer.print(Utils.escapeHtml(iterator.next()));
} else {
writer.print(iterator.next());
}
while (iterator.hasNext()) {
writer.print("<br/>");
if (Reporter.getEscapeHtml()) {
writer.print(Utils.escapeHtml(iterator.next()));
} else {
writer.print(iterator.next());
}
}
writer.print("</div>");
}
代码示例来源:origin: cbeust/testng
protected void writeReporterMessages(List<String> reporterMessages) {
writer.print("<div class=\"messages\">");
Iterator<String> iterator = reporterMessages.iterator();
assert iterator.hasNext();
if (Reporter.getEscapeHtml()) {
writer.print(Utils.escapeHtml(iterator.next()));
} else {
writer.print(iterator.next());
}
while (iterator.hasNext()) {
writer.print("<br/>");
if (Reporter.getEscapeHtml()) {
writer.print(Utils.escapeHtml(iterator.next()));
} else {
writer.print(iterator.next());
}
}
writer.print("</div>");
}
代码示例来源:origin: cbeust/testng
private static String buildStackTrace(Throwable t, boolean toHtml, StackTraceType type) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);
pw.flush();
String stackTrace = sw.getBuffer().toString();
if (type == StackTraceType.SHORT && !isTooVerbose()) {
stackTrace = filterTrace(sw.getBuffer().toString());
}
if (toHtml) {
stackTrace = escapeHtml(stackTrace);
}
return stackTrace;
}
代码示例来源:origin: cbeust/testng
private boolean dumpParametersInfo(String prefix, Object[] parameters) {
int parameterCount = (parameters == null ? 0 : parameters.length);
if (parameterCount == 0) {
return false;
}
writer.print("<tr class=\"param\">");
for (int i = 1; i <= parameterCount; i++) {
writer.print(String.format("<th>%s #", prefix));
writer.print(i);
writer.print("</th>");
}
writer.print("</tr><tr class=\"param stripe\">");
for (Object parameter : parameters) {
writer.print("<td>");
writer.print(Utils.escapeHtml(Utils.toString(parameter)));
writer.print("</td>");
}
writer.print("</tr>");
return true;
}
代码示例来源:origin: org.testng/testng
String methodName = Utils.escapeHtml(firstResult
.getMethod().getMethodName());
long start = firstResult.getStartMillis();
writer.print(scenariosPerClass);
writer.print("\">");
writer.print(Utils.escapeHtml(classResult.getClassName()));
writer.print("</td>");
writer.print(buffer);
代码示例来源:origin: org.testng/testng
for (Object parameter : parameters) {
writer.print("<td>");
writer.print(Utils.escapeHtml(Utils.toString(parameter)));
writer.print("</td>");
代码示例来源:origin: org.testng/testng
m_out.print("<tr class=\"param stripe\">");
for (Object p : parameters) {
m_out.println("<td>" + Utils.escapeHtml(Utils.toString(p)) + "</td>");
代码示例来源:origin: org.testng/testng
for (SuiteResult suiteResult : suiteResults) {
writer.print("<tr><th colspan=\"7\">");
writer.print(Utils.escapeHtml(suiteResult.getSuiteName()));
writer.println("</th></tr>");
writeTableData(buffer.append("<a href=\"#t").append(testIndex)
.append("\">")
.append(Utils.escapeHtml(testResult.getTestName()))
.append("</a>").toString());
writeTableData(integerFormat.format(passedTests), "num");
代码示例来源:origin: org.testng/testng
for (SuiteResult suiteResult : suiteResults) {
writer.print("<tbody><tr><th colspan=\"4\">");
writer.print(Utils.escapeHtml(suiteResult.getSuiteName()));
writer.print("</th></tr></tbody>");
writer.printf("<tbody id=\"t%d\">", testIndex);
String testName = Utils.escapeHtml(testResult.getTestName());
int startIndex = scenarioIndex;
代码示例来源:origin: cbeust/testng
String methodName = Utils.escapeHtml(firstResult.getMethod().getMethodName());
long start = firstResult.getStartMillis();
long duration = firstResult.getEndMillis() - start;
writer.print(scenariosPerClass);
writer.print("\">");
writer.print(Utils.escapeHtml(classResult.getClassName()));
writer.print("</td>");
writer.print(buffer);
代码示例来源:origin: org.testng/testng
/**
* Writes the scenario details for the results of a given state for a single
* test.
*/
private int writeScenarioDetails(List<ClassResult> classResults,
int startingScenarioIndex) {
int scenarioIndex = startingScenarioIndex;
for (ClassResult classResult : classResults) {
String className = classResult.getClassName();
for (MethodResult methodResult : classResult.getMethodResults()) {
List<ITestResult> results = methodResult.getResults();
assert !results.isEmpty();
String label = Utils
.escapeHtml(className
+ "#"
+ results.iterator().next().getMethod()
.getMethodName());
for (ITestResult result : results) {
writeScenario(scenarioIndex, label, result);
scenarioIndex++;
}
}
}
return scenarioIndex - startingScenarioIndex;
}
代码示例来源:origin: cbeust/testng
m_out.print("<tr class=\"param stripe\">");
for (Object p : parameters) {
m_out.println("<td>" + Utils.escapeHtml(Utils.toString(p)) + "</td>");
代码示例来源:origin: cbeust/testng
/** Writes the scenario details for the results of a given state for a single test. */
private int writeScenarioDetails(List<ClassResult> classResults, int startingScenarioIndex) {
int scenarioIndex = startingScenarioIndex;
for (ClassResult classResult : classResults) {
String className = classResult.getClassName();
for (MethodResult methodResult : classResult.getMethodResults()) {
List<ITestResult> results = methodResult.getResults();
assert !results.isEmpty();
String label =
Utils.escapeHtml(
className + "#" + results.iterator().next().getMethod().getMethodName());
for (ITestResult result : results) {
writeScenario(scenarioIndex, label, result);
scenarioIndex++;
}
}
}
return scenarioIndex - startingScenarioIndex;
}
代码示例来源:origin: cbeust/testng
for (SuiteResult suiteResult : suiteResults) {
writer.print("<tr><th colspan=\"7\">");
writer.print(Utils.escapeHtml(suiteResult.getSuiteName()));
writer.println("</th></tr>");
.append(testIndex)
.append("\">")
.append(Utils.escapeHtml(testResult.getTestName()))
.append("</a>")
.toString());
代码示例来源:origin: cbeust/testng
for (SuiteResult suiteResult : suiteResults) {
writer.print("<tbody><tr><th colspan=\"4\">");
writer.print(Utils.escapeHtml(suiteResult.getSuiteName()));
writer.print("</th></tr></tbody>");
writer.printf("<tbody id=\"t%d\">", testIndex);
String testName = Utils.escapeHtml(testResult.getTestName());
int startIndex = scenarioIndex;
代码示例来源:origin: org.testng/testng
/**
* Writes the details for all test scenarios.
*/
protected void writeScenarioDetails() {
int scenarioIndex = 0;
for (SuiteResult suiteResult : suiteResults) {
for (TestResult testResult : suiteResult.getTestResults()) {
writer.print("<h2>");
writer.print(Utils.escapeHtml(testResult.getTestName()));
writer.print("</h2>");
scenarioIndex += writeScenarioDetails(
testResult.getFailedConfigurationResults(),
scenarioIndex);
scenarioIndex += writeScenarioDetails(
testResult.getFailedTestResults(), scenarioIndex);
scenarioIndex += writeScenarioDetails(
testResult.getSkippedConfigurationResults(),
scenarioIndex);
scenarioIndex += writeScenarioDetails(
testResult.getSkippedTestResults(), scenarioIndex);
scenarioIndex += writeScenarioDetails(
testResult.getPassedTestResults(), scenarioIndex);
}
}
}
代码示例来源:origin: org.testng/testng
@Override
public String getContent(ISuite suite, XMLStringBuffer main) {
XMLStringBuffer xsb = new XMLStringBuffer(main.getCurrentIndent());
xsb.push("pre");
xsb.addString(Utils.escapeHtml(suite.getXmlSuite().toXml()));
xsb.pop("pre");
return xsb.toXML();
}
代码示例来源:origin: cbeust/testng
/** Writes the details for all test scenarios. */
protected void writeScenarioDetails() {
int scenarioIndex = 0;
for (SuiteResult suiteResult : suiteResults) {
for (TestResult testResult : suiteResult.getTestResults()) {
writer.print("<h2>");
writer.print(Utils.escapeHtml(testResult.getTestName()));
writer.print("</h2>");
scenarioIndex +=
writeScenarioDetails(testResult.getFailedConfigurationResults(), scenarioIndex);
scenarioIndex += writeScenarioDetails(testResult.getFailedTestResults(), scenarioIndex);
scenarioIndex +=
writeScenarioDetails(testResult.getSkippedConfigurationResults(), scenarioIndex);
scenarioIndex += writeScenarioDetails(testResult.getSkippedTestResults(), scenarioIndex);
scenarioIndex += writeScenarioDetails(testResult.getPassedTestResults(), scenarioIndex);
}
}
}
代码示例来源:origin: cbeust/testng
@Override
public String getContent(ISuite suite, XMLStringBuffer main) {
XMLStringBuffer xsb = new XMLStringBuffer(main.getCurrentIndent());
xsb.push("pre");
xsb.addString(Utils.escapeHtml(suite.getXmlSuite().toXml()));
xsb.pop("pre");
return xsb.toXML();
}
内容来源于网络,如有侵权,请联系作者删除!