Package org.testng.internal
Class ClonedMethod
- java.lang.Object
-
- org.testng.internal.ClonedMethod
-
- All Implemented Interfaces:
Cloneable
,ITestNGMethod
public class ClonedMethod extends Object implements ITestNGMethod
-
-
Constructor Summary
Constructors Constructor Description ClonedMethod(ITestNGMethod method, Method javaMethod)
-
Method Summary
-
-
-
Constructor Detail
-
ClonedMethod
public ClonedMethod(ITestNGMethod method, Method javaMethod)
-
-
Method Detail
-
addMethodDependedUpon
public void addMethodDependedUpon(String methodName)
- Specified by:
addMethodDependedUpon
in interfaceITestNGMethod
-
canRunFromClass
public boolean canRunFromClass(IClass testClass)
Description copied from interface:ITestNGMethod
Returns if this ITestNGMethod can be invoked from within IClass.- Specified by:
canRunFromClass
in interfaceITestNGMethod
-
getAfterGroups
public String[] getAfterGroups()
- Specified by:
getAfterGroups
in interfaceITestNGMethod
-
getBeforeGroups
public String[] getBeforeGroups()
Description copied from interface:ITestNGMethod
Before and After groups- Specified by:
getBeforeGroups
in interfaceITestNGMethod
-
getCurrentInvocationCount
public int getCurrentInvocationCount()
- Specified by:
getCurrentInvocationCount
in interfaceITestNGMethod
-
getDate
public long getDate()
- Specified by:
getDate
in interfaceITestNGMethod
-
getDescription
public String getDescription()
- Specified by:
getDescription
in interfaceITestNGMethod
-
setDescription
public void setDescription(String description)
- Specified by:
setDescription
in interfaceITestNGMethod
-
getEnabled
public boolean getEnabled()
- Specified by:
getEnabled
in interfaceITestNGMethod
-
getGroups
public String[] getGroups()
- Specified by:
getGroups
in interfaceITestNGMethod
- Returns:
- The groups this method belongs to, possibly added to the groups declared on the class.
-
getGroupsDependedUpon
public String[] getGroupsDependedUpon()
- Specified by:
getGroupsDependedUpon
in interfaceITestNGMethod
- Returns:
- The groups this method depends on, possibly added to the groups declared on the class.
-
getId
public String getId()
- Specified by:
getId
in interfaceITestNGMethod
- 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 interfaceITestNGMethod
-
getInstances
public Object[] getInstances()
- Specified by:
getInstances
in interfaceITestNGMethod
- Returns:
- All the instances the methods will be invoked upon. This will typically be an array of one object in the absence of an @Factory annotation.
-
getInstance
public Object getInstance()
- Specified by:
getInstance
in interfaceITestNGMethod
-
getInvocationCount
public int getInvocationCount()
- Specified by:
getInvocationCount
in interfaceITestNGMethod
- Returns:
- the number of times this method needs to be invoked.
-
getTotalInvocationCount
public int getTotalInvocationCount()
- Specified by:
getTotalInvocationCount
in interfaceITestNGMethod
- Returns:
- 0
-
getInvocationTimeOut
public long getInvocationTimeOut()
Description copied from interface:ITestNGMethod
The time under which all invocationCount methods need to complete by.- Specified by:
getInvocationTimeOut
in interfaceITestNGMethod
-
getMethod
public Method getMethod()
- Specified by:
getMethod
in interfaceITestNGMethod
- Returns:
- the corresponding Java test method.
-
getMethodName
public 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 interfaceITestNGMethod
- Returns:
- the method name.
-
getMethodsDependedUpon
public String[] getMethodsDependedUpon()
- Specified by:
getMethodsDependedUpon
in interfaceITestNGMethod
- Returns:
- The methods this method depends on, possibly added to the methods declared on the class.
-
getMissingGroup
public String getMissingGroup()
Description copied from interface:ITestNGMethod
If a group was not found.- Specified by:
getMissingGroup
in interfaceITestNGMethod
-
getParameterInvocationCount
public int getParameterInvocationCount()
- Specified by:
getParameterInvocationCount
in interfaceITestNGMethod
-
setMoreInvocationChecker
public void setMoreInvocationChecker(Callable<Boolean> moreInvocationChecker)
- Specified by:
setMoreInvocationChecker
in interfaceITestNGMethod
-
hasMoreInvocation
public boolean hasMoreInvocation()
- Specified by:
hasMoreInvocation
in interfaceITestNGMethod
-
getRealClass
public Class getRealClass()
- Specified by:
getRealClass
in 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:
getRetryAnalyzer
in interfaceITestNGMethod
-
getSuccessPercentage
public int getSuccessPercentage()
- Specified by:
getSuccessPercentage
in interfaceITestNGMethod
- Returns:
- the success percentage for this method (between 0 and 100).
-
getTestClass
public ITestClass getTestClass()
- Specified by:
getTestClass
in interfaceITestNGMethod
-
getThreadPoolSize
public int getThreadPoolSize()
- Specified by:
getThreadPoolSize
in interfaceITestNGMethod
- Returns:
- the number of threads to be used when invoking the method on parallel
-
getTimeOut
public long getTimeOut()
- Specified by:
getTimeOut
in interfaceITestNGMethod
- Returns:
- The timeout in milliseconds.
-
setTimeOut
public void setTimeOut(long timeOut)
- Specified by:
setTimeOut
in interfaceITestNGMethod
-
ignoreMissingDependencies
public boolean ignoreMissingDependencies()
- Specified by:
ignoreMissingDependencies
in interfaceITestNGMethod
-
incrementCurrentInvocationCount
public void incrementCurrentInvocationCount()
- Specified by:
incrementCurrentInvocationCount
in interfaceITestNGMethod
-
isAfterClassConfiguration
public boolean isAfterClassConfiguration()
- Specified by:
isAfterClassConfiguration
in interfaceITestNGMethod
- Returns:
- true if this method was annotated with @Configuration and beforeClassMethod = false
-
isAfterGroupsConfiguration
public boolean isAfterGroupsConfiguration()
- Specified by:
isAfterGroupsConfiguration
in interfaceITestNGMethod
-
isAfterMethodConfiguration
public boolean isAfterMethodConfiguration()
- Specified by:
isAfterMethodConfiguration
in interfaceITestNGMethod
- Returns:
- true if this method was annotated with @Configuration and beforeTestMethod = false
-
isAfterSuiteConfiguration
public boolean isAfterSuiteConfiguration()
- Specified by:
isAfterSuiteConfiguration
in interfaceITestNGMethod
- Returns:
- true if this method was annotated with @Configuration and afterSuite = true
-
isAfterTestConfiguration
public boolean isAfterTestConfiguration()
- Specified by:
isAfterTestConfiguration
in interfaceITestNGMethod
- Returns:
- true if this method is an @AfterTest (@Configuration afterTest=true)
-
isAlwaysRun
public boolean isAlwaysRun()
- Specified by:
isAlwaysRun
in interfaceITestNGMethod
- Returns:
- true if this method is alwaysRun=true
-
isBeforeClassConfiguration
public boolean isBeforeClassConfiguration()
- Specified by:
isBeforeClassConfiguration
in interfaceITestNGMethod
- Returns:
- true if this method was annotated with @Configuration and beforeClassMethod = true
-
isBeforeGroupsConfiguration
public boolean isBeforeGroupsConfiguration()
- Specified by:
isBeforeGroupsConfiguration
in interfaceITestNGMethod
-
isBeforeMethodConfiguration
public boolean isBeforeMethodConfiguration()
- Specified by:
isBeforeMethodConfiguration
in interfaceITestNGMethod
- Returns:
- true if this method was annotated with @Configuration and beforeTestMethod = true
-
isBeforeSuiteConfiguration
public boolean isBeforeSuiteConfiguration()
- Specified by:
isBeforeSuiteConfiguration
in interfaceITestNGMethod
- Returns:
- true if this method was annotated with @Configuration and beforeSuite = true
-
isBeforeTestConfiguration
public boolean isBeforeTestConfiguration()
- Specified by:
isBeforeTestConfiguration
in interfaceITestNGMethod
- Returns:
- true if this method is a @BeforeTest (@Configuration beforeTest=true)
-
isTest
public boolean isTest()
- Specified by:
isTest
in interfaceITestNGMethod
- Returns:
- true if this method was annotated with @Test
-
setDate
public void setDate(long date)
- Specified by:
setDate
in interfaceITestNGMethod
-
setId
public void setId(String id)
- Specified by:
setId
in interfaceITestNGMethod
-
setIgnoreMissingDependencies
public void setIgnoreMissingDependencies(boolean ignore)
- Specified by:
setIgnoreMissingDependencies
in interfaceITestNGMethod
-
setInvocationCount
public void setInvocationCount(int count)
- Specified by:
setInvocationCount
in interfaceITestNGMethod
-
setMissingGroup
public void setMissingGroup(String group)
- Specified by:
setMissingGroup
in interfaceITestNGMethod
-
setParameterInvocationCount
public void setParameterInvocationCount(int n)
- Specified by:
setParameterInvocationCount
in interfaceITestNGMethod
-
setRetryAnalyzer
public void setRetryAnalyzer(IRetryAnalyzer retryAnalyzer)
- Specified by:
setRetryAnalyzer
in interfaceITestNGMethod
-
setSkipFailedInvocations
public void setSkipFailedInvocations(boolean skip)
- Specified by:
setSkipFailedInvocations
in interfaceITestNGMethod
-
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 interfaceITestNGMethod
- Parameters:
cls
- The test class having this method.
-
setThreadPoolSize
public void setThreadPoolSize(int threadPoolSize)
- Specified by:
setThreadPoolSize
in interfaceITestNGMethod
-
skipFailedInvocations
public boolean skipFailedInvocations()
- Specified by:
skipFailedInvocations
in interfaceITestNGMethod
-
clone
public ClonedMethod clone()
- Specified by:
clone
in interfaceITestNGMethod
- Overrides:
clone
in classObject
-
getInvocationNumbers
public List<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 thetag. - Specified by:
getInvocationNumbers
in interfaceITestNGMethod
-
setInvocationNumbers
public void setInvocationNumbers(List<Integer> count)
- Specified by:
setInvocationNumbers
in interfaceITestNGMethod
-
getFailedInvocationNumbers
public List<Integer> getFailedInvocationNumbers()
- Specified by:
getFailedInvocationNumbers
in interfaceITestNGMethod
-
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 interfaceITestNGMethod
-
getPriority
public int getPriority()
Description copied from interface:ITestNGMethod
The scheduling priority. Lower priorities get scheduled first.- Specified by:
getPriority
in interfaceITestNGMethod
-
setPriority
public void setPriority(int priority)
- Specified by:
setPriority
in interfaceITestNGMethod
-
getXmlTest
public XmlTest getXmlTest()
- Specified by:
getXmlTest
in interfaceITestNGMethod
- Returns:
- the XmlTest this method belongs to.
-
getConstructorOrMethod
public ConstructorOrMethod getConstructorOrMethod()
- Specified by:
getConstructorOrMethod
in interfaceITestNGMethod
-
findMethodParameters
public Map<String,String> findMethodParameters(XmlTest test)
- Specified by:
findMethodParameters
in interfaceITestNGMethod
- Returns:
- the parameters found in the include tag, if any
-
getQualifiedName
public String getQualifiedName()
Description copied from interface:ITestNGMethod
getRealClass().getName() + "." + getMethodName()- Specified by:
getQualifiedName
in interfaceITestNGMethod
- Returns:
- qualified name for this method
-
-