Class BaseTestMethod

    • Field Detail

      • m_testClass

        protected ITestClass m_testClass
        The test class on which the test method was found. Note that this is not necessarily the declaring class.
      • m_methodClass

        protected final java.lang.Class<?> m_methodClass
      • m_id

        protected java.lang.String m_id
      • m_date

        protected long m_date
      • m_groups

        protected java.lang.String[] m_groups
      • m_groupsDependedUpon

        protected java.lang.String[] m_groupsDependedUpon
      • m_methodsDependedUpon

        protected java.lang.String[] m_methodsDependedUpon
      • m_beforeGroups

        protected java.lang.String[] m_beforeGroups
      • m_afterGroups

        protected java.lang.String[] m_afterGroups
      • m_currentInvocationCount

        protected java.util.concurrent.atomic.AtomicInteger m_currentInvocationCount
    • Method Detail

      • isAlwaysRun

        public boolean isAlwaysRun()
        Specified by:
        isAlwaysRun in interface ITestNGMethod
        Returns:
        true if this method is alwaysRun=true
      • setAlwaysRun

        protected void setAlwaysRun​(boolean alwaysRun)
      • getRealClass

        public java.lang.Class<?> getRealClass()
        Specified by:
        getRealClass in interface ITestNGMethod
        Returns:
        The real class on which this method was declared (can be different from getMethod().getDeclaringClass() if the test method was defined in a superclass).
      • setTestClass

        public void setTestClass​(ITestClass tc)
        Sets the test class having this method. This is not necessarily the declaring class.
        Specified by:
        setTestClass in interface ITestNGMethod
        Parameters:
        tc - The test class having this method.
      • getMethodName

        public java.lang.String getMethodName()
        Returns the method name. This is needed for serialization because methods are not Serializable.
        Specified by:
        getMethodName in interface ITestNGMethod
        Returns:
        the method name.
      • getGroups

        public java.lang.String[] getGroups()
        Specified by:
        getGroups in interface ITestNGMethod
        Returns:
        the addition of groups defined on the class and on this method.
      • getGroupsDependedUpon

        public java.lang.String[] getGroupsDependedUpon()
        Specified by:
        getGroupsDependedUpon in interface ITestNGMethod
        Returns:
        The groups this method depends on, possibly added to the groups declared on the class.
      • getMethodsDependedUpon

        public java.lang.String[] getMethodsDependedUpon()
        Specified by:
        getMethodsDependedUpon in interface ITestNGMethod
        Returns:
        The methods this method depends on, possibly added to the methods declared on the class.
      • isTest

        public boolean isTest()
        Specified by:
        isTest in interface ITestNGMethod
        Returns:
        true if this method was annotated with @Test
      • isBeforeSuiteConfiguration

        public boolean isBeforeSuiteConfiguration()
        Specified by:
        isBeforeSuiteConfiguration in interface ITestNGMethod
        Returns:
        true if this method was annotated with @Configuration and beforeSuite = true
      • isAfterSuiteConfiguration

        public boolean isAfterSuiteConfiguration()
        Specified by:
        isAfterSuiteConfiguration in interface ITestNGMethod
        Returns:
        true if this method was annotated with @Configuration and afterSuite = true
      • isBeforeTestConfiguration

        public boolean isBeforeTestConfiguration()
        Specified by:
        isBeforeTestConfiguration in interface ITestNGMethod
        Returns:
        true if this method is a @BeforeTest (@Configuration beforeTest=true)
      • isAfterTestConfiguration

        public boolean isAfterTestConfiguration()
        Specified by:
        isAfterTestConfiguration in interface ITestNGMethod
        Returns:
        true if this method is an @AfterTest (@Configuration afterTest=true)
      • isBeforeClassConfiguration

        public boolean isBeforeClassConfiguration()
        Specified by:
        isBeforeClassConfiguration in interface ITestNGMethod
        Returns:
        true if this method was annotated with @Configuration and beforeClassMethod = true
      • isAfterClassConfiguration

        public boolean isAfterClassConfiguration()
        Specified by:
        isAfterClassConfiguration in interface ITestNGMethod
        Returns:
        true if this method was annotated with @Configuration and beforeClassMethod = false
      • isBeforeMethodConfiguration

        public boolean isBeforeMethodConfiguration()
        Specified by:
        isBeforeMethodConfiguration in interface ITestNGMethod
        Returns:
        true if this method was annotated with @Configuration and beforeTestMethod = true
      • isAfterMethodConfiguration

        public boolean isAfterMethodConfiguration()
        Specified by:
        isAfterMethodConfiguration in interface ITestNGMethod
        Returns:
        true if this method was annotated with @Configuration and beforeTestMethod = false
      • getTimeOut

        public long getTimeOut()
        Specified by:
        getTimeOut in interface ITestNGMethod
        Returns:
        The timeout in milliseconds.
      • getInvocationCount

        public int getInvocationCount()
        Specified by:
        getInvocationCount in interface ITestNGMethod
        Returns:
        the number of times this method needs to be invoked.
      • getSuccessPercentage

        public int getSuccessPercentage()
        Default value for successPercentage.
        Specified by:
        getSuccessPercentage in interface ITestNGMethod
        Returns:
        the success percentage for this method (between 0 and 100).
      • getId

        public java.lang.String getId()
        Specified by:
        getId in interface ITestNGMethod
        Returns:
        The id of the thread this method was run in.
      • setId

        public void setId​(java.lang.String id)
        Specified by:
        setId in interface ITestNGMethod
      • getDate

        public long getDate()
        Specified by:
        getDate in interface ITestNGMethod
        Returns:
        Returns the date.
      • setDate

        public void setDate​(long date)
        Specified by:
        setDate in interface ITestNGMethod
        Parameters:
        date - The date to set.
      • canRunFromClass

        public boolean canRunFromClass​(IClass testClass)
        Returns if this ITestNGMethod can be invoked from within IClass.
        Specified by:
        canRunFromClass in interface ITestNGMethod
      • equals

        public boolean equals​(java.lang.Object obj)
        Compares two BaseTestMethod using the test class then the associated Java Method.
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        This implementation returns the associated Java Method's hash code.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the associated Java Method's hash code.
      • initGroups

        protected void initGroups​(java.lang.Class<? extends ITestOrConfiguration> annotationClass)
      • initBeforeAfterGroups

        protected void initBeforeAfterGroups​(java.lang.Class<? extends ITestOrConfiguration> annotationClass,
                                             java.lang.String[] groups)
      • getIClass

        protected IClass getIClass()
      • getSimpleName

        public java.lang.String getSimpleName()
      • getSignature

        protected java.lang.String getSignature()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getStringArray

        protected java.lang.String[] getStringArray​(java.lang.String[] methodArray,
                                                    java.lang.String[] classArray)
      • setGroups

        protected void setGroups​(java.lang.String[] groups)
      • setGroupsDependedUpon

        protected void setGroupsDependedUpon​(java.lang.String[] groups,
                                             java.util.Collection<java.lang.String> xmlGroupDependencies)
      • setMethodsDependedUpon

        protected void setMethodsDependedUpon​(java.lang.String[] methods)
      • getMissingGroup

        public java.lang.String getMissingGroup()
        If a group was not found.
        Specified by:
        getMissingGroup in interface ITestNGMethod
      • getThreadPoolSize

        public int getThreadPoolSize()
        Specified by:
        getThreadPoolSize in interface ITestNGMethod
        Returns:
        the number of threads to be used when invoking the method on parallel
      • setDescription

        public void setDescription​(java.lang.String description)
        Specified by:
        setDescription in interface ITestNGMethod
      • setEnabled

        public void setEnabled​(boolean enabled)
      • getBeforeGroups

        public java.lang.String[] getBeforeGroups()
        Before and After groups
        Specified by:
        getBeforeGroups in interface ITestNGMethod
      • setMoreInvocationChecker

        public void setMoreInvocationChecker​(java.util.concurrent.Callable<java.lang.Boolean> moreInvocationChecker)
        Specified by:
        setMoreInvocationChecker in interface ITestNGMethod
      • setInvocationTimeOut

        public void setInvocationTimeOut​(long timeOut)
      • getInvocationTimeOut

        public long getInvocationTimeOut()
        Description copied from interface: ITestNGMethod
        The time under which all invocationCount methods need to complete by.
        Specified by:
        getInvocationTimeOut in interface ITestNGMethod
      • getInvocationNumbers

        public java.util.List<java.lang.Integer> getInvocationNumbers()
        Description copied from interface: ITestNGMethod
        Which invocation numbers of this method should be used (only applicable if it uses a data provider). If this value is an empty list, use all the values returned from the data provider. These values are read from the XML file in the tag.
        Specified by:
        getInvocationNumbers in interface ITestNGMethod
      • setInvocationNumbers

        public void setInvocationNumbers​(java.util.List<java.lang.Integer> numbers)
        Specified by:
        setInvocationNumbers in interface ITestNGMethod
      • addFailedInvocationNumber

        public void addFailedInvocationNumber​(int number)
        Description copied from interface: ITestNGMethod
        The list of invocation numbers that failed, which is only applicable for methods that have a data provider.
        Specified by:
        addFailedInvocationNumber in interface ITestNGMethod
      • getPriority

        public int getPriority()
        Description copied from interface: ITestNGMethod
        The scheduling priority. Lower priorities get scheduled first.
        Specified by:
        getPriority in interface ITestNGMethod
      • setXmlTest

        public void setXmlTest​(XmlTest xmlTest)
      • findMethodParameters

        public java.util.Map<java.lang.String,​java.lang.String> findMethodParameters​(XmlTest test)
        Specified by:
        findMethodParameters in interface ITestNGMethod
        Parameters:
        test - - The XmlTest object.
        Returns:
        the parameters found in the include tag, if any
      • getQualifiedName

        public java.lang.String getQualifiedName()
        Description copied from interface: ITestNGMethod
        getRealClass().getName() + "." + getMethodName()
        Specified by:
        getQualifiedName in interface ITestNGMethod
        Returns:
        qualified name for this method