Class TestNGMethodFinder

  • All Implemented Interfaces:
    ITestMethodFinder

    public class TestNGMethodFinder
    extends java.lang.Object
    implements ITestMethodFinder
    The default strategy for finding test methods: look up annotations @Test in front of methods.
    • Field Detail

      • NO_COMPARISON

        private static final java.util.Comparator<ITestNGMethod> NO_COMPARISON
      • runInfo

        private final RunInfo runInfo
      • comparator

        private final java.util.Comparator<ITestNGMethod> comparator
    • Method Detail

      • getTestMethods

        public ITestNGMethod[] getTestMethods​(java.lang.Class<?> clazz,
                                              XmlTest xmlTest)
        Specified by:
        getTestMethods in interface ITestMethodFinder
        Parameters:
        clazz - The test class
        xmlTest - The test node of xml
        Returns:
        All the applicable test methods.
      • getBeforeClassMethods

        public ITestNGMethod[] getBeforeClassMethods​(java.lang.Class<?> cls)
        Specified by:
        getBeforeClassMethods in interface ITestMethodFinder
        Parameters:
        cls - The test class
        Returns:
        All the methods that should be invoked after the test class has been created and before any of its test methods is invoked.
      • getAfterClassMethods

        public ITestNGMethod[] getAfterClassMethods​(java.lang.Class<?> cls)
        Specified by:
        getAfterClassMethods in interface ITestMethodFinder
        Parameters:
        cls - The test class
        Returns:
        All the methods that should be invoked after the test class has been created and after all its test methods have completed.
      • getBeforeTestMethods

        public ITestNGMethod[] getBeforeTestMethods​(java.lang.Class<?> cls)
        Specified by:
        getBeforeTestMethods in interface ITestMethodFinder
        Parameters:
        cls - The test class
        Returns:
        All the methods that should be invoked before a test method is invoked.
      • getAfterTestMethods

        public ITestNGMethod[] getAfterTestMethods​(java.lang.Class<?> cls)
        Specified by:
        getAfterTestMethods in interface ITestMethodFinder
        Parameters:
        cls - The test class
        Returns:
        All the methods that should be invoked after a test method completes.
      • getBeforeSuiteMethods

        public ITestNGMethod[] getBeforeSuiteMethods​(java.lang.Class<?> cls)
        Specified by:
        getBeforeSuiteMethods in interface ITestMethodFinder
        Parameters:
        cls - The test class
        Returns:
        All the methods that should be invoked before the suite starts running.
      • getAfterSuiteMethods

        public ITestNGMethod[] getAfterSuiteMethods​(java.lang.Class<?> cls)
        Specified by:
        getAfterSuiteMethods in interface ITestMethodFinder
        Parameters:
        cls - The test class
        Returns:
        All the methods that should be invoked after the suite has run all its tests.
      • shouldCreateBeforeAfterGroup

        private static boolean shouldCreateBeforeAfterGroup​(java.lang.String[] groups,
                                                            IAnnotationFinder finder,
                                                            java.lang.Class<?> clazz,
                                                            boolean isInheritGroups)
      • addConfigurationMethod

        private void addConfigurationMethod​(java.lang.Class<?> clazz,
                                            java.util.List<ITestNGMethod> results,
                                            java.lang.reflect.Method method,
                                            boolean isBeforeSuite,
                                            boolean isAfterSuite,
                                            boolean isBeforeTest,
                                            boolean isAfterTest,
                                            boolean isBeforeClass,
                                            boolean isAfterClass,
                                            boolean isBeforeTestMethod,
                                            boolean isAfterTestMethod,
                                            java.lang.String[] beforeGroups,
                                            java.lang.String[] afterGroups,
                                            java.lang.Object instance)