Class TestNamesMatcher

java.lang.Object
org.testng.xml.internal.TestNamesMatcher

public final class TestNamesMatcher extends Object
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.
  • Constructor Details

    • TestNamesMatcher

      public TestNamesMatcher(XmlSuite xmlSuite, List<String> testNames)
    • TestNamesMatcher

      public TestNamesMatcher(XmlSuite xmlSuite, List<String> testNames, boolean ignoreMissedTestNames)
  • Method Details

    • getSuitesMatchingTestNames

      public List<XmlSuite> 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

      public List<String> getMissedTestNames()
    • getMatchedTests

      public List<XmlTest> getMatchedTests()