Class JUnit4TestRunner

java.lang.Object
org.testng.junit.JUnit4TestRunner
All Implemented Interfaces:
IJUnitTestRunner

public class JUnit4TestRunner extends Object implements IJUnitTestRunner
A JUnit TestRunner that records/triggers all information/events necessary to TestNG.
  • Field Details

  • Constructor Details

    • JUnit4TestRunner

      public JUnit4TestRunner()
    • JUnit4TestRunner

      public JUnit4TestRunner(ITestResultNotifier tr)
  • Method Details

    • getTestMethods

      public List<ITestNGMethod> getTestMethods()
      Needed from TestRunner in order to figure out what JUnit test methods were run.
      Specified by:
      getTestMethods in interface IJUnitTestRunner
      Returns:
      the list of all JUnit test methods run
    • setTestResultNotifier

      public void setTestResultNotifier(ITestResultNotifier notifier)
      Specified by:
      setTestResultNotifier in interface IJUnitTestRunner
    • setInvokedMethodListeners

      public void setInvokedMethodListeners(Collection<IInvokedMethodListener> listeners)
      Specified by:
      setInvokedMethodListeners in interface IJUnitTestRunner
    • run

      public void run(Class testClass, String... methods)
      A start implementation that ignores the TestResult
      Specified by:
      run in interface IJUnitTestRunner
      Parameters:
      testClass - the JUnit test class
    • start

      public org.junit.runner.Result start(Class testCase, String... methods)
      Starts a test run. Analyzes the command line arguments and runs the given test suite.
      Parameters:
      testCase - The test class
      methods - 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)