Package org.testng.internal
Class ClonedMethod
- java.lang.Object
-
- org.testng.internal.ClonedMethod
-
- All Implemented Interfaces:
java.lang.Cloneable,ITestNGMethod
public class ClonedMethod extends java.lang.Object implements ITestNGMethod
-
-
Field Summary
Fields Modifier and Type Field Description private intm_currentInvocationCountprivate longm_dateprivate java.util.List<java.lang.Integer>m_failedInvocationNumbersprivate java.lang.Stringm_idprivate java.util.List<java.lang.Integer>m_invocationNumbersprivate java.lang.reflect.Methodm_javaMethodprivate ITestNGMethodm_method
-
Constructor Summary
Constructors Constructor Description ClonedMethod(ITestNGMethod method, java.lang.reflect.Method javaMethod)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFailedInvocationNumber(int number)The list of invocation numbers that failed, which is only applicable for methods that have a data provider.voidaddMethodDependedUpon(java.lang.String methodName)booleancanRunFromClass(IClass testClass)ClonedMethodclone()java.util.Map<java.lang.String,java.lang.String>findMethodParameters(XmlTest test)java.lang.String[]getAfterGroups()java.lang.String[]getBeforeGroups()ConstructorOrMethodgetConstructorOrMethod()intgetCurrentInvocationCount()longgetDate()java.lang.StringgetDescription()booleangetEnabled()java.util.List<java.lang.Integer>getFailedInvocationNumbers()java.lang.String[]getGroups()java.lang.String[]getGroupsDependedUpon()java.lang.StringgetId()java.lang.ObjectgetInstance()long[]getInstanceHashCodes()Needed for serialization.intgetInterceptedPriority()intgetInvocationCount()java.util.List<java.lang.Integer>getInvocationNumbers()Which invocation numbers of this method should be used (only applicable if it uses a data provider).longgetInvocationTimeOut()java.lang.StringgetMethodName()Returns the method name.java.lang.String[]getMethodsDependedUpon()java.lang.StringgetMissingGroup()intgetParameterInvocationCount()intgetPriority()The scheduling priority.java.lang.StringgetQualifiedName()getRealClass().getName() + "." + getMethodName()java.lang.ClassgetRealClass()IRetryAnalyzergetRetryAnalyzer()IRetryAnalyzergetRetryAnalyzer(ITestResult result)java.lang.Class<? extends IRetryAnalyzer>getRetryAnalyzerClass()intgetSuccessPercentage()ITestClassgetTestClass()intgetThreadPoolSize()longgetTimeOut()XmlTestgetXmlTest()booleanhasMoreInvocation()booleanignoreMissingDependencies()voidincrementCurrentInvocationCount()booleanisAfterClassConfiguration()booleanisAfterGroupsConfiguration()booleanisAfterMethodConfiguration()booleanisAfterSuiteConfiguration()booleanisAfterTestConfiguration()booleanisAlwaysRun()booleanisBeforeClassConfiguration()booleanisBeforeGroupsConfiguration()booleanisBeforeMethodConfiguration()booleanisBeforeSuiteConfiguration()booleanisBeforeTestConfiguration()booleanisTest()voidsetDate(long date)voidsetDescription(java.lang.String description)voidsetId(java.lang.String id)voidsetIgnoreMissingDependencies(boolean ignore)voidsetInterceptedPriority(int priority)voidsetInvocationCount(int count)voidsetInvocationNumbers(java.util.List<java.lang.Integer> count)voidsetMissingGroup(java.lang.String group)voidsetMoreInvocationChecker(java.util.concurrent.Callable<java.lang.Boolean> moreInvocationChecker)voidsetParameterInvocationCount(int n)voidsetPriority(int priority)voidsetRetryAnalyzer(IRetryAnalyzer retryAnalyzer)voidsetRetryAnalyzerClass(java.lang.Class<? extends IRetryAnalyzer> clazz)voidsetSkipFailedInvocations(boolean skip)voidsetTestClass(ITestClass cls)Sets the test class having this method.voidsetThreadPoolSize(int threadPoolSize)voidsetTimeOut(long timeOut)booleanskipFailedInvocations()java.lang.StringtoString()-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.testng.ITestNGMethod
getAttributes, getDataProviderMethod, getFactoryMethodParamsInfo, hasAfterGroupsConfiguration, hasBeforeGroupsConfiguration, isDataDriven
-
-
-
-
Field Detail
-
m_method
private final ITestNGMethod m_method
-
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
-
addMethodDependedUpon
public void addMethodDependedUpon(java.lang.String methodName)
- Specified by:
addMethodDependedUponin interfaceITestNGMethod
-
canRunFromClass
public boolean canRunFromClass(IClass testClass)
- Specified by:
canRunFromClassin interfaceITestNGMethod- Parameters:
testClass- The test class- Returns:
- true if this ITestNGMethod can be invoked from within IClass.
-
getAfterGroups
public java.lang.String[] getAfterGroups()
- Specified by:
getAfterGroupsin interfaceITestNGMethod
-
getBeforeGroups
public java.lang.String[] getBeforeGroups()
- Specified by:
getBeforeGroupsin interfaceITestNGMethod
-
getCurrentInvocationCount
public int getCurrentInvocationCount()
- Specified by:
getCurrentInvocationCountin interfaceITestNGMethod
-
getDate
public long getDate()
- Specified by:
getDatein interfaceITestNGMethod
-
getDescription
public java.lang.String getDescription()
- Specified by:
getDescriptionin interfaceITestNGMethod
-
setDescription
public void setDescription(java.lang.String description)
- Specified by:
setDescriptionin interfaceITestNGMethod
-
getEnabled
public boolean getEnabled()
- Specified by:
getEnabledin interfaceITestNGMethod
-
getGroups
public java.lang.String[] getGroups()
- Specified by:
getGroupsin interfaceITestNGMethod- Returns:
- The groups this method belongs to, possibly added to the groups declared on the class.
-
getGroupsDependedUpon
public java.lang.String[] getGroupsDependedUpon()
- Specified by:
getGroupsDependedUponin interfaceITestNGMethod- Returns:
- The groups this method depends on, possibly added to the groups declared on the class.
-
getId
public java.lang.String getId()
- Specified by:
getIdin interfaceITestNGMethod- Returns:
- The id of the thread this method was run in.
-
getInstanceHashCodes
public long[] getInstanceHashCodes()
Description copied from interface:ITestNGMethodNeeded for serialization.- Specified by:
getInstanceHashCodesin interfaceITestNGMethod- Returns:
- The hashcode of instances
-
getInstance
public java.lang.Object getInstance()
- Specified by:
getInstancein interfaceITestNGMethod
-
getInvocationCount
public int getInvocationCount()
- Specified by:
getInvocationCountin interfaceITestNGMethod- Returns:
- the number of times this method needs to be invoked.
-
getInvocationTimeOut
public long getInvocationTimeOut()
- Specified by:
getInvocationTimeOutin interfaceITestNGMethod- Returns:
- The time under which all invocationCount methods need to complete by.
-
getMethodName
public java.lang.String getMethodName()
Description copied from interface:ITestNGMethodReturns the method name. This is needed for serialization because methods are not Serializable.- Specified by:
getMethodNamein interfaceITestNGMethod- Returns:
- the method name.
-
getMethodsDependedUpon
public java.lang.String[] getMethodsDependedUpon()
- Specified by:
getMethodsDependedUponin interfaceITestNGMethod- Returns:
- The methods this method depends on, possibly added to the methods declared on the class.
-
getMissingGroup
public java.lang.String getMissingGroup()
- Specified by:
getMissingGroupin interfaceITestNGMethod- Returns:
- If a group was not found.
-
getParameterInvocationCount
public int getParameterInvocationCount()
- Specified by:
getParameterInvocationCountin interfaceITestNGMethod
-
setMoreInvocationChecker
public void setMoreInvocationChecker(java.util.concurrent.Callable<java.lang.Boolean> moreInvocationChecker)
- Specified by:
setMoreInvocationCheckerin interfaceITestNGMethod
-
hasMoreInvocation
public boolean hasMoreInvocation()
- Specified by:
hasMoreInvocationin interfaceITestNGMethod
-
getRealClass
public java.lang.Class getRealClass()
- Specified by:
getRealClassin interfaceITestNGMethod- 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).
-
getRetryAnalyzer
public IRetryAnalyzer getRetryAnalyzer()
- Specified by:
getRetryAnalyzerin interfaceITestNGMethod- Returns:
- The retry analyzer
-
getRetryAnalyzer
public IRetryAnalyzer getRetryAnalyzer(ITestResult result)
- Specified by:
getRetryAnalyzerin interfaceITestNGMethod
-
setRetryAnalyzerClass
public void setRetryAnalyzerClass(java.lang.Class<? extends IRetryAnalyzer> clazz)
- Specified by:
setRetryAnalyzerClassin interfaceITestNGMethod
-
getRetryAnalyzerClass
public java.lang.Class<? extends IRetryAnalyzer> getRetryAnalyzerClass()
- Specified by:
getRetryAnalyzerClassin interfaceITestNGMethod
-
getSuccessPercentage
public int getSuccessPercentage()
- Specified by:
getSuccessPercentagein interfaceITestNGMethod- Returns:
- the success percentage for this method (between 0 and 100).
-
getTestClass
public ITestClass getTestClass()
- Specified by:
getTestClassin interfaceITestNGMethod
-
getThreadPoolSize
public int getThreadPoolSize()
- Specified by:
getThreadPoolSizein interfaceITestNGMethod- Returns:
- the number of threads to be used when invoking the method on parallel
-
getTimeOut
public long getTimeOut()
- Specified by:
getTimeOutin interfaceITestNGMethod- Returns:
- The timeout in milliseconds.
-
setTimeOut
public void setTimeOut(long timeOut)
- Specified by:
setTimeOutin interfaceITestNGMethod
-
ignoreMissingDependencies
public boolean ignoreMissingDependencies()
- Specified by:
ignoreMissingDependenciesin interfaceITestNGMethod
-
incrementCurrentInvocationCount
public void incrementCurrentInvocationCount()
- Specified by:
incrementCurrentInvocationCountin interfaceITestNGMethod
-
isAfterClassConfiguration
public boolean isAfterClassConfiguration()
- Specified by:
isAfterClassConfigurationin interfaceITestNGMethod- Returns:
- true if this method was annotated with @Configuration and beforeClassMethod = false
-
isAfterGroupsConfiguration
public boolean isAfterGroupsConfiguration()
- Specified by:
isAfterGroupsConfigurationin interfaceITestNGMethod
-
isAfterMethodConfiguration
public boolean isAfterMethodConfiguration()
- Specified by:
isAfterMethodConfigurationin interfaceITestNGMethod- Returns:
- true if this method was annotated with @Configuration and beforeTestMethod = false
-
isAfterSuiteConfiguration
public boolean isAfterSuiteConfiguration()
- Specified by:
isAfterSuiteConfigurationin interfaceITestNGMethod- Returns:
- true if this method was annotated with @Configuration and afterSuite = true
-
isAfterTestConfiguration
public boolean isAfterTestConfiguration()
- Specified by:
isAfterTestConfigurationin interfaceITestNGMethod- Returns:
trueif this method is an @AfterTest (@Configuration afterTest=true)
-
isAlwaysRun
public boolean isAlwaysRun()
- Specified by:
isAlwaysRunin interfaceITestNGMethod- Returns:
- true if this method is alwaysRun=true
-
isBeforeClassConfiguration
public boolean isBeforeClassConfiguration()
- Specified by:
isBeforeClassConfigurationin interfaceITestNGMethod- Returns:
- true if this method was annotated with @Configuration and beforeClassMethod = true
-
isBeforeGroupsConfiguration
public boolean isBeforeGroupsConfiguration()
- Specified by:
isBeforeGroupsConfigurationin interfaceITestNGMethod
-
isBeforeMethodConfiguration
public boolean isBeforeMethodConfiguration()
- Specified by:
isBeforeMethodConfigurationin interfaceITestNGMethod- Returns:
- true if this method was annotated with @Configuration and beforeTestMethod = true
-
isBeforeSuiteConfiguration
public boolean isBeforeSuiteConfiguration()
- Specified by:
isBeforeSuiteConfigurationin interfaceITestNGMethod- Returns:
- true if this method was annotated with @Configuration and beforeSuite = true
-
isBeforeTestConfiguration
public boolean isBeforeTestConfiguration()
- Specified by:
isBeforeTestConfigurationin interfaceITestNGMethod- Returns:
trueif this method is a @BeforeTest (@Configuration beforeTest=true)
-
isTest
public boolean isTest()
- Specified by:
isTestin interfaceITestNGMethod- Returns:
- true if this method was annotated with @Test
-
setDate
public void setDate(long date)
- Specified by:
setDatein interfaceITestNGMethod
-
setId
public void setId(java.lang.String id)
- Specified by:
setIdin interfaceITestNGMethod
-
setIgnoreMissingDependencies
public void setIgnoreMissingDependencies(boolean ignore)
- Specified by:
setIgnoreMissingDependenciesin interfaceITestNGMethod
-
setInvocationCount
public void setInvocationCount(int count)
- Specified by:
setInvocationCountin interfaceITestNGMethod
-
setMissingGroup
public void setMissingGroup(java.lang.String group)
- Specified by:
setMissingGroupin interfaceITestNGMethod
-
setParameterInvocationCount
public void setParameterInvocationCount(int n)
- Specified by:
setParameterInvocationCountin interfaceITestNGMethod
-
setRetryAnalyzer
public void setRetryAnalyzer(IRetryAnalyzer retryAnalyzer)
- Specified by:
setRetryAnalyzerin interfaceITestNGMethod- Parameters:
retryAnalyzer- The retry analyzer
-
setSkipFailedInvocations
public void setSkipFailedInvocations(boolean skip)
- Specified by:
setSkipFailedInvocationsin interfaceITestNGMethod
-
setTestClass
public void setTestClass(ITestClass cls)
Description copied from interface:ITestNGMethodSets the test class having this method. This is not necessarily the declaring class.- Specified by:
setTestClassin interfaceITestNGMethod- Parameters:
cls- The test class having this method.
-
setThreadPoolSize
public void setThreadPoolSize(int threadPoolSize)
- Specified by:
setThreadPoolSizein interfaceITestNGMethod
-
skipFailedInvocations
public boolean skipFailedInvocations()
- Specified by:
skipFailedInvocationsin interfaceITestNGMethod
-
clone
public ClonedMethod clone()
- Specified by:
clonein interfaceITestNGMethod- Overrides:
clonein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getInvocationNumbers
public java.util.List<java.lang.Integer> getInvocationNumbers()
Description copied from interface:ITestNGMethodWhich 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:
getInvocationNumbersin interfaceITestNGMethod- Returns:
- The list of invocation numbers
-
setInvocationNumbers
public void setInvocationNumbers(java.util.List<java.lang.Integer> count)
- Specified by:
setInvocationNumbersin interfaceITestNGMethod
-
getFailedInvocationNumbers
public java.util.List<java.lang.Integer> getFailedInvocationNumbers()
- Specified by:
getFailedInvocationNumbersin interfaceITestNGMethod
-
addFailedInvocationNumber
public void addFailedInvocationNumber(int number)
Description copied from interface:ITestNGMethodThe list of invocation numbers that failed, which is only applicable for methods that have a data provider.- Specified by:
addFailedInvocationNumberin interfaceITestNGMethod- Parameters:
number- The invocation number that failed
-
getPriority
public int getPriority()
Description copied from interface:ITestNGMethodThe scheduling priority. Lower priorities get scheduled first.- Specified by:
getPriorityin interfaceITestNGMethod- Returns:
- The priority value
-
setPriority
public void setPriority(int priority)
- Specified by:
setPriorityin interfaceITestNGMethod
-
getInterceptedPriority
public int getInterceptedPriority()
- Specified by:
getInterceptedPriorityin interfaceITestNGMethod
-
setInterceptedPriority
public void setInterceptedPriority(int priority)
- Specified by:
setInterceptedPriorityin interfaceITestNGMethod
-
getXmlTest
public XmlTest getXmlTest()
- Specified by:
getXmlTestin interfaceITestNGMethod- Returns:
- the XmlTest this method belongs to.
-
getConstructorOrMethod
public ConstructorOrMethod getConstructorOrMethod()
- Specified by:
getConstructorOrMethodin interfaceITestNGMethod
-
findMethodParameters
public java.util.Map<java.lang.String,java.lang.String> findMethodParameters(XmlTest test)
- Specified by:
findMethodParametersin interfaceITestNGMethod- Parameters:
test- - TheXmlTestobject.- Returns:
- the parameters found in the include tag, if any
-
getQualifiedName
public java.lang.String getQualifiedName()
Description copied from interface:ITestNGMethodgetRealClass().getName() + "." + getMethodName()- Specified by:
getQualifiedNamein interfaceITestNGMethod- Returns:
- qualified name for this method
-
-