Class ClonedMethod

  • All Implemented Interfaces:
    java.lang.Cloneable, ITestNGMethod

    public class ClonedMethod
    extends java.lang.Object
    implements ITestNGMethod
    • Field Detail

      • m_javaMethod

        private final java.lang.reflect.Method m_javaMethod
      • m_id

        private java.lang.String m_id
      • m_currentInvocationCount

        private int m_currentInvocationCount
      • m_date

        private long m_date
      • m_invocationNumbers

        private java.util.List<java.lang.Integer> m_invocationNumbers
      • m_failedInvocationNumbers

        private java.util.List<java.lang.Integer> m_failedInvocationNumbers
    • Constructor Detail

      • ClonedMethod

        public ClonedMethod​(ITestNGMethod method,
                            java.lang.reflect.Method javaMethod)
    • Method Detail

      • canRunFromClass

        public boolean canRunFromClass​(IClass testClass)
        Specified by:
        canRunFromClass in interface ITestNGMethod
        Parameters:
        testClass - The test class
        Returns:
        true if this ITestNGMethod can be invoked from within IClass.
      • setDescription

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

        public java.lang.String[] getGroups()
        Specified by:
        getGroups in interface ITestNGMethod
        Returns:
        The groups this method belongs to, possibly added to the groups declared on the class.
      • 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.
      • getId

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

        public long[] getInstanceHashCodes()
        Description copied from interface: ITestNGMethod
        Needed for serialization.
        Specified by:
        getInstanceHashCodes in interface ITestNGMethod
        Returns:
        The hashcode of instances
      • getInvocationCount

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

        public long getInvocationTimeOut()
        Specified by:
        getInvocationTimeOut in interface ITestNGMethod
        Returns:
        The time under which all invocationCount methods need to complete by.
      • getMethodName

        public java.lang.String getMethodName()
        Description copied from interface: ITestNGMethod
        Returns the method name. This is needed for serialization because methods are not Serializable.
        Specified by:
        getMethodName in interface ITestNGMethod
        Returns:
        the method name.
      • 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.
      • getMissingGroup

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

        public void setMoreInvocationChecker​(java.util.concurrent.Callable<java.lang.Boolean> moreInvocationChecker)
        Specified by:
        setMoreInvocationChecker in interface ITestNGMethod
      • 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).
      • getSuccessPercentage

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • 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 <include invocationNumbers="..."> tag.
        Specified by:
        getInvocationNumbers in interface ITestNGMethod
        Returns:
        The list of invocation numbers
      • setInvocationNumbers

        public void setInvocationNumbers​(java.util.List<java.lang.Integer> count)
        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
        Parameters:
        number - The invocation number that failed
      • getPriority

        public int getPriority()
        Description copied from interface: ITestNGMethod
        The scheduling priority. Lower priorities get scheduled first.
        Specified by:
        getPriority in interface ITestNGMethod
        Returns:
        The priority value
      • 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