Package org.testng
Interface ITestNGMethod
-
- All Superinterfaces:
java.lang.Cloneable
- All Known Implementing Classes:
BaseTestMethod
,ClonedMethod
,ConfigurationMethod
,FactoryMethod
,JUnit3TestMethod
,JUnit4TestMethod
,JUnitTestMethod
,TestNGMethod
,WrappedTestNGMethod
public interface ITestNGMethod extends java.lang.Cloneable
Describes a TestNG annotated method and the instance on which it will be invoked.This interface is not meant to be implemented by users.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description void
addFailedInvocationNumber(int number)
The list of invocation numbers that failed, which is only applicable for methods that have a data provider.void
addMethodDependedUpon(java.lang.String methodName)
boolean
canRunFromClass(IClass testClass)
Returns if this ITestNGMethod can be invoked from within IClass.ITestNGMethod
clone()
java.util.Map<java.lang.String,java.lang.String>
findMethodParameters(XmlTest test)
java.lang.String[]
getAfterGroups()
default CustomAttribute[]
getAttributes()
java.lang.String[]
getBeforeGroups()
Before and After groupsConstructorOrMethod
getConstructorOrMethod()
int
getCurrentInvocationCount()
default IDataProviderMethod
getDataProviderMethod()
long
getDate()
java.lang.String
getDescription()
boolean
getEnabled()
default IParameterInfo
getFactoryMethodParamsInfo()
java.util.List<java.lang.Integer>
getFailedInvocationNumbers()
java.lang.String[]
getGroups()
java.lang.String[]
getGroupsDependedUpon()
java.lang.String
getId()
java.lang.Object
getInstance()
long[]
getInstanceHashCodes()
Needed for serialization.int
getInterceptedPriority()
int
getInvocationCount()
java.util.List<java.lang.Integer>
getInvocationNumbers()
Which invocation numbers of this method should be used (only applicable if it uses a data provider).long
getInvocationTimeOut()
The time under which all invocationCount methods need to complete by.java.lang.String
getMethodName()
Returns the method name.java.lang.String[]
getMethodsDependedUpon()
java.lang.String
getMissingGroup()
If a group was not found.int
getParameterInvocationCount()
int
getPriority()
The scheduling priority.java.lang.String
getQualifiedName()
getRealClass().getName() + "." + getMethodName()java.lang.Class
getRealClass()
IRetryAnalyzer
getRetryAnalyzer()
Deprecated.- This method stands deprecated as of TestNG 7.0.0.default IRetryAnalyzer
getRetryAnalyzer(ITestResult result)
default java.lang.Class<? extends IRetryAnalyzer>
getRetryAnalyzerClass()
int
getSuccessPercentage()
ITestClass
getTestClass()
int
getThreadPoolSize()
long
getTimeOut()
XmlTest
getXmlTest()
boolean
hasMoreInvocation()
boolean
ignoreMissingDependencies()
void
incrementCurrentInvocationCount()
boolean
isAfterClassConfiguration()
boolean
isAfterGroupsConfiguration()
boolean
isAfterMethodConfiguration()
boolean
isAfterSuiteConfiguration()
boolean
isAfterTestConfiguration()
boolean
isAlwaysRun()
boolean
isBeforeClassConfiguration()
boolean
isBeforeGroupsConfiguration()
boolean
isBeforeMethodConfiguration()
boolean
isBeforeSuiteConfiguration()
boolean
isBeforeTestConfiguration()
default boolean
isDataDriven()
boolean
isTest()
void
setDate(long date)
void
setDescription(java.lang.String description)
void
setId(java.lang.String id)
void
setIgnoreMissingDependencies(boolean ignore)
void
setInterceptedPriority(int priority)
void
setInvocationCount(int count)
void
setInvocationNumbers(java.util.List<java.lang.Integer> numbers)
void
setMissingGroup(java.lang.String group)
void
setMoreInvocationChecker(java.util.concurrent.Callable<java.lang.Boolean> moreInvocationChecker)
void
setParameterInvocationCount(int n)
void
setPriority(int priority)
void
setRetryAnalyzer(IRetryAnalyzer retryAnalyzer)
Deprecated.- This method stands deprecated as of TestNG 7.0.0.default void
setRetryAnalyzerClass(java.lang.Class<? extends IRetryAnalyzer> clazz)
void
setSkipFailedInvocations(boolean skip)
void
setTestClass(ITestClass cls)
Sets the test class having this method.void
setThreadPoolSize(int threadPoolSize)
void
setTimeOut(long timeOut)
boolean
skipFailedInvocations()
-
-
-
Method Detail
-
getRealClass
java.lang.Class getRealClass()
- 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
ITestClass getTestClass()
-
setTestClass
void setTestClass(ITestClass cls)
Sets the test class having this method. This is not necessarily the declaring class.- Parameters:
cls
- The test class having this method.
-
getMethodName
java.lang.String getMethodName()
Returns the method name. This is needed for serialization because methods are not Serializable.- Returns:
- the method name.
-
getInstance
java.lang.Object getInstance()
-
getInstanceHashCodes
long[] getInstanceHashCodes()
Needed for serialization.
-
getGroups
java.lang.String[] getGroups()
- Returns:
- The groups this method belongs to, possibly added to the groups declared on the class.
-
getGroupsDependedUpon
java.lang.String[] getGroupsDependedUpon()
- Returns:
- The groups this method depends on, possibly added to the groups declared on the class.
-
getMissingGroup
java.lang.String getMissingGroup()
If a group was not found.
-
setMissingGroup
void setMissingGroup(java.lang.String group)
-
getBeforeGroups
java.lang.String[] getBeforeGroups()
Before and After groups
-
getAfterGroups
java.lang.String[] getAfterGroups()
-
getMethodsDependedUpon
java.lang.String[] getMethodsDependedUpon()
- Returns:
- The methods this method depends on, possibly added to the methods declared on the class.
-
addMethodDependedUpon
void addMethodDependedUpon(java.lang.String methodName)
-
isTest
boolean isTest()
- Returns:
- true if this method was annotated with @Test
-
isBeforeMethodConfiguration
boolean isBeforeMethodConfiguration()
- Returns:
- true if this method was annotated with @Configuration and beforeTestMethod = true
-
isAfterMethodConfiguration
boolean isAfterMethodConfiguration()
- Returns:
- true if this method was annotated with @Configuration and beforeTestMethod = false
-
isBeforeClassConfiguration
boolean isBeforeClassConfiguration()
- Returns:
- true if this method was annotated with @Configuration and beforeClassMethod = true
-
isAfterClassConfiguration
boolean isAfterClassConfiguration()
- Returns:
- true if this method was annotated with @Configuration and beforeClassMethod = false
-
isBeforeSuiteConfiguration
boolean isBeforeSuiteConfiguration()
- Returns:
- true if this method was annotated with @Configuration and beforeSuite = true
-
isAfterSuiteConfiguration
boolean isAfterSuiteConfiguration()
- Returns:
- true if this method was annotated with @Configuration and afterSuite = true
-
isBeforeTestConfiguration
boolean isBeforeTestConfiguration()
- Returns:
- true if this method is a @BeforeTest (@Configuration beforeTest=true)
-
isAfterTestConfiguration
boolean isAfterTestConfiguration()
- Returns:
- true if this method is an @AfterTest (@Configuration afterTest=true)
-
isBeforeGroupsConfiguration
boolean isBeforeGroupsConfiguration()
-
isAfterGroupsConfiguration
boolean isAfterGroupsConfiguration()
-
getTimeOut
long getTimeOut()
- Returns:
- The timeout in milliseconds.
-
setTimeOut
void setTimeOut(long timeOut)
-
getInvocationCount
int getInvocationCount()
- Returns:
- the number of times this method needs to be invoked.
-
setInvocationCount
void setInvocationCount(int count)
-
getSuccessPercentage
int getSuccessPercentage()
- Returns:
- the success percentage for this method (between 0 and 100).
-
getId
java.lang.String getId()
- Returns:
- The id of the thread this method was run in.
-
setId
void setId(java.lang.String id)
-
getDate
long getDate()
-
setDate
void setDate(long date)
-
canRunFromClass
boolean canRunFromClass(IClass testClass)
Returns if this ITestNGMethod can be invoked from within IClass.
-
isAlwaysRun
boolean isAlwaysRun()
- Returns:
- true if this method is alwaysRun=true
-
getThreadPoolSize
int getThreadPoolSize()
- Returns:
- the number of threads to be used when invoking the method on parallel
-
setThreadPoolSize
void setThreadPoolSize(int threadPoolSize)
-
getEnabled
boolean getEnabled()
-
getDescription
java.lang.String getDescription()
-
setDescription
void setDescription(java.lang.String description)
-
incrementCurrentInvocationCount
void incrementCurrentInvocationCount()
-
getCurrentInvocationCount
int getCurrentInvocationCount()
-
setParameterInvocationCount
void setParameterInvocationCount(int n)
-
getParameterInvocationCount
int getParameterInvocationCount()
-
setMoreInvocationChecker
void setMoreInvocationChecker(java.util.concurrent.Callable<java.lang.Boolean> moreInvocationChecker)
-
hasMoreInvocation
boolean hasMoreInvocation()
-
clone
ITestNGMethod clone()
-
getRetryAnalyzer
@Deprecated IRetryAnalyzer getRetryAnalyzer()
Deprecated.- This method stands deprecated as of TestNG 7.0.0. Please usegetRetryAnalyzer(ITestResult)
instead.
-
setRetryAnalyzer
@Deprecated void setRetryAnalyzer(IRetryAnalyzer retryAnalyzer)
Deprecated.- This method stands deprecated as of TestNG 7.0.0. Please usesetRetryAnalyzerClass(Class)
instead.
-
getRetryAnalyzer
default IRetryAnalyzer getRetryAnalyzer(ITestResult result)
-
setRetryAnalyzerClass
default void setRetryAnalyzerClass(java.lang.Class<? extends IRetryAnalyzer> clazz)
-
getRetryAnalyzerClass
default java.lang.Class<? extends IRetryAnalyzer> getRetryAnalyzerClass()
-
skipFailedInvocations
boolean skipFailedInvocations()
-
setSkipFailedInvocations
void setSkipFailedInvocations(boolean skip)
-
getInvocationTimeOut
long getInvocationTimeOut()
The time under which all invocationCount methods need to complete by.
-
ignoreMissingDependencies
boolean ignoreMissingDependencies()
-
setIgnoreMissingDependencies
void setIgnoreMissingDependencies(boolean ignore)
-
getInvocationNumbers
java.util.List<java.lang.Integer> getInvocationNumbers()
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.
-
setInvocationNumbers
void setInvocationNumbers(java.util.List<java.lang.Integer> numbers)
-
addFailedInvocationNumber
void addFailedInvocationNumber(int number)
The list of invocation numbers that failed, which is only applicable for methods that have a data provider.
-
getFailedInvocationNumbers
java.util.List<java.lang.Integer> getFailedInvocationNumbers()
-
getPriority
int getPriority()
The scheduling priority. Lower priorities get scheduled first.
-
setPriority
void setPriority(int priority)
-
getInterceptedPriority
int getInterceptedPriority()
-
setInterceptedPriority
void setInterceptedPriority(int priority)
-
getXmlTest
XmlTest getXmlTest()
- Returns:
- the XmlTest this method belongs to.
-
getConstructorOrMethod
ConstructorOrMethod getConstructorOrMethod()
-
findMethodParameters
java.util.Map<java.lang.String,java.lang.String> findMethodParameters(XmlTest test)
- Parameters:
test
- - TheXmlTest
object.- Returns:
- the parameters found in the include tag, if any
-
getQualifiedName
java.lang.String getQualifiedName()
getRealClass().getName() + "." + getMethodName()- Returns:
- qualified name for this method
-
isDataDriven
default boolean isDataDriven()
-
getFactoryMethodParamsInfo
default IParameterInfo getFactoryMethodParamsInfo()
- Returns:
- - A
IParameterInfo
object that represents details about the parameters associated with the factory method.
-
getAttributes
default CustomAttribute[] getAttributes()
- Returns:
- - An array of
CustomAttribute
that represents the custom attributes associated with a test.
-
getDataProviderMethod
default IDataProviderMethod getDataProviderMethod()
- Returns:
- - An
IDataProviderMethod
for a data provider powered test method andnull
otherwise.
-
-