Package org.testng.internal
Class WrappedTestNGMethod
- java.lang.Object
-
- org.testng.internal.WrappedTestNGMethod
-
- All Implemented Interfaces:
Cloneable,ITestNGMethod
public class WrappedTestNGMethod extends Object implements ITestNGMethod
Represents a proxy for an actual instance ofITestNGMethodbut with the exception that it generates a unique hashcode that is different from the originalITestNGMethodinstance that it wraps.
-
-
Constructor Summary
Constructors Constructor Description WrappedTestNGMethod(ITestNGMethod testNGMethod)
-
Method Summary
-
-
-
Constructor Detail
-
WrappedTestNGMethod
public WrappedTestNGMethod(ITestNGMethod testNGMethod)
-
-
Method Detail
-
getRealClass
public 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).
-
getTestClass
public ITestClass getTestClass()
- Specified by:
getTestClassin 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.
-
getMethod
public Method getMethod()
- Specified by:
getMethodin interfaceITestNGMethod- Returns:
- the corresponding Java test method.
-
getMethodName
public 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.
-
getInstances
public Object[] getInstances()
- Specified by:
getInstancesin 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:
getInstancein interfaceITestNGMethod
-
getInstanceHashCodes
public long[] getInstanceHashCodes()
Description copied from interface:ITestNGMethodNeeded for serialization.- Specified by:
getInstanceHashCodesin interfaceITestNGMethod
-
getGroups
public String[] getGroups()
- Specified by:
getGroupsin interfaceITestNGMethod- Returns:
- The groups this method belongs to, possibly added to the groups declared on the class.
-
getGroupsDependedUpon
public String[] getGroupsDependedUpon()
- Specified by:
getGroupsDependedUponin interfaceITestNGMethod- Returns:
- The groups this method depends on, possibly added to the groups declared on the class.
-
getMissingGroup
public String getMissingGroup()
Description copied from interface:ITestNGMethodIf a group was not found.- Specified by:
getMissingGroupin interfaceITestNGMethod
-
setMissingGroup
public void setMissingGroup(String group)
- Specified by:
setMissingGroupin interfaceITestNGMethod
-
getBeforeGroups
public String[] getBeforeGroups()
Description copied from interface:ITestNGMethodBefore and After groups- Specified by:
getBeforeGroupsin interfaceITestNGMethod
-
getAfterGroups
public String[] getAfterGroups()
- Specified by:
getAfterGroupsin interfaceITestNGMethod
-
getMethodsDependedUpon
public String[] getMethodsDependedUpon()
- Specified by:
getMethodsDependedUponin interfaceITestNGMethod- Returns:
- The methods this method depends on, possibly added to the methods declared on the class.
-
addMethodDependedUpon
public void addMethodDependedUpon(String methodName)
- Specified by:
addMethodDependedUponin interfaceITestNGMethod
-
isTest
public boolean isTest()
- Specified by:
isTestin interfaceITestNGMethod- Returns:
- true if this method was annotated with @Test
-
isBeforeMethodConfiguration
public boolean isBeforeMethodConfiguration()
- Specified by:
isBeforeMethodConfigurationin interfaceITestNGMethod- Returns:
- true if this method was annotated with @Configuration and beforeTestMethod = true
-
isAfterMethodConfiguration
public boolean isAfterMethodConfiguration()
- Specified by:
isAfterMethodConfigurationin interfaceITestNGMethod- Returns:
- true if this method was annotated with @Configuration and beforeTestMethod = false
-
isBeforeClassConfiguration
public boolean isBeforeClassConfiguration()
- Specified by:
isBeforeClassConfigurationin interfaceITestNGMethod- Returns:
- true if this method was annotated with @Configuration and beforeClassMethod = true
-
isAfterClassConfiguration
public boolean isAfterClassConfiguration()
- Specified by:
isAfterClassConfigurationin interfaceITestNGMethod- Returns:
- true if this method was annotated with @Configuration and beforeClassMethod = false
-
isBeforeSuiteConfiguration
public boolean isBeforeSuiteConfiguration()
- Specified by:
isBeforeSuiteConfigurationin interfaceITestNGMethod- Returns:
- true if this method was annotated with @Configuration and beforeSuite = true
-
isAfterSuiteConfiguration
public boolean isAfterSuiteConfiguration()
- Specified by:
isAfterSuiteConfigurationin interfaceITestNGMethod- Returns:
- true if this method was annotated with @Configuration and afterSuite = true
-
isBeforeTestConfiguration
public boolean isBeforeTestConfiguration()
- Specified by:
isBeforeTestConfigurationin interfaceITestNGMethod- Returns:
- true if this method is a @BeforeTest (@Configuration beforeTest=true)
-
isAfterTestConfiguration
public boolean isAfterTestConfiguration()
- Specified by:
isAfterTestConfigurationin interfaceITestNGMethod- Returns:
- true if this method is an @AfterTest (@Configuration afterTest=true)
-
isBeforeGroupsConfiguration
public boolean isBeforeGroupsConfiguration()
- Specified by:
isBeforeGroupsConfigurationin interfaceITestNGMethod
-
isAfterGroupsConfiguration
public boolean isAfterGroupsConfiguration()
- Specified by:
isAfterGroupsConfigurationin interfaceITestNGMethod
-
getTimeOut
public long getTimeOut()
- Specified by:
getTimeOutin interfaceITestNGMethod- Returns:
- The timeout in milliseconds.
-
setTimeOut
public void setTimeOut(long timeOut)
- Specified by:
setTimeOutin interfaceITestNGMethod
-
getInvocationCount
public int getInvocationCount()
- Specified by:
getInvocationCountin interfaceITestNGMethod- Returns:
- the number of times this method needs to be invoked.
-
setInvocationCount
public void setInvocationCount(int count)
- Specified by:
setInvocationCountin interfaceITestNGMethod
-
getTotalInvocationCount
public int getTotalInvocationCount()
- Specified by:
getTotalInvocationCountin interfaceITestNGMethod- Returns:
- 0
-
getSuccessPercentage
public int getSuccessPercentage()
- Specified by:
getSuccessPercentagein interfaceITestNGMethod- Returns:
- the success percentage for this method (between 0 and 100).
-
getId
public String getId()
- Specified by:
getIdin interfaceITestNGMethod- Returns:
- The id of the thread this method was run in.
-
setId
public void setId(String id)
- Specified by:
setIdin interfaceITestNGMethod
-
getDate
public long getDate()
- Specified by:
getDatein interfaceITestNGMethod
-
setDate
public void setDate(long date)
- Specified by:
setDatein interfaceITestNGMethod
-
canRunFromClass
public boolean canRunFromClass(IClass testClass)
Description copied from interface:ITestNGMethodReturns if this ITestNGMethod can be invoked from within IClass.- Specified by:
canRunFromClassin interfaceITestNGMethod
-
isAlwaysRun
public boolean isAlwaysRun()
- Specified by:
isAlwaysRunin interfaceITestNGMethod- Returns:
- true if this method is alwaysRun=true
-
getThreadPoolSize
public int getThreadPoolSize()
- Specified by:
getThreadPoolSizein interfaceITestNGMethod- Returns:
- the number of threads to be used when invoking the method on parallel
-
setThreadPoolSize
public void setThreadPoolSize(int threadPoolSize)
- Specified by:
setThreadPoolSizein interfaceITestNGMethod
-
getEnabled
public boolean getEnabled()
- Specified by:
getEnabledin interfaceITestNGMethod
-
getDescription
public String getDescription()
- Specified by:
getDescriptionin interfaceITestNGMethod
-
setDescription
public void setDescription(String description)
- Specified by:
setDescriptionin interfaceITestNGMethod
-
incrementCurrentInvocationCount
public void incrementCurrentInvocationCount()
- Specified by:
incrementCurrentInvocationCountin interfaceITestNGMethod
-
getCurrentInvocationCount
public int getCurrentInvocationCount()
- Specified by:
getCurrentInvocationCountin interfaceITestNGMethod
-
setParameterInvocationCount
public void setParameterInvocationCount(int n)
- Specified by:
setParameterInvocationCountin interfaceITestNGMethod
-
getParameterInvocationCount
public int getParameterInvocationCount()
- Specified by:
getParameterInvocationCountin interfaceITestNGMethod
-
setMoreInvocationChecker
public void setMoreInvocationChecker(Callable<Boolean> moreInvocationChecker)
- Specified by:
setMoreInvocationCheckerin interfaceITestNGMethod
-
hasMoreInvocation
public boolean hasMoreInvocation()
- Specified by:
hasMoreInvocationin interfaceITestNGMethod
-
clone
public ITestNGMethod clone()
- Specified by:
clonein interfaceITestNGMethod- Overrides:
clonein classObject
-
getRetryAnalyzer
public IRetryAnalyzer getRetryAnalyzer()
- Specified by:
getRetryAnalyzerin interfaceITestNGMethod
-
setRetryAnalyzer
public void setRetryAnalyzer(IRetryAnalyzer retryAnalyzer)
- Specified by:
setRetryAnalyzerin interfaceITestNGMethod
-
skipFailedInvocations
public boolean skipFailedInvocations()
- Specified by:
skipFailedInvocationsin interfaceITestNGMethod
-
setSkipFailedInvocations
public void setSkipFailedInvocations(boolean skip)
- Specified by:
setSkipFailedInvocationsin interfaceITestNGMethod
-
getInvocationTimeOut
public long getInvocationTimeOut()
Description copied from interface:ITestNGMethodThe time under which all invocationCount methods need to complete by.- Specified by:
getInvocationTimeOutin interfaceITestNGMethod
-
ignoreMissingDependencies
public boolean ignoreMissingDependencies()
- Specified by:
ignoreMissingDependenciesin interfaceITestNGMethod
-
setIgnoreMissingDependencies
public void setIgnoreMissingDependencies(boolean ignore)
- Specified by:
setIgnoreMissingDependenciesin interfaceITestNGMethod
-
getInvocationNumbers
public List<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 thetag. - Specified by:
getInvocationNumbersin interfaceITestNGMethod
-
setInvocationNumbers
public void setInvocationNumbers(List<Integer> numbers)
- Specified by:
setInvocationNumbersin 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
-
getFailedInvocationNumbers
public List<Integer> getFailedInvocationNumbers()
- Specified by:
getFailedInvocationNumbersin interfaceITestNGMethod
-
getPriority
public int getPriority()
Description copied from interface:ITestNGMethodThe scheduling priority. Lower priorities get scheduled first.- Specified by:
getPriorityin interfaceITestNGMethod
-
setPriority
public void setPriority(int priority)
- Specified by:
setPriorityin 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 Map<String,String> findMethodParameters(XmlTest test)
- Specified by:
findMethodParametersin interfaceITestNGMethod- Returns:
- the parameters found in the include tag, if any
-
getQualifiedName
public String getQualifiedName()
Description copied from interface:ITestNGMethodgetRealClass().getName() + "." + getMethodName()- Specified by:
getQualifiedNamein interfaceITestNGMethod- Returns:
- qualified name for this method
-
-