Package org.testng.internal
Class TestNGMethod
- java.lang.Object
-
- org.testng.internal.BaseTestMethod
-
- org.testng.internal.TestNGMethod
-
- All Implemented Interfaces:
java.lang.Cloneable
,ITestNGMethod
public class TestNGMethod extends BaseTestMethod
This class represents a test method.
-
-
Field Summary
Fields Modifier and Type Field Description private IDataProviderMethod
dataProviderMethod
private boolean
isDataDriven
private CustomAttribute[]
m_attributes
private int
m_invocationCount
private int
m_successPercentage
private int
m_threadPoolSize
-
Fields inherited from class org.testng.internal.BaseTestMethod
m_afterGroups, m_annotationFinder, m_beforeGroups, m_currentInvocationCount, m_date, m_groups, m_groupsDependedUpon, m_id, m_method, m_methodClass, m_methodsDependedUpon, m_testClass
-
-
Constructor Summary
Constructors Modifier Constructor Description private
TestNGMethod(java.lang.reflect.Method method, IAnnotationFinder finder, boolean initialize, XmlTest xmlTest, java.lang.Object instance)
TestNGMethod(java.lang.reflect.Method method, IAnnotationFinder finder, XmlTest xmlTest, java.lang.Object instance)
Constructs aTestNGMethod
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
classNameMatcher(XmlClass xmlClass)
BaseTestMethod
clone()
Clones the currentTestNGMethod
and its @BeforeMethod and @AfterMethod methods.private static ITestNGMethod[]
clone(ITestNGMethod[] sources)
private static IRetryAnalyzer
cloneInstance(IRetryAnalyzer instance)
private static boolean
doesTestAnnotationHaveADataProvider(ITestAnnotation testAnnotation)
private java.lang.String
findDescription(ITestAnnotation testAnnotation, XmlTest xmlTest)
CustomAttribute[]
getAttributes()
IDataProviderMethod
getDataProviderMethod()
int
getInvocationCount()
int
getSuccessPercentage()
Default value for successPercentage.int
getThreadPoolSize()
private void
init(XmlTest xmlTest)
boolean
isDataDriven()
boolean
isTest()
private boolean
methodNameMatcher(XmlInclude xmlInclude)
void
setDataProviderMethod(IDataProviderMethod dataProviderMethod)
void
setInvocationCount(int counter)
Sets the number of invocations for this method.void
setThreadPoolSize(int threadPoolSize)
Sets the number of threads on which this method should be invoked.-
Methods inherited from class org.testng.internal.BaseTestMethod
addFailedInvocationNumber, addMethodDependedUpon, canRunFromClass, equals, findMethodParameters, getAfterGroups, getAnnotationFinder, getBeforeGroups, getConstructorOrMethod, getCurrentInvocationCount, getDate, getDescription, getEnabled, getFactoryMethodParamsInfo, getFailedInvocationNumbers, getGroups, getGroupsDependedUpon, getIClass, getId, getInstance, getInstanceHashCodes, getInterceptedPriority, getInvocationNumbers, getInvocationTimeOut, getMethodName, getMethodsDependedUpon, getMissingGroup, getParameterInvocationCount, getPriority, getQualifiedName, getRealClass, getRetryAnalyzer, getRetryAnalyzer, getRetryAnalyzerClass, getSignature, getSimpleName, getStringArray, getTestClass, getTimeOut, getXmlTest, hashCode, hasMoreInvocation, ignoreMissingDependencies, incrementCurrentInvocationCount, initBeforeAfterGroups, initGroups, isAfterClassConfiguration, isAfterGroupsConfiguration, isAfterMethodConfiguration, isAfterSuiteConfiguration, isAfterTestConfiguration, isAlwaysRun, isBeforeClassConfiguration, isBeforeGroupsConfiguration, isBeforeMethodConfiguration, isBeforeSuiteConfiguration, isBeforeTestConfiguration, setAlwaysRun, setDate, setDescription, setEnabled, setGroups, setGroupsDependedUpon, setId, setIgnoreMissingDependencies, setInterceptedPriority, setInvocationNumbers, setInvocationTimeOut, setMethodsDependedUpon, setMissingGroup, setMoreInvocationChecker, setParameterInvocationCount, setPriority, setRetryAnalyzer, setRetryAnalyzerClass, setSkipFailedInvocations, setTestClass, setTimeOut, setXmlTest, skipFailedInvocations, stringify, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.testng.ITestNGMethod
hasAfterGroupsConfiguration, hasBeforeGroupsConfiguration
-
-
-
-
Field Detail
-
m_threadPoolSize
private int m_threadPoolSize
-
m_invocationCount
private int m_invocationCount
-
m_successPercentage
private int m_successPercentage
-
isDataDriven
private boolean isDataDriven
-
m_attributes
private CustomAttribute[] m_attributes
-
dataProviderMethod
private IDataProviderMethod dataProviderMethod
-
-
Constructor Detail
-
TestNGMethod
public TestNGMethod(java.lang.reflect.Method method, IAnnotationFinder finder, XmlTest xmlTest, java.lang.Object instance)
Constructs aTestNGMethod
-
TestNGMethod
private TestNGMethod(java.lang.reflect.Method method, IAnnotationFinder finder, boolean initialize, XmlTest xmlTest, java.lang.Object instance)
-
-
Method Detail
-
getInvocationCount
public int getInvocationCount()
- Specified by:
getInvocationCount
in interfaceITestNGMethod
- Overrides:
getInvocationCount
in classBaseTestMethod
- Returns:
- the number of times this method needs to be invoked.
-
getSuccessPercentage
public int getSuccessPercentage()
Default value for successPercentage.- Specified by:
getSuccessPercentage
in interfaceITestNGMethod
- Overrides:
getSuccessPercentage
in classBaseTestMethod
- Returns:
- the success percentage for this method (between 0 and 100).
-
isTest
public boolean isTest()
- Specified by:
isTest
in interfaceITestNGMethod
- Overrides:
isTest
in classBaseTestMethod
- Returns:
- true if this method was annotated with @Test
-
init
private void init(XmlTest xmlTest)
-
doesTestAnnotationHaveADataProvider
private static boolean doesTestAnnotationHaveADataProvider(ITestAnnotation testAnnotation)
-
findDescription
private java.lang.String findDescription(ITestAnnotation testAnnotation, XmlTest xmlTest)
-
classNameMatcher
private boolean classNameMatcher(XmlClass xmlClass)
-
methodNameMatcher
private boolean methodNameMatcher(XmlInclude xmlInclude)
-
getThreadPoolSize
public int getThreadPoolSize()
- Specified by:
getThreadPoolSize
in interfaceITestNGMethod
- Overrides:
getThreadPoolSize
in classBaseTestMethod
- Returns:
- the number of threads to be used when invoking the method on parallel
-
setThreadPoolSize
public void setThreadPoolSize(int threadPoolSize)
Sets the number of threads on which this method should be invoked.- Specified by:
setThreadPoolSize
in interfaceITestNGMethod
- Overrides:
setThreadPoolSize
in classBaseTestMethod
-
setInvocationCount
public void setInvocationCount(int counter)
Sets the number of invocations for this method.- Specified by:
setInvocationCount
in interfaceITestNGMethod
- Overrides:
setInvocationCount
in classBaseTestMethod
-
clone
public BaseTestMethod clone()
Clones the currentTestNGMethod
and its @BeforeMethod and @AfterMethod methods.- Specified by:
clone
in interfaceITestNGMethod
- Specified by:
clone
in classBaseTestMethod
- See Also:
BaseTestMethod.clone()
-
clone
private static ITestNGMethod[] clone(ITestNGMethod[] sources)
-
cloneInstance
private static IRetryAnalyzer cloneInstance(IRetryAnalyzer instance)
-
isDataDriven
public boolean isDataDriven()
-
getAttributes
public CustomAttribute[] getAttributes()
- Returns:
- - An array of
CustomAttribute
that represents the custom attributes associated with a test.
-
getDataProviderMethod
public IDataProviderMethod getDataProviderMethod()
- Returns:
- - An
IDataProviderMethod
for a data provider powered test method andnull
otherwise.
-
setDataProviderMethod
public void setDataProviderMethod(IDataProviderMethod dataProviderMethod)
-
-