org.testng.xml
Class Parser

java.lang.Object
  extended by org.testng.xml.Parser

public class Parser
extends Object

Parser is a parser for a TestNG XML test suite file.


Field Summary
static String DEFAULT_FILENAME
          The default file name for the TestNG test suite if none is specified (testng.xml).
static String DEPRECATED_TESTNG_DTD_URL
          The URL to the deprecated TestNG DTD.
static String TESTNG_DTD
          The name of the TestNG DTD.
static String TESTNG_DTD_URL
          The URL to the TestNG DTD.
 
Constructor Summary
Parser()
          Creates a parser that will try to find the DEFAULT_FILENAME from the jar.
Parser(InputStream inputStream)
          Constructs a Parser to use the inputStream as the source of the xml test suite to parse.
Parser(String fileName)
          create a parser that works on a given file.
 
Method Summary
 Collection<XmlSuite> parse()
          Parses the TestNG test suite and returns the corresponding XmlSuite, and possibly, other XmlSuite that are pointed to by tags.
 List<XmlSuite> parseToList()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TESTNG_DTD

public static final String TESTNG_DTD
The name of the TestNG DTD.

See Also:
Constant Field Values

DEPRECATED_TESTNG_DTD_URL

public static final String DEPRECATED_TESTNG_DTD_URL
The URL to the deprecated TestNG DTD.

See Also:
Constant Field Values

TESTNG_DTD_URL

public static final String TESTNG_DTD_URL
The URL to the TestNG DTD.

See Also:
Constant Field Values

DEFAULT_FILENAME

public static final String DEFAULT_FILENAME
The default file name for the TestNG test suite if none is specified (testng.xml).

See Also:
Constant Field Values
Constructor Detail

Parser

public Parser(String fileName)
       throws FileNotFoundException
create a parser that works on a given file.

Parameters:
fileName - the filename of the xml suite to parse.
Throws:
FileNotFoundException - if the fileName is not found.

Parser

public Parser(InputStream inputStream)
Constructs a Parser to use the inputStream as the source of the xml test suite to parse.

Parameters:
inputStream - the xml test suite input stream.

Parser

public Parser()
       throws FileNotFoundException
Creates a parser that will try to find the DEFAULT_FILENAME from the jar.

Throws:
FileNotFoundException - if the DEFAULT_FILENAME resource is not found in the classpath.
Method Detail

parse

public Collection<XmlSuite> parse()
                           throws ParserConfigurationException,
                                  SAXException,
                                  IOException
Parses the TestNG test suite and returns the corresponding XmlSuite, and possibly, other XmlSuite that are pointed to by tags.

Returns:
the parsed TestNG test suite.
Throws:
ParserConfigurationException
SAXException
IOException - if an I/O error occurs while parsing the test suite file or if the default testng.xml file is not found.

parseToList

public List<XmlSuite> parseToList()
                           throws ParserConfigurationException,
                                  SAXException,
                                  IOException
Throws:
ParserConfigurationException
SAXException
IOException


Copyright © 2010. All Rights Reserved.