Package org.testng.junit
Class JUnitTestClass
- java.lang.Object
-
- org.testng.junit.JUnitTestClass
-
- All Implemented Interfaces:
IClass,ITestClass
- Direct Known Subclasses:
JUnit3TestClass,JUnit4TestClass
public abstract class JUnitTestClass extends java.lang.Object implements ITestClass
-
-
Field Summary
Fields Modifier and Type Field Description private static ITestNGMethod[]EMPTY_METHODARRAYprivate java.util.List<ITestNGMethod>m_afterClassprivate java.util.List<ITestNGMethod>m_afterTestprivate java.util.List<ITestNGMethod>m_beforeClassprivate java.util.List<ITestNGMethod>m_beforeTestprivate long[]m_instanceHashesprivate java.lang.Object[]m_instancesprivate java.lang.Class<?>m_realClassprivate java.util.List<ITestNGMethod>m_testMethods
-
Constructor Summary
Constructors Constructor Description JUnitTestClass(java.lang.Class<?> test)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddInstance(java.lang.Object instance)ITestNGMethod[]getAfterClassMethods()Returns all the methods that should be invoked after all the tests have been run on this class.ITestNGMethod[]getAfterGroupsMethods()Returns all @Configuration methods that should be invoked after certain groups.ITestNGMethod[]getAfterSuiteMethods()Returns all the methods that should be invoked after the suite has run.ITestNGMethod[]getAfterTestConfigurationMethods()Returns all @Configuration methods that should be invoked last before any others in the current test.ITestNGMethod[]getAfterTestMethods()Returns all the methods that should be invoked after a test method completes.ITestNGMethod[]getBeforeClassMethods()Return all the methods that should be invoked after the test class has been created and before any of its test methods is invoked.ITestNGMethod[]getBeforeGroupsMethods()Returns all @Configuration methods that should be invoked before certain groups.ITestNGMethod[]getBeforeSuiteMethods()Returns All the methods that should be invoked before the suite is run.ITestNGMethod[]getBeforeTestConfigurationMethods()Returns all @Configuration methods that should be invoked before any others in the current test.ITestNGMethod[]getBeforeTestMethods()Returns all the methods that should be invoked before a test method is invoked.long[]getInstanceHashCodes()java.lang.Object[]getInstances(boolean reuse)Returns all the instances the methods will be invoked upon.java.lang.StringgetName()java.lang.ClassgetRealClass()(package private) java.util.List<ITestNGMethod>getTestMethodList()ITestNGMethod[]getTestMethods()Returns all the applicable test methods.java.lang.StringgetTestName()XmlClassgetXmlClass()XmlTestgetXmlTest()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.testng.IClass
getInstances
-
-
-
-
Field Detail
-
m_testMethods
private java.util.List<ITestNGMethod> m_testMethods
-
m_beforeClass
private java.util.List<ITestNGMethod> m_beforeClass
-
m_afterClass
private java.util.List<ITestNGMethod> m_afterClass
-
m_beforeTest
private java.util.List<ITestNGMethod> m_beforeTest
-
m_afterTest
private java.util.List<ITestNGMethod> m_afterTest
-
m_realClass
private final java.lang.Class<?> m_realClass
-
m_instances
private final java.lang.Object[] m_instances
-
m_instanceHashes
private final long[] m_instanceHashes
-
EMPTY_METHODARRAY
private static final ITestNGMethod[] EMPTY_METHODARRAY
-
-
Method Detail
-
getTestMethodList
java.util.List<ITestNGMethod> getTestMethodList()
-
addInstance
public void addInstance(java.lang.Object instance)
- Specified by:
addInstancein interfaceIClass- See Also:
IClass.addInstance(java.lang.Object)
-
getName
public java.lang.String getName()
- Specified by:
getNamein interfaceIClass- Returns:
- this test class name. This is the name of the corresponding Java class.
- See Also:
IClass.getName()
-
getRealClass
public java.lang.Class getRealClass()
- Specified by:
getRealClassin interfaceIClass- Returns:
- the Java class corresponding to this IClass.
- See Also:
IClass.getRealClass()
-
getTestName
public java.lang.String getTestName()
- Specified by:
getTestNamein interfaceIClass- Returns:
- its test name if this class implements org.testng.ITest, null otherwise.
-
getXmlTest
public XmlTest getXmlTest()
- Specified by:
getXmlTestin interfaceIClass- Returns:
- the <test> tag this class was found in.
-
getXmlClass
public XmlClass getXmlClass()
- Specified by:
getXmlClassin interfaceIClass- Returns:
- the *lt;class> tag this class was found in.
-
getInstanceHashCodes
public long[] getInstanceHashCodes()
- Specified by:
getInstanceHashCodesin interfaceIClass- See Also:
IClass.getInstanceHashCodes()
-
getInstances
public java.lang.Object[] getInstances(boolean reuse)
Description copied from interface:IClassReturns all the instances the methods will be invoked upon. This will typically be an array of one object in the absence of a @Factory annotation.- Specified by:
getInstancesin interfaceIClass- Parameters:
reuse- flag if a new set of instances must be returned (if set tofalse)- Returns:
- All the instances the methods will be invoked upon.
- See Also:
IClass.getInstances(boolean)
-
getTestMethods
public ITestNGMethod[] getTestMethods()
Description copied from interface:ITestClassReturns all the applicable test methods.- Specified by:
getTestMethodsin interfaceITestClass- Returns:
- All the applicable test methods.
- See Also:
ITestClass.getTestMethods()
-
getBeforeTestMethods
public ITestNGMethod[] getBeforeTestMethods()
Description copied from interface:ITestClassReturns all the methods that should be invoked before a test method is invoked.- Specified by:
getBeforeTestMethodsin interfaceITestClass- Returns:
- All the methods that should be invoked before a test method is invoked.
- See Also:
ITestClass.getBeforeTestMethods()
-
getAfterTestMethods
public ITestNGMethod[] getAfterTestMethods()
Description copied from interface:ITestClassReturns all the methods that should be invoked after a test method completes.- Specified by:
getAfterTestMethodsin interfaceITestClass- Returns:
- All the methods that should be invoked after a test method completes.
- See Also:
ITestClass.getAfterTestMethods()
-
getBeforeClassMethods
public ITestNGMethod[] getBeforeClassMethods()
Description copied from interface:ITestClassReturn all the methods that should be invoked after the test class has been created and before any of its test methods is invoked.- Specified by:
getBeforeClassMethodsin interfaceITestClass- Returns:
- All the methods that should be invoked after the test class has been created and before any of its test methods is invoked.
- See Also:
ITestClass.getBeforeClassMethods()
-
getAfterClassMethods
public ITestNGMethod[] getAfterClassMethods()
Description copied from interface:ITestClassReturns all the methods that should be invoked after all the tests have been run on this class.- Specified by:
getAfterClassMethodsin interfaceITestClass- Returns:
- All the methods that should be invoked after all the tests have been run on this class.
- See Also:
ITestClass.getAfterClassMethods()
-
getBeforeSuiteMethods
public ITestNGMethod[] getBeforeSuiteMethods()
Description copied from interface:ITestClassReturns All the methods that should be invoked before the suite is run.- Specified by:
getBeforeSuiteMethodsin interfaceITestClass- Returns:
- All the methods that should be invoked before the suite is run.
- See Also:
ITestClass.getBeforeSuiteMethods()
-
getAfterSuiteMethods
public ITestNGMethod[] getAfterSuiteMethods()
Description copied from interface:ITestClassReturns all the methods that should be invoked after the suite has run.- Specified by:
getAfterSuiteMethodsin interfaceITestClass- Returns:
- All the methods that should be invoked after the suite has run.
- See Also:
ITestClass.getAfterSuiteMethods()
-
getBeforeGroupsMethods
public ITestNGMethod[] getBeforeGroupsMethods()
Description copied from interface:ITestClassReturns all @Configuration methods that should be invoked before certain groups.- Specified by:
getBeforeGroupsMethodsin interfaceITestClass- Returns:
- all @Configuration methods that should be invoked before certain groups.
- See Also:
ITestClass.getBeforeGroupsMethods()
-
getAfterGroupsMethods
public ITestNGMethod[] getAfterGroupsMethods()
Description copied from interface:ITestClassReturns all @Configuration methods that should be invoked after certain groups.- Specified by:
getAfterGroupsMethodsin interfaceITestClass- Returns:
- all @Configuration methods that should be invoked after certain groups.
- See Also:
ITestClass.getAfterGroupsMethods()
-
getBeforeTestConfigurationMethods
public ITestNGMethod[] getBeforeTestConfigurationMethods()
Description copied from interface:ITestClassReturns all @Configuration methods that should be invoked before any others in the current test.- Specified by:
getBeforeTestConfigurationMethodsin interfaceITestClass- Returns:
- all @Configuration methods that should be invoked before any others in the current test.
- See Also:
ITestClass.getBeforeTestConfigurationMethods()
-
getAfterTestConfigurationMethods
public ITestNGMethod[] getAfterTestConfigurationMethods()
Description copied from interface:ITestClassReturns all @Configuration methods that should be invoked last before any others in the current test.- Specified by:
getAfterTestConfigurationMethodsin interfaceITestClass- Returns:
- all @Configuration methods that should be invoked last before any others in the current test.
- See Also:
ITestClass.getAfterTestConfigurationMethods()
-
-