Tabnine Logo
XMLStringBuffer.addOptional
Code IndexAdd Tabnine to your IDE (free)

How to use
addOptional
method
in
org.testng.reporters.XMLStringBuffer

Best Java code snippets using org.testng.reporters.XMLStringBuffer.addOptional (Showing top 20 results out of 315)

origin: org.testng/testng

/**
 * Add an optional String element to the current tag.  If value is null, nothing is
 * added.
 * @param tagName The name of the tag
 * @param value The value for this tag
 */
public void addOptional(String tagName, @Nullable String value) {
 addOptional(tagName, value, (Properties) null);
}
origin: org.testng/testng

/**
 * Add an optional Boolean element to the current tag.  If value is null, nothing is
 * added.
 * @param tagName The name of the tag
 * @param value The value for this tag
 */
public void addOptional(String tagName, @Nullable Boolean value) {
 addOptional(tagName, value, null);
}
origin: cbeust/testng

/**
 * Add an optional Boolean element to the current tag. If value is null, nothing is added.
 *
 * @param tagName The name of the tag
 * @param value The value for this tag
 */
public void addOptional(String tagName, @Nullable Boolean value) {
 addOptional(tagName, value, null);
}
origin: cbeust/testng

/**
 * Add an optional String element to the current tag. If value is null, nothing is added.
 *
 * @param tagName The name of the tag
 * @param value The value for this tag
 */
public void addOptional(String tagName, @Nullable String value) {
 addOptional(tagName, value, (Properties) null);
}
origin: org.testng/testng

private void generateMethod(String tagClass, ITestResult tr,
  ITestContext context, XMLStringBuffer xsb) {
 long time = tr.getEndMillis() - tr.getStartMillis();
 xsb.push(D, C, "method");
 xsb.push(D, C, "method-content");
 xsb.addOptional(S, tr.getMethod().getMethodName(), C, "method-name");
 // Parameters?
 if (tr.getParameters().length > 0) {
  StringBuilder sb = new StringBuilder();
  boolean first = true;
  for (Object p : tr.getParameters()) {
   if (!first) sb.append(", ");
   first = false;
   sb.append(Utils.toString(p));
  }
  xsb.addOptional(S, "(" + sb.toString() + ")", C, "parameters");
 }
 // Exception?
 if (tr.getThrowable() != null) {
  StringBuilder stackTrace = new StringBuilder();
  for (StackTraceElement str : tr.getThrowable().getStackTrace()) {
   stackTrace.append(str.toString()).append("<br>");
  }
  xsb.addOptional(D, stackTrace.toString() + "\n",
    C, "stack-trace");
 }
 xsb.addOptional(S, " " + Long.toString(time) + " ms", C, "method-time");
 xsb.pop(D);
 xsb.pop(D);
}
origin: org.testng/testng

private void addLinkTo(XMLStringBuffer header, INavigatorPanel panel, ISuite suite) {
 String text = panel.getNavigatorLink(suite);
 header.push("li");
 header.push("a", "href", "#",
   "panel-name", panel.getPanelName(suite),
   C, "navigator-link ");
 String className = panel.getClassName();
 if (className != null) {
  header.addOptional(S, text, C, className);
 } else {
  header.addOptional(S, text);
 }
 header.pop("a");
 header.pop("li");
}
origin: cbeust/testng

private void addLinkTo(XMLStringBuffer header, INavigatorPanel panel, ISuite suite) {
 String text = panel.getNavigatorLink(suite);
 header.push("li");
 header.push("a", "href", "#", "panel-name", panel.getPanelName(suite), C, "navigator-link ");
 String className = panel.getClassName();
 if (className != null) {
  header.addOptional(S, text, C, className);
 } else {
  header.addOptional(S, text);
 }
 header.pop("a");
 header.pop("li");
}
origin: org.testng/testng

