Package org.testng.xml

Examples of org.testng.xml.Parser


      ex.printStackTrace();
    }
  }

  private Parser getParser(String path) {
    Parser result = new Parser(path);
    initProcessor(result);
    return result;
  }
View Full Code Here


    initProcessor(result);
    return result;
  }

  private Parser getParser(InputStream is) {
    Parser result = new Parser(is);
    initProcessor(result);
    return result;
  }
View Full Code Here

    String xml = "<suite name=\"dgf\" verbose=\"10\"><test name=\"dgf\"><classes>" +
        "<class name=\"test.dependent.MissingMethodSampleTest\"/>" +
        "</classes></test></suite>";
    System.out.println(xml);
    ByteArrayInputStream is = new ByteArrayInputStream(xml.getBytes());
    tng.setXmlSuites(new Parser(is).parseToList());
    tng.run();
  }
View Full Code Here

  @Test(dataProvider = "dp")
  public void compareFiles(String name)
      throws ParserConfigurationException, SAXException, IOException {
    Collection<XmlSuite> s1 =
        new Parser(getPathToResource("yaml" + File.separator + name + ".yaml")).parse();
    Collection<XmlSuite> s2 =
        new Parser(getPathToResource("yaml" + File.separator + name + ".xml")).parse();

    Assert.assertEquals(s1, s2);
  }
View Full Code Here

  public static void main(String[] args) throws Exception {
    TestNG tng = new TestNG();
    String xml = "<suite name=\"dgf\" verbose=\"10\"><test name=\"dgf\"><classes><class name=\"test.dependent.MissingGroupSampleTest\"></class></classes></test></suite>";
    System.out.println(xml);
    ByteArrayInputStream is = new ByteArrayInputStream(xml.getBytes());
    tng.setXmlSuites(new Parser(is).parseToList());
    tng.run();
  }
View Full Code Here

  @Test
  public void failedFile() throws ParserConfigurationException, SAXException, IOException {
    TestNG tng = new TestNG();
    tng.setVerbose(0);
    Collection<XmlSuite> suites =
        new Parser(new ByteArrayInputStream(XML.getBytes())).parse();
    tng.setXmlSuites(Lists.newArrayList(suites));
    TestListenerAdapter tla = new TestListenerAdapter();
    File f = new File("/tmp");
    tng.setOutputDirectory(f.getAbsolutePath());
    tng.addListener(tla);
    tng.run();

    Collection<XmlSuite> failedSuites =
        new Parser(new File(f, FailedReporter.TESTNG_FAILED_XML).getAbsolutePath()).parse();
    XmlSuite failedSuite = failedSuites.iterator().next();
    Assert.assertEquals("42", failedSuite.getParameter("n"));

    XmlTest test = failedSuite.getTests().get(0);
    Assert.assertEquals("43", test.getParameter("o"));
View Full Code Here

    try {
      URL jarfile = new URL("jar", "", "file:" + jarFile.getAbsolutePath() + "!/");
      URLClassLoader jarLoader = new URLClassLoader(new URL[] { jarfile });
      Thread.currentThread().setContextClassLoader(jarLoader);

      m_suites.addAll(new Parser().parse());
    }
    catch(MalformedURLException mfurle) {
      System.err.println("could not find jar file named: " + jarFile.getAbsolutePath());
    }
    catch(IOException ioe) {
View Full Code Here

    for (String suiteXmlPath : suites) {
      if(LOGGER.isDebugEnabled()) {
        LOGGER.debug("suiteXmlPath: \"" + suiteXmlPath + "\"");
      }
      try {
        Collection<XmlSuite> allSuites = new Parser(suiteXmlPath).parse();
        for (XmlSuite s : allSuites) {
          m_suites.add(s);
        }
      }
      catch(FileNotFoundException e) {
View Full Code Here

      List<String> classes = Lists.newArrayList();
      boolean foundTestngXml = false;
      while (entries.hasMoreElements()) {
        JarEntry je = entries.nextElement();
        if (je.getName().equals(m_xmlPathInJar)) {
          Parser parser = getParser(jf.getInputStream(je));
          m_suites.addAll(parser.parse());
          foundTestngXml = true;
          break;
        }
        else if (je.getName().endsWith(".class")) {
          int n = je.getName().length() - ".class".length();
View Full Code Here

      ex.printStackTrace();
    }
  }

  private Parser getParser(String path) {
    Parser result = new Parser(path);
    initProcessor(result);
    return result;
  }
View Full Code Here

TOP

Related Classes of org.testng.xml.Parser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.