Package org.testng.junit
Class JUnit4TestRunner
- java.lang.Object
-
- org.testng.junit.JUnit4TestRunner
-
- All Implemented Interfaces:
IJUnitTestRunner
public class JUnit4TestRunner extends java.lang.Object implements IJUnitTestRunner
A JUnit TestRunner that records/triggers all information/events necessary to TestNG.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classJUnit4TestRunner.RL
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<org.junit.runner.Description,ITestResult>m_findedMethodsprivate java.util.Collection<IInvokedMethodListener>m_invokeListenersprivate java.util.List<ITestListener>m_listenersprivate java.util.List<ITestNGMethod>m_methodsprivate ITestResultNotifierm_parentRunner-
Fields inherited from interface org.testng.junit.IJUnitTestRunner
JUNIT_4_TESTRUNNER, JUNIT_TESTRUNNER
-
-
Constructor Summary
Constructors Constructor Description JUnit4TestRunner()JUnit4TestRunner(ITestResultNotifier tr)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private ITestResultcreateTestResult(org.junit.runner.Description test)java.util.List<ITestNGMethod>getTestMethods()Needed from TestRunner in order to figure out what JUnit test methods were run.private static booleanisAssumptionFailed(org.junit.runner.notification.Failure failure)voidrun(java.lang.Class testClass, java.lang.String... methods)Astartimplementation that ignores theTestResultvoidsetInvokedMethodListeners(java.util.Collection<IInvokedMethodListener> listeners)voidsetTestResultNotifier(ITestResultNotifier notifier)org.junit.runner.Resultstart(java.lang.Class testCase, java.lang.String... methods)Starts a test run.
-
-
-
Field Detail
-
m_parentRunner
private ITestResultNotifier m_parentRunner
-
m_methods
private java.util.List<ITestNGMethod> m_methods
-
m_listeners
private java.util.List<ITestListener> m_listeners
-
m_invokeListeners
private java.util.Collection<IInvokedMethodListener> m_invokeListeners
-
m_findedMethods
private java.util.Map<org.junit.runner.Description,ITestResult> m_findedMethods
-
-
Constructor Detail
-
JUnit4TestRunner
public JUnit4TestRunner()
-
JUnit4TestRunner
public JUnit4TestRunner(ITestResultNotifier tr)
-
-
Method Detail
-
getTestMethods
public java.util.List<ITestNGMethod> getTestMethods()
Needed from TestRunner in order to figure out what JUnit test methods were run.- Specified by:
getTestMethodsin interfaceIJUnitTestRunner- Returns:
- the list of all JUnit test methods run
-
setTestResultNotifier
public void setTestResultNotifier(ITestResultNotifier notifier)
- Specified by:
setTestResultNotifierin interfaceIJUnitTestRunner
-
setInvokedMethodListeners
public void setInvokedMethodListeners(java.util.Collection<IInvokedMethodListener> listeners)
- Specified by:
setInvokedMethodListenersin interfaceIJUnitTestRunner
-
run
public void run(java.lang.Class testClass, java.lang.String... methods)Astartimplementation that ignores theTestResult- Specified by:
runin interfaceIJUnitTestRunner- Parameters:
testClass- the JUnit test class
-
start
public org.junit.runner.Result start(java.lang.Class testCase, java.lang.String... methods)Starts a test run. Analyzes the command line arguments and runs the given test suite.- Parameters:
testCase- The test classmethods- The test methods- Returns:
- The result
-
createTestResult
private ITestResult createTestResult(org.junit.runner.Description test)
-
isAssumptionFailed
private static boolean isAssumptionFailed(org.junit.runner.notification.Failure failure)
-
-