xsb.push("a", "name", Model.getTestResultName(tr));
xsb.pop("a");
xsb.addOptional(S, tr.getMethod().getMethodName(), C, "method-name");
  sb.append(Utils.toString(p));
 xsb.addOptional(S, "(" + sb.toString() + ")", C, "parameters");
 StringBuilder stackTrace = new StringBuilder();
 stackTrace.append(Utils.shortStackTrace(tr.getThrowable(), true));
 xsb.addOptional(D, stackTrace.toString() + "\n",
   C, "stack-trace");
origin: cbeust/testng

@Test
public void testMethod() {
  IBuffer result = Buffer.create();
  XMLStringBuffer sb = new XMLStringBuffer(result, "");
  sb.push("family");
  Properties p = new Properties();
  p.setProperty("prop1", "value1");
  p.setProperty("prop2", "value2");
  sb.addRequired("cedric", "true", p);
  sb.addRequired("alois", "true");
  sb.addOptional("anne-marie", (String) null);
  sb.pop();
  String expected = "<family>" + EOL +
      "  <cedric prop2=\"value2\" prop1=\"value1\">true</cedric>" + EOL +
      "  <alois>true</alois>" + EOL +
      "</family>";
  assertThat(result.toString().trim()).isEqualTo(expected);
}
origin: cbeust/testng

xsb.push("a", "name", Model.getTestResultName(tr));
xsb.pop("a");
xsb.addOptional(S, tr.getMethod().getMethodName(), C, "method-name");
  sb.append(Utils.toString(p));
 xsb.addOptional(S, "(" + sb.toString() + ")", C, "parameters");
 StringBuilder stackTrace = new StringBuilder();
 stackTrace.append(Utils.shortStackTrace(tr.getThrowable(), true));
 xsb.addOptional(D, stackTrace.toString() + "\n", C, "stack-trace");
origin: org.testng/testng

private void generateClassPanel(Class c, List<ITestResult> results, XMLStringBuffer xsb,
  String status, ISuite suite) {
 xsb.push(D, C, "suite-" + suiteToTag(suite) + "-class-" + status);
 xsb.push(D, C, "main-panel-header rounded-window-top");
 // Passed/failed icon
 xsb.addEmptyElement("img", "src", Model.getImage(status));
 xsb.addOptional(S, c.getName(), C, "class-name");
 xsb.pop(D);
 xsb.push(D, C, "main-panel-content rounded-window-bottom");
 for (ITestResult tr : results) {
  generateMethod(tr, xsb);
 }
 xsb.pop(D);
 xsb.pop(D);
}
origin: cbeust/testng

private void generateClassPanel(
  Class c, List<ITestResult> results, XMLStringBuffer xsb, String status, ISuite suite) {
 xsb.push(D, C, "suite-" + suiteToTag(suite) + "-class-" + status);
 xsb.push(D, C, "main-panel-header rounded-window-top");
 // Passed/failed icon
 xsb.addEmptyElement("img", "src", Model.getImage(status));
 xsb.addOptional(S, c.getName(), C, "class-name");
 xsb.pop(D);
 xsb.push(D, C, "main-panel-content rounded-window-bottom");
 for (ITestResult tr : results) {
  generateMethod(tr, xsb);
 }
 xsb.pop(D);
 xsb.pop(D);
}
origin: org.testng/testng

 generateTests("passed", context.getPassedTests(), context, xs3);
xsb.addOptional(D, "Failed" + " tests", C, "result-banner " + "failed");
xsb.addString(xs1.toXML());
xsb.addOptional(D, "Skipped" + " tests", C, "result-banner " + "skipped");
xsb.addString(xs2.toXML());
xsb.addOptional(D, "Passed" + " tests", C, "result-banner " + "passed");
xsb.addString(xs3.toXML());
header.addOptional(S, suite.getName(), C, "suite-name");
header.push(D, C, "stats");
int total = failed + skipped + passed;
header.addOptional(S, stats, C, "method-stats");
header.pop("li");
header.addOptional(S, String.format("%s ", pluralize(results.values().size(), "test"),
  C, "test-stats"));
