All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.testng.reporters.jq.GroupPanel Maven / Gradle / Ivy

There is a newer version: 7.10.2
Show newest version
package org.testng.reporters.jq;

import org.testng.ISuite;
import org.testng.reporters.XMLStringBuffer;

import java.util.Collections;
import java.util.List;

public class GroupPanel extends BaseMultiSuitePanel {
  public GroupPanel(Model model) {
    super(model);
  }

  @Override
  public String getPrefix() {
    return "group-";
  }

  @Override
  public String getHeader(ISuite suite) {
    return "Groups for " + suite.getName();
  }

  @Override
  public String getContent(ISuite suite, XMLStringBuffer main) {
    XMLStringBuffer xsb = new XMLStringBuffer(main.getCurrentIndent());
    List sortedGroups = getModel().getGroups(suite.getName());
    Collections.sort(sortedGroups);
    for (String group : sortedGroups) {
      xsb.push(D, C, "test-group");
      xsb.addRequired(S, group, C, "test-group-name");
      xsb.addEmptyElement("br");
      List sortedMethods = getModel().getMethodsInGroup(group);
      for (String method : sortedMethods) {
        xsb.push(D, C, "method-in-group");
        xsb.addRequired(S, method, C, "method-in-group-name");
        xsb.addEmptyElement("br");
        xsb.pop(D);
      }
      xsb.pop(D);
    }
    return xsb.toXML();
  }

  @Override
  public String getNavigatorLink(ISuite suite) {
    return pluralize(getModel().getGroups(suite.getName()).size(), "group");
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy