@Override public String getHeader(ISuite suite) { return pluralize(suite.getExcludedMethods().size(), "ignored method"); }
@Override public String getHeader(ISuite suite) { return pluralize(suite.getExcludedMethods().size(), "ignored method"); }
private void generateExcludedMethodsReport(XmlSuite xmlSuite, ISuite suite) { Collection<ITestNGMethod> excluded = suite.getExcludedMethods(); StringBuilder sb2 = new StringBuilder("<h2>Methods that were not run</h2><table>\n"); for (ITestNGMethod method : excluded) { ConstructorOrMethod m = method.getConstructorOrMethod(); if (m != null) { sb2.append("<tr><td>") .append(m.getDeclaringClass().getName()).append(".").append(m.getName()); String description = method.getDescription(); if(isStringNotEmpty(description)) { sb2.append("<br/>").append(SP2).append("<i>").append(description).append("</i>"); } sb2.append("</td></tr>\n"); } } sb2.append("</table>"); Utils.writeFile(getOutputDirectory(xmlSuite), METHODS_NOT_RUN, sb2.toString()); }
private void generateExcludedMethodsReport(XmlSuite xmlSuite, ISuite suite) { Collection<ITestNGMethod> excluded = suite.getExcludedMethods(); StringBuilder sb2 = new StringBuilder("<h2>Methods that were not run</h2><table>\n"); for (ITestNGMethod method : excluded) { ConstructorOrMethod m = method.getConstructorOrMethod(); if (m != null) { sb2.append("<tr><td>") .append(m.getDeclaringClass().getName()) .append(".") .append(m.getName()); String description = method.getDescription(); if (isStringNotEmpty(description)) { sb2.append("<br/>").append(SP2).append("<i>").append(description).append("</i>"); } sb2.append("</td></tr>\n"); } } sb2.append("</table>"); Utils.writeFile(getOutputDirectory(xmlSuite), METHODS_NOT_RUN, sb2.toString()); }
.append(" <a target='mainFrame' href='").append(METHODS_CHRONOLOGICAL).append("'>").append("chronological</a><br/>\n") .append(" <a target='mainFrame' href='").append(METHODS_ALPHABETICAL).append("\'>").append("alphabetical</a><br/>\n") .append(" <a target='mainFrame' href='").append(METHODS_NOT_RUN).append("'>not run (").append(suite.getExcludedMethods().size()).append(")</a>") .append("</td>\n") .append("</tr>\n")
@Override public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, String outputDirectory) { Assert.assertEquals(suites.size(), 1); ISuite suite = suites.get(0); List<IInvokedMethod> invoked = suite.getAllInvokedMethods(); Assert.assertEquals(invoked.size(), m_included.length); for (String s : m_included) { Assert.assertTrue(containsInvokedMethod(invoked, s)); } Collection<ITestNGMethod> excluded = suite.getExcludedMethods(); Assert.assertEquals(excluded.size(), m_excluded.length); for (String s : m_excluded) { Assert.assertTrue(containsMethod(excluded, s)); } }
.append(METHODS_NOT_RUN) .append("'>not run (") .append(suite.getExcludedMethods().size()) .append(")</a>") .append("</td>\n")
for (ISuite suite : suites) { Map<String, ISuiteResult> suiteResults = suite.getResults(); addMapping(mapping, suite.getExcludedMethods()); for (ISuiteResult sr : suiteResults.values()) { ITestContext tc = sr.getTestContext();
for (ISuite suite : suites) { Map<String, ISuiteResult> suiteResults = suite.getResults(); addMapping(mapping, suite.getExcludedMethods()); for (ISuiteResult sr : suiteResults.values()) { ITestContext tc = sr.getTestContext();
@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(); }
@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(); }
@Override public void onStart(ISuite suite) { List<String> errors = new ArrayList<>(); Set<Class> classes = new HashSet<>(); checkAnnotations(errors, classes, suite.getExcludedMethods()); checkAnnotations(errors, classes, suite.getAllMethods()); if (!errors.isEmpty()) { throw new TestNGException(String.join("\n", errors)); } saveInitialThreads(); suiteRunning = true; }
@Override public void onStart(ITestContext context) { Logger logger = getLogger(); logger.debug("Starting tests"); if (logger.isDebugEnabled()) { logger.trace("host: " + context.getHost()); logger.trace("suite name: " + context.getSuite().getName()); logger.trace("parallel: " + context.getSuite().getParallel()); logger.trace("included groups: " + StringUtils.join(context.getIncludedGroups(), ", ")); logger.trace("excluded groups: " + StringUtils.join(context.getExcludedGroups(), ", ")); } if (logger.isTraceEnabled()) { ISuite suite = context.getSuite(); XmlSuite xmlSuite = suite.getXmlSuite(); logger.trace("thread count: " + xmlSuite.getThreadCount()); logger.trace("data provider thread count: " + xmlSuite.getDataProviderThreadCount()); logger.trace("methods: " + StringUtils.join(suite.getAllMethods(), ", ")); logger.trace("excluded methods: " + StringUtils.join(suite.getExcludedMethods(), ", ")); Set<Entry<String, String>> allParameters = xmlSuite.getAllParameters().entrySet(); for (Entry<String, String> entry : allParameters) { logger.trace(entry.getKey() + "='" + entry.getValue() + "'"); } } }
@Override public void onStart(ITestContext context) { Logger logger = getLogger(); logger.debug("Starting tests"); if (logger.isDebugEnabled()) { logger.trace("host: " + context.getHost()); logger.trace("suite name: " + context.getSuite().getName()); logger.trace("parallel: " + context.getSuite().getParallel()); logger.trace("included groups: " + StringUtils.join(context.getIncludedGroups(), ", ")); logger.trace("excluded groups: " + StringUtils.join(context.getExcludedGroups(), ", ")); } if (logger.isTraceEnabled()) { ISuite suite = context.getSuite(); XmlSuite xmlSuite = suite.getXmlSuite(); logger.trace("thread count: " + xmlSuite.getThreadCount()); logger.trace("data provider thread count: " + xmlSuite.getDataProviderThreadCount()); logger.trace("methods: " + StringUtils.join(suite.getAllMethods(), ", ")); logger.trace("excluded methods: " + StringUtils.join(suite.getExcludedMethods(), ", ")); Set<Entry<String, String>> allParameters = xmlSuite.getAllParameters().entrySet(); for (Entry<String, String> entry : allParameters) { logger.trace(entry.getKey() + "='" + entry.getValue() + "'"); } } }
@Override public void onStart(ISuite suite) { List<String> testMethodNames = getTestMethodNames(suite.getAllMethods()); List<String> excludedTestMethodNames = getTestMethodNames(suite.getExcludedMethods()); System.out.println("\n(" + getDateTime() + ")" + " Running suite [" + suite.getName() + "] containing tests " + testMethodNames + " --- excluding tests " + excludedTestMethodNames + "..."); }
@Override public void onStart(ISuite suite) { List<String> testMethodNames = getTestMethodNames(suite.getAllMethods()); List<String> excludedTestMethodNames = getTestMethodNames(suite.getExcludedMethods()); System.out.println("\n(" + getDateTime() + ")" + " Running suite [" + suite.getName() + "] containing tests " + testMethodNames + " --- excluding tests " + excludedTestMethodNames + "..."); }
public SuiteMessage(final ISuite suite, final boolean startSuiteRun) { m_suiteName = suite.getName(); m_testMethodCount =suite.getInvokedMethods().size(); m_startSuite = startSuiteRun; Collection<ITestNGMethod> excludedMethods = suite.getExcludedMethods(); if (excludedMethods != null && excludedMethods.size() > 0) { m_excludedMethods = Lists.newArrayList(); m_descriptions = Maps.newHashMap(); for (ITestNGMethod m : excludedMethods) { String methodName = m.getTestClass().getName() + "." + m.getMethodName(); m_excludedMethods.add(methodName); if (m.getDescription() != null) m_descriptions.put(methodName, m.getDescription()); } } }