header.pop("li");
 String testName = tr.getTestContext().getName();
 header.push("li");
 header.addOptional("a", testName, "href", "#" + m_testMap.get(testName));
 header.pop("li");
origin: org.testng/testng

@Override
public void generate(XMLStringBuffer xsb) {
 for (ISuite s : getSuites()) {
  xsb.push(D, C, "panel", "panel-name", getPanelName(s));
  xsb.push(D, C, "main-panel-header rounded-window-top");
  xsb.addOptional(S, getHeader(s), C, "header-content");
  xsb.pop(D);
  xsb.push(D, C, "main-panel-content rounded-window-bottom");
  xsb.addString(getContent(s, xsb));
  xsb.pop(D);
  xsb.pop(D);
 }
}
origin: cbeust/testng

@Override
public void generate(XMLStringBuffer xsb) {
 for (ISuite s : getSuites()) {
  xsb.push(D, C, "panel", "panel-name", getPanelName(s));
  xsb.push(D, C, "main-panel-header rounded-window-top");
  xsb.addOptional(S, getHeader(s), C, "header-content");
  xsb.pop(D);
  xsb.push(D, C, "main-panel-content rounded-window-bottom");
  xsb.addString(getContent(s, xsb));
  xsb.pop(D);
  xsb.pop(D);
 }
}
origin: org.testng/testng

private void generateResult(XMLStringBuffer header, int failed, int skipped, int passed,
  ISuite suite, String suiteName) {
 //
 // Results
 //
 header.push(D, C, "result-section");
 header.push(D, C, "suite-section-title");
 header.addRequired(S, "Results");
 header.pop(D);
 // Method stats
 int total = failed + skipped + passed;
 String stats = String.format("%s, %s %s %s",
   pluralize(total, "method"),
   maybe(failed, "failed", ", "),
   maybe(skipped, "skipped", ", "),
   maybe(passed, "passed", ""));
 header.push(D, C, "suite-section-content");
 header.push("ul");
 header.push("li");
 header.addOptional(S, stats, C, "method-stats");
 header.pop("li");
 generateMethodList("Failed methods", new ResultsByStatus(suite, "failed", ITestResult.FAILURE),
   suiteName, header);
 generateMethodList("Skipped methods", new ResultsByStatus(suite, "skipped", ITestResult.SKIP),
   suiteName, header);
 generateMethodList("Passed methods", new ResultsByStatus(suite, "passed", ITestResult.SUCCESS),
   suiteName, header);
 }
origin: org.testng/testng

xsb.addOptional(S, c.getName(), C, "class-name");
origin: cbeust/testng

header.push("ul");
header.push("li");
header.addOptional(S, stats, C, "method-stats");
header.pop("li");
origin: org.testng/testng

  "panel-name", suiteName,
  C, "navigator-link");
header.addOptional(S, suite.getName(),
  C, "suite-name border-" + getModel().getStatusForSuite(suite.getName()));
header.pop("a");
origin: cbeust/testng

header.addOptional(
  S,
  suite.getName(),
org.testng.reportersXMLStringBufferaddOptional

Javadoc

Add an optional Boolean element to the current tag. If value is null, nothing is added.

Popular methods of XMLStringBuffer

  • <init>
  • pop
    Pop the last pushed element and throws an AssertionError if it doesn't match the corresponding tag t
  • push
  • addEmptyElement
  • toXML
  • addCDATA
    Add a CDATA tag.
  • addComment
  • addRequired
  • getStringBuffer
  • setDocType
    Set the doctype for this document.
  • addString
  • createProperties
  • addString,
  • createProperties,
  • getCurrentIndent,
  • init,
  • setDefaultComment,
  • setXmlDetails,
  • toWriter

Popular in Java

  • Creating JSON documents from java classes using gson
  • onCreateOptionsMenu (Activity)
  • setScale (BigDecimal)
  • findViewById (Activity)
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now