@Override public String getMethodName() { return testNGMethod.getMethodName(); }
@Override public int compare(ITestNGMethod o1, ITestNGMethod o2) { String n1 = o1.getMethodName(); String n2 = o1.getMethodName(); return n1.compareTo(n2); }
@Override public int compare(ITestResult arg0, ITestResult arg1) { return arg0.getMethod().getMethodName().compareTo( arg1.getMethod().getMethodName()); }
@Override public int compare(Object o1, Object o2) { IInvokedMethod m1 = (IInvokedMethod) o1; IInvokedMethod m2 = (IInvokedMethod) o2; return m1.getTestMethod().getMethodName().compareTo(m2.getTestMethod().getMethodName()); } };
@Override public int compare(ITestResult o1, ITestResult o2) { String c1 = o1.getMethod().getMethodName(); String c2 = o2.getMethod().getMethodName(); return c1.compareTo(c2); }
public static String detailedMethodName(ITestNGMethod method, boolean fqn) { String tempName = annotationFormFor(method); if (! tempName.isEmpty()) { tempName += " "; } return tempName + (fqn ? method.toString() : method.getMethodName()); }
protected String getTestName(ITestResult tr) { return tr.getMethod().getMethodName(); }
private String qualifiedName(ITestNGMethod method) { StringBuilder addon = new StringBuilder(); String[] groups = method.getGroups(); int length = groups.length; if (length > 0 && !"basic".equalsIgnoreCase(groups[0])) { addon.append("("); for (int i = 0; i < length; i++) { if (i > 0) { addon.append(", "); } addon.append(groups[i]); } addon.append(")"); } return "<b>" + method.getMethodName() + "</b> " + addon; }
private TestTag createIgnoredTestTagFor(ITestNGMethod method) { TestTag testTag = new TestTag(); Properties p2 = new Properties(); p2.setProperty(XMLConstants.ATTR_CLASSNAME, method.getRealClass().getName()); p2.setProperty(XMLConstants.ATTR_NAME, method.getMethodName()); testTag.childTag = XMLConstants.SKIPPED; testTag.properties = p2; return testTag; }
/** Finds topmost position of the test method in the stack, or top of stack if <code>method</code> is not in it. */ public static int getTestRoot(StackTraceElement[] stack,ITestNGMethod method) { if(stack!=null) { String cname = method.getTestClass().getName(); for(int x=stack.length-1; x>=0; x--) { if(cname.equals(stack[x].getClassName()) && method.getMethodName().equals(stack[x].getMethodName())) { return x; } } return stack.length-1; } else { return -1; } }
public static String getTestResultName(ITestResult tr) { StringBuilder result = new StringBuilder(tr.getMethod().getMethodName()); Object[] parameters = tr.getParameters(); if (parameters.length > 0) { result.append("("); StringBuilder p = new StringBuilder(); for (int i = 0; i < parameters.length; i++) { if (i > 0) p.append(", "); p.append(Utils.toString(parameters[i])); } if (p.length() > 100) { String s = p.toString().substring(0, 100); s = s + "..."; result.append(s); } else { result.append(p.toString()); } result.append(")"); } return result.toString(); }
@Override public int compare(ITestResult o1, ITestResult o2) { int result = o1.getTestClass().getName() .compareTo(o2.getTestClass().getName()); if (result == 0) { result = o1.getMethod().getMethodName() .compareTo(o2.getMethod().getMethodName()); } return result; } };
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(); }
private void resultDetail(IResultMap tests) { for (ITestResult result : tests.getAllResults()) { ITestNGMethod method = result.getMethod(); m_methodIndex++; String cname = method.getTestClass().getName(); m_out.println("<h2 id=\"m" + m_methodIndex + "\">" + cname + ":" + method.getMethodName() + "</h2>"); generateForResult(result, method); m_out.println("<p class=\"totop\"><a href=\"#summary\">back to summary</a></p>"); } }
private void p(List<IMethodInstance> methods, String s) { System.out.println("[PreserveOrderMethodInterceptor] " + s); for (IMethodInstance mi : methods) { System.out.println(" " + mi.getMethod().getMethodName() + " index:" + mi.getMethod().getTestClass().getXmlClass().getIndex()); } }
@Override public void run(IHookCallBack callBack, ITestResult testResult) { this.method = testResult.getMethod().getMethodName(); super.run(callBack, testResult); }
private void resultDetail(IResultMap tests) { for (ITestResult result : tests.getAllResults()) { ITestNGMethod method = result.getMethod(); m_methodIndex++; String cname = method.getTestClass().getName(); m_out.println( "<h2 id=\"m" + m_methodIndex + "\">" + cname + ":" + method.getMethodName() + "</h2>"); generateForResult(result); m_out.println("<p class=\"totop\"><a href=\"#summary\">back to summary</a></p>"); } }
private void updateGroups(ISuite suite, ITestResult tr) { String[] groups = tr.getMethod().getGroups(); m_groupsBySuiteName.putAll(suite.getName(), Arrays.asList(groups)); for (String group : groups) { m_methodsByGroup.put(group, tr.getMethod().getMethodName()); } }
/** * Get local parameters of one include method from origin test xml. * @param srcXmlTest The {@link XmlTest} object that represents the source. * @param method the method we want to find its parameters * @return local parameters belong to one test method. */ private static Map<String, String> findMethodLocalParameters(XmlTest srcXmlTest, ITestNGMethod method) { Class clazz = method.getRealClass(); for (XmlClass c : srcXmlTest.getClasses()) { if (clazz == c.getSupportClass()) { for (XmlInclude xmlInclude : c.getIncludedMethods()) { if (xmlInclude.getName().equals(method.getMethodName())) { return xmlInclude.getLocalParameters(); } } } } return Collections.emptyMap(); }
@Override public String getContent(ISuite suite, XMLStringBuffer main) { XMLStringBuffer xsb = new XMLStringBuffer(main.getCurrentIndent()); SetMultiMap<Class<?>, ITestNGMethod> map = Maps.newSetMultiMap(); for (ITestNGMethod method : suite.getExcludedMethods()) { map.put(method.getTestClass().getRealClass(), method); } for (Class<?> c : map.keySet()) { xsb.push(D, C, "ignored-class-div"); xsb.addRequired(S, c.getName(), C, "ignored-class-name"); xsb.push(D, C, "ignored-methods-div"); for (ITestNGMethod m : map.get(c)) { xsb.addRequired(S, m.getMethodName(), C, "ignored-method-name"); xsb.addEmptyElement("br"); } xsb.pop(D); xsb.pop(D); } return xsb.toXML(); }