/** * Generate information about methods and groups */ private void generateMethodsAndGroups(XmlSuite xmlSuite, ISuite suite) { StringBuilder sb = new StringBuilder(); Map<String, Collection<ITestNGMethod>> groups = suite.getMethodsByGroups(); sb.append("<h2>Groups used for this test run</h2>"); if (groups.size() > 0) { sb.append("<table border=\"1\">\n") .append("<tr> <td align=\"center\"><b>Group name</b></td>") .append("<td align=\"center\"><b>Methods</b></td></tr>"); String[] groupNames = groups.keySet().toArray(new String[groups.size()]); Arrays.sort(groupNames); for (String group : groupNames) { Collection<ITestNGMethod> methods = groups.get(group); sb.append("<tr><td>").append(group).append(CLOSE_TD); StringBuilder methodNames = new StringBuilder(); Map<ITestNGMethod, ITestNGMethod> uniqueMethods = Maps.newHashMap(); for (ITestNGMethod tm : methods) { uniqueMethods.put(tm, tm); } for (ITestNGMethod tm : uniqueMethods.values()) { methodNames.append(tm.toString()).append("<br/>"); } sb.append("<td>").append(methodNames.toString()).append("</td></tr>\n"); } sb.append("</table>\n"); } Utils.writeFile(getOutputDirectory(xmlSuite), GROUPS, sb.toString()); }
private void writeSuiteGroups(XMLStringBuffer xmlBuffer, ISuite suite) { xmlBuffer.push(XMLReporterConfig.TAG_GROUPS); Map<String, Collection<ITestNGMethod>> methodsByGroups = suite.getMethodsByGroups(); for (Map.Entry<String, Collection<ITestNGMethod>> entry : methodsByGroups.entrySet()) { Properties groupAttrs = new Properties(); groupAttrs.setProperty(XMLReporterConfig.ATTR_NAME, entry.getKey()); xmlBuffer.push(XMLReporterConfig.TAG_GROUP, groupAttrs); Set<ITestNGMethod> groupMethods = getUniqueMethodSet(entry.getValue()); for (ITestNGMethod groupMethod : groupMethods) { Properties methodAttrs = new Properties(); methodAttrs.setProperty(XMLReporterConfig.ATTR_NAME, groupMethod.getMethodName()); methodAttrs.setProperty(XMLReporterConfig.ATTR_METHOD_SIG, groupMethod.toString()); methodAttrs.setProperty(XMLReporterConfig.ATTR_CLASS, groupMethod.getRealClass().getName()); xmlBuffer.addEmptyElement(XMLReporterConfig.TAG_METHOD, methodAttrs); } xmlBuffer.pop(); } xmlBuffer.pop(); }
/** Generate information about methods and groups */ private void generateMethodsAndGroups(XmlSuite xmlSuite, ISuite suite) { StringBuilder sb = new StringBuilder(); Map<String, Collection<ITestNGMethod>> groups = suite.getMethodsByGroups(); sb.append("<h2>Groups used for this test run</h2>"); if (groups.size() > 0) { sb.append("<table border=\"1\">\n") .append("<tr> <td align=\"center\"><b>Group name</b></td>") .append("<td align=\"center\"><b>Methods</b></td></tr>"); String[] groupNames = groups.keySet().toArray(new String[0]); Arrays.sort(groupNames); for (String group : groupNames) { Collection<ITestNGMethod> methods = groups.get(group); sb.append("<tr><td>").append(group).append(CLOSE_TD); StringBuilder methodNames = new StringBuilder(); Map<ITestNGMethod, ITestNGMethod> uniqueMethods = Maps.newHashMap(); for (ITestNGMethod tm : methods) { uniqueMethods.put(tm, tm); } for (ITestNGMethod tm : uniqueMethods.values()) { methodNames.append(tm.toString()).append("<br/>"); } sb.append("<td>").append(methodNames.toString()).append("</td></tr>\n"); } sb.append("</table>\n"); } Utils.writeFile(getOutputDirectory(xmlSuite), GROUPS, sb.toString()); }
private void writeSuiteGroups(XMLStringBuffer xmlBuffer, ISuite suite) { xmlBuffer.push(XMLReporterConfig.TAG_GROUPS); Map<String, Collection<ITestNGMethod>> methodsByGroups = suite.getMethodsByGroups(); for (Map.Entry<String, Collection<ITestNGMethod>> entry : methodsByGroups.entrySet()) { Properties groupAttrs = new Properties(); groupAttrs.setProperty(XMLReporterConfig.ATTR_NAME, entry.getKey()); xmlBuffer.push(XMLReporterConfig.TAG_GROUP, groupAttrs); Set<ITestNGMethod> groupMethods = getUniqueMethodSet(entry.getValue()); for (ITestNGMethod groupMethod : groupMethods) { Properties methodAttrs = new Properties(); methodAttrs.setProperty(XMLReporterConfig.ATTR_NAME, groupMethod.getMethodName()); methodAttrs.setProperty(XMLReporterConfig.ATTR_METHOD_SIG, groupMethod.toString()); methodAttrs.setProperty(XMLReporterConfig.ATTR_CLASS, groupMethod.getRealClass().getName()); xmlBuffer.addEmptyElement(XMLReporterConfig.TAG_METHOD, methodAttrs); } xmlBuffer.pop(); } xmlBuffer.pop(); }
int groupCount = suite.getMethodsByGroups().size(); int methodCount = 0; for (ISuiteResult sr : suiteResults.values()) {
int groupCount = suite.getMethodsByGroups().size(); int methodCount = 0; for (ISuiteResult sr : suiteResults.values()) {
protected Collection<ITestNGMethod> getAllMethods(final ISuite suite) { final Set<ITestNGMethod> all = new LinkedHashSet<ITestNGMethod>(); final Map<String, Collection<ITestNGMethod>> methods = suite.getMethodsByGroups(); for (final Entry<String, Collection<ITestNGMethod>> group : methods.entrySet()) { all.addAll(methods.get(group.getKey())); } return all; }
final Collection<ITestNGMethod> c = suite.getMethodsByGroups().get(dependentGroup);
tempSuite.setsName(suite.getName()); Map<String, ISuiteResult> allResults = suite.getResults(); for (Entry<String, Collection<ITestNGMethod>> sGroupName : suite.getMethodsByGroups().entrySet()) { tempGroups = new SummarizedData(); tempGroups.setsName(sGroupName.getKey());