Package org.testng.xml.internal
Class TestNamesMatcher
java.lang.Object
org.testng.xml.internal.TestNamesMatcher
The class to work with "-testnames", "-ignoreMissedTestNames", and VM argument
"-Dtestng.ignore.missed.testnames". If both "-ignoreMissedTestNames" and VM argument
"-Dtestng.ignore.missed.testnames" are set, then either of them has "true" value will enable the
feature to ingore partially missed test names and run those existing test names.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTestNamesMatcher
(XmlSuite xmlSuite, List<String> testNames) TestNamesMatcher
(XmlSuite xmlSuite, List<String> testNames, boolean ignoreMissedTestNames) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addIfNotNull
(XmlSuite xmlSuite) private static XmlSuite
cleanClone
(XmlSuite xmlSuite, List<XmlTest> tests) private void
cloneIfContainsTestsWithNamesMatchingAny
(XmlSuite xmlSuite, List<String> testNames) Recursive search the given testNames from the currentXmlSuite
and its child suites.private XmlSuite
boolean
Do validation for testNames and notify users if any testNames are missed in suite.
-
Field Details
-
LOGGER
-
cloneSuites
-
matchedTestNames
-
matchedTests
-
testNames
-
ignoreMissedTestNames
private final boolean ignoreMissedTestNames
-
-
Constructor Details
-
TestNamesMatcher
-
TestNamesMatcher
-
-
Method Details
-
cloneIfContainsTestsWithNamesMatchingAny
Recursive search the given testNames from the currentXmlSuite
and its child suites.- Parameters:
xmlSuite
- TheXmlSuite
to work with.testNames
- The list of testnames to iterate through
-
getSuitesMatchingTestNames
-
validateMissMatchedTestNames
public boolean validateMissMatchedTestNames()Do validation for testNames and notify users if any testNames are missed in suite. This method is also used to decide how to run test suite when test names are given. In legacy logic, if test names are given and exist in suite, then run them; if any of them do not exist in suite, then throw exception and exit. After ignoreMissedTestNames is introduced, if ignoreMissedTestNames is enabled, then any of the given test names exist in suite will be run, and print warning message to tell those test names do not exist in suite.- Returns:
- boolean if ignoreMissedTestNames disabled, then return true if no missed test names in suite, otherwise throw TestNGException; if ignoreMissedTestNames enabled, then return true if any test names exist in suite, otehrwise (all given test names are missed) throw TestNGException.
-
getMissedTestNames
-
getMatchedTests
-
addIfNotNull
-
cloneIfSuiteContainTestsWithNamesMatchingAny
-
cleanClone
-