Package org.testng.xml
Class Parser
- java.lang.Object
-
- org.testng.xml.Parser
-
public class Parser extends Object
Parser
is a parser for a TestNG XML test suite file.
-
-
Field Summary
Fields Modifier and Type Field Description 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
Constructors Constructor Description Parser()
Creates a parser that will try to find the DEFAULT_FILENAME from the jar.Parser(InputStream is)
Parser(String fileName)
Constructs aParser
to use the inputStream as the source of the xml test suite to parse.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
canParse(String fileName)
static boolean
hasFileScheme(String uri)
Collection<XmlSuite>
parse()
Parses the TestNG test suite and returns the corresponding XmlSuite, and possibly, other XmlSuite that are pointed to bytags. static Collection<XmlSuite>
parse(InputStream is, IPostProcessor processor)
static Collection<XmlSuite>
parse(String suite, IPostProcessor processor)
List<XmlSuite>
parseToList()
void
setLoadClasses(boolean loadClasses)
If false, don't try to load the classes during the parsing.void
setPostProcessor(IPostProcessor processor)
-
-
-
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)
Constructs aParser
to use the inputStream as the source of the xml test suite to parse.- Parameters:
fileName
- the filename corresponding to the inputStream or null if unknown.
-
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.
-
Parser
public Parser(InputStream is)
-
-
Method Detail
-
setPostProcessor
public void setPostProcessor(IPostProcessor processor)
-
setLoadClasses
public void setLoadClasses(boolean loadClasses)
If false, don't try to load the classes during the parsing.
-
parse
public Collection<XmlSuite> parse() throws IOException
Parses the TestNG test suite and returns the corresponding XmlSuite, and possibly, other XmlSuite that are pointed to bytags. - Returns:
- the parsed TestNG test suite.
- Throws:
IOException
- if an I/O error occurs while parsing the test suite file or if the default testng.xml file is not found.
-
hasFileScheme
public static boolean hasFileScheme(String uri)
- Parameters:
uri
- - The uri to be verified.- Returns:
- -
true
if the uri has "file:" as its scheme.
-
parseToList
public List<XmlSuite> parseToList() throws IOException
- Throws:
IOException
-
parse
public static Collection<XmlSuite> parse(String suite, IPostProcessor processor) throws IOException
- Throws:
IOException
-
parse
public static Collection<XmlSuite> parse(InputStream is, IPostProcessor processor) throws IOException
- Throws:
IOException
-
canParse
public static boolean canParse(String fileName)
-
-