Class TestNamesMatcher


  • public final class TestNamesMatcher
    extends java.lang.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 Detail

      • TestNamesMatcher

        public TestNamesMatcher​(XmlSuite xmlSuite,
                                java.util.List<java.lang.String> testNames)
      • TestNamesMatcher

        public TestNamesMatcher​(XmlSuite xmlSuite,
                                java.util.List<java.lang.String> testNames,
                                boolean ignoreMissedTestNames)
    • Method Detail

      • getSuitesMatchingTestNames

        public java.util.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 java.util.List<java.lang.String> getMissedTestNames()
      • getMatchedTests

        public java.util.List<XmlTest> getMatchedTests()