Exemplo n.º 1
0
  // Send the name of the suite and the name of the test as parameters so that the methods can
  // associate their
  // execution event logs with them. Specified the delay in seconds to apply for the method
  // execution. This delay
  // helps in determining the parallelism or lack thereof for method executions.
  public static void addParams(XmlSuite suite, String suiteName, String testName, String sleepFor) {
    Map<String, String> parameters = new HashMap<>();
    parameters.put("suiteName", suiteName);
    parameters.put("testName", testName);
    parameters.put("sleepFor", sleepFor);

    for (XmlTest test : suite.getTests()) {
      if (test.getName().equals(testName)) {
        test.setParameters(parameters);
      }
    }
  }
Exemplo n.º 2
0
 /** Generate testng-failed.xml */
 private void createXmlTest(
     ITestContext context, List<ITestNGMethod> methods, XmlTest srcXmlTest) {
   XmlTest xmlTest = new XmlTest(m_xmlSuite);
   xmlTest.setName(context.getName() + "(failed)");
   xmlTest.setBeanShellExpression(srcXmlTest.getExpression());
   xmlTest.setIncludedGroups(srcXmlTest.getIncludedGroups());
   xmlTest.setExcludedGroups(srcXmlTest.getExcludedGroups());
   xmlTest.setParallel(srcXmlTest.getParallel());
   xmlTest.setParameters(srcXmlTest.getLocalParameters());
   xmlTest.setJUnit(srcXmlTest.isJUnit());
   List<XmlClass> xmlClasses = createXmlClasses(methods, srcXmlTest);
   xmlTest.setXmlClasses(xmlClasses);
 }
Exemplo n.º 3
0
  /**
   * Clone the <TT>source</TT> <CODE>XmlTest</CODE> by including: - test attributes - groups
   * definitions - parameters
   *
   * <p>The &lt;classes&gt; sub element is ignored for the moment.
   *
   * @return a clone of the current XmlTest
   */
  @Override
  public Object clone() {
    XmlTest result = new XmlTest(getSuite());

    result.setName(getName());
    result.setIncludedGroups(getIncludedGroups());
    result.setExcludedGroups(getExcludedGroups());
    result.setJUnit(isJUnit());
    result.setParallel(getParallel());
    result.setVerbose(getVerbose());
    result.setParameters(getParameters());
    result.setXmlPackages(getXmlPackages());

    Map<String, List<String>> metagroups = getMetaGroups();
    for (Map.Entry<String, List<String>> group : metagroups.entrySet()) {
      result.addMetaGroup(group.getKey(), group.getValue());
    }

    return result;
  }