Java 类org.testng.TestRunner 实例源码

项目:testng-remote    文件:RemoteTestNG6_5.java   
@Override
protected ITestRunnerFactory buildTestRunnerFactory() {
  if(null == m_customTestRunnerFactory) {
    m_customTestRunnerFactory= new ITestRunnerFactory() {
      @Override
      public TestRunner newTestRunner(ISuite suite, XmlTest xmlTest,
                                      List<IInvokedMethodListener> listeners) {
        TestRunner runner =
                new TestRunner(getConfiguration(), suite, xmlTest,
                        false /*skipFailedInvocationCounts */,
                        listeners);
        if (m_useDefaultListeners) {
          runner.addListener(new TestHTMLReporter());
          runner.addListener(new JUnitXMLReporter());
        }
        for (IConfigurationListener cl : getConfiguration().getConfigurationListeners()) {
          runner.addListener(cl);
        }

        return runner;
      }
    };
  }

  return m_customTestRunnerFactory;
}
项目:testng-remote    文件:RemoteTestNG6_10.java   
@Override
protected ITestRunnerFactory buildTestRunnerFactory() {
  if(null == m_customTestRunnerFactory) {
    m_customTestRunnerFactory= new ITestRunnerFactory() {
        @Override
        public TestRunner newTestRunner(ISuite suite, XmlTest xmlTest,
            Collection<IInvokedMethodListener> listeners, List<IClassListener> classListeners) {
          TestRunner runner =
            new TestRunner(getConfiguration(), suite, xmlTest,
                false /*skipFailedInvocationCounts */,
                listeners, classListeners);
          if (m_useDefaultListeners) {
            runner.addListener(new TestHTMLReporter());
            runner.addListener(new JUnitXMLReporter());
          }

          return runner;
        }
      };
  }

  return m_customTestRunnerFactory;
}
项目:testng-remote    文件:RemoteTestNG6_9_7.java   
@Override
protected ITestRunnerFactory buildTestRunnerFactory() {
  if(null == m_customTestRunnerFactory) {
    m_customTestRunnerFactory= new ITestRunnerFactory() {
        @Override
        public TestRunner newTestRunner(ISuite suite, XmlTest xmlTest,
            Collection<IInvokedMethodListener> listeners) {
          TestRunner runner =
            new TestRunner(getConfiguration(), suite, xmlTest,
                false /*skipFailedInvocationCounts */,
                listeners);
          if (m_useDefaultListeners) {
            runner.addListener(new TestHTMLReporter());
            runner.addListener(new JUnitXMLReporter());
          }
          for (IConfigurationListener cl : getConfiguration().getConfigurationListeners()) {
            runner.addListener(cl);
          }

          return runner;
        }
      };
  }

  return m_customTestRunnerFactory;
}
项目:testng-remote    文件:RemoteTestNG6_9_10.java   
@Override
protected ITestRunnerFactory buildTestRunnerFactory() {
  if(null == m_customTestRunnerFactory) {
    m_customTestRunnerFactory= new ITestRunnerFactory() {
        @Override
        public TestRunner newTestRunner(ISuite suite, XmlTest xmlTest,
            Collection<IInvokedMethodListener> listeners, List<IClassListener> classListeners) {
          TestRunner runner =
            new TestRunner(getConfiguration(), suite, xmlTest,
                false /*skipFailedInvocationCounts */,
                listeners, classListeners);
          if (m_useDefaultListeners) {
            runner.addListener(new TestHTMLReporter());
            runner.addListener(new JUnitXMLReporter());
          }
          for (IConfigurationListener cl : getConfiguration().getConfigurationListeners()) {
            runner.addListener(cl);
          }

          return runner;
        }
      };
  }

  return m_customTestRunnerFactory;
}
项目:testng-remote    文件:RemoteTestNG6_12.java   
@Override
protected ITestRunnerFactory buildTestRunnerFactory() {
  if(null == m_customTestRunnerFactory) {
    m_customTestRunnerFactory= new ITestRunnerFactory() {
        @Override
        public TestRunner newTestRunner(ISuite suite, XmlTest xmlTest,
            Collection<IInvokedMethodListener> listeners, List<IClassListener> classListeners) {
          TestRunner runner =
            new TestRunner(getConfiguration(), suite, xmlTest,
                false /*skipFailedInvocationCounts */,
                listeners, classListeners);
          if (m_useDefaultListeners) {
            runner.addListener(new TestHTMLReporter());
            runner.addListener(new JUnitXMLReporter());
          }

          return runner;
        }
      };
  }

  return m_customTestRunnerFactory;
}
项目:testng-remote    文件:RemoteTestNG6_0.java   
@Override
protected ITestRunnerFactory buildTestRunnerFactory() {
  if(null == m_customTestRunnerFactory) {
    m_customTestRunnerFactory= new ITestRunnerFactory() {
      @Override
      public TestRunner newTestRunner(ISuite suite, XmlTest xmlTest,
                                      List<IInvokedMethodListener> listeners) {
        TestRunner runner =
                new TestRunner(getConfiguration(), suite, xmlTest,
                        false /*skipFailedInvocationCounts */,
                        listeners);
        if (m_useDefaultListeners) {
          runner.addListener(new TestHTMLReporter());
          runner.addListener(new JUnitXMLReporter());
        }

        return runner;
      }
    };
  }

  return m_customTestRunnerFactory;
}
项目:teasy    文件:WebServiceMethodsInvoker.java   
public <T extends Annotation> void invokeGroupMethodsByAnnotation(final Class<T> annotationClass, final ITestContext testContext) {
    final TestClassContext testClassContext = new TestClassContext(((TestRunner) testContext).getTest()
            .getXmlClasses()
            .get(0)
            .getSupportClass(), null, annotationClass, testContext);
    invokeMethodsByAnnotation(testClassContext, true);
}
项目:teasy    文件:SeleniumMethodsInvoker.java   
public <T extends Annotation> void invokeGroupMethodsByAnnotation(final Class<T> annotationClass, final ITestContext testContext) {
    initialize();
    final TestClassContext testClassContext = new TestClassContext(((TestRunner) testContext).getTest()
            .getXmlClasses()
            .get(0)
            .getSupportClass(), null, annotationClass, testContext);
    invokeMethodsByAnnotation(testClassContext, true);
}
项目:testng-remote    文件:RemoteTestNG6_5.java   
@Override
public TestRunner newTestRunner(ISuite suite, XmlTest test,
    List<IInvokedMethodListener> listeners) {
  TestRunner tr = m_delegateFactory.newTestRunner(suite, test, listeners);
  tr.addListener(new RemoteTestListener(suite, test, m_messageSender));
  return tr;
}
项目:testng-remote    文件:RemoteTestNG6_10.java   
@Override
public TestRunner newTestRunner(ISuite suite, XmlTest test,
    Collection<IInvokedMethodListener> listeners, List<IClassListener> classListeners) {
  TestRunner tr = m_delegateFactory.newTestRunner(suite, test, listeners, classListeners);
  tr.addListener(new RemoteTestListener(suite, test, m_messageSender));
  return tr;
}
项目:testng-remote    文件:RemoteTestNG6_9_7.java   
@Override
public TestRunner newTestRunner(ISuite suite, XmlTest test,
    Collection<IInvokedMethodListener> listeners) {
  TestRunner tr = m_delegateFactory.newTestRunner(suite, test, listeners);
  tr.addListener(new RemoteTestListener(suite, test, m_messageSender));
  return tr;
}
项目:testng-remote    文件:RemoteTestNG6_9_10.java   
@Override
public TestRunner newTestRunner(ISuite suite, XmlTest test,
    Collection<IInvokedMethodListener> listeners, List<IClassListener> classListeners) {
  TestRunner tr = m_delegateFactory.newTestRunner(suite, test, listeners, classListeners);
  tr.addListener(new RemoteTestListener(suite, test, m_messageSender));
  return tr;
}
项目:testng-remote    文件:RemoteTestNG6_12.java   
@Override
public TestRunner newTestRunner(ISuite suite, XmlTest test,
    Collection<IInvokedMethodListener> listeners, List<IClassListener> classListeners) {
  TestRunner tr = m_delegateFactory.newTestRunner(suite, test, listeners, classListeners);
  tr.addListener(new RemoteTestListener(suite, test, m_messageSender));
  return tr;
}
项目:testng-remote    文件:RemoteTestNG6_0.java   
@Override
public TestRunner newTestRunner(ISuite suite, XmlTest test,
    List<IInvokedMethodListener> listeners) {
  TestRunner tr = m_delegateFactory.newTestRunner(suite, test, listeners);
  tr.addListener(new RemoteTestListener1(suite, test, m_messageSender));
  return tr;
}
项目:wtf-core    文件:WTFTest.java   
@BeforeSuite(alwaysRun = true)
public void beforeSuite(ITestContext testContext)
        throws IllegalAccessException, InstantiationException {

    TestRunner tr = (TestRunner) testContext;

    if (WTFTestArgs.commandLineArgs.threadCount > 1) {
        tr.getSuite().getXmlSuite().setParallel("methods");
        tr.getTest().setParallel("methods");

        tr.getSuite().getXmlSuite()
                .setThreadCount(WTFTestArgs.commandLineArgs.threadCount);
        tr.getTest()
                .setThreadCount(WTFTestArgs.commandLineArgs.threadCount);

        tr.getSuite()
                .getXmlSuite()
                .setDataProviderThreadCount(
                        WTFTestArgs.commandLineArgs.threadCount);

        TestNG tng = com.beust.testng.TestNG.getDefault();
        tng.setThreadCount(WTFTestArgs.commandLineArgs.threadCount);
    }

    addTestListenerIfNotAddedBefore(tr, BaseListener.class);
    //addTestListenerIfNotAddedBefore(tr, WTFDashNodeJsonDataPushListener.class);
    addTestListenerIfNotAddedBefore(tr, ScreenShotListener.class);
    //addTestListenerIfNotAddedBefore(tr, BeDashListener.class);
    addReporterIfNotAddedBefore(BaseListener.class);

    // tr.setMethodInterceptor(new TestMultiplier());
    if (WTFTestConfig.getSuiteName() != null) {
        System.getProperties().setProperty("wtf.dash.suitename",
                WTFTestConfig.getSuiteName());
    }
}
项目:wtf-core    文件:WTFTest.java   
public static void addTestListenerIfNotAddedBefore(TestRunner tr,
        Class<?> listenerClass) throws IllegalAccessException,
        InstantiationException {
    for (ITestListener listnr : tr.getTestListeners()) {
        if (listenerClass.isInstance(listnr)) {
            return;
        }
    }
    tr.addTestListener((ITestListener) listenerClass.newInstance());
}
项目:automation-test-engine    文件:CaseRunner.java   
/**
 * Gets the test data.
 * 
 * @param ctx
 *            the ctx
 * @return the test data
 */
@DataProvider(name = "dp")
public Object[][] getTestData(ITestContext ctx) {
    if (null == currentExecutingTCName) {
        throw new IllegalStateException(
                "xml test case name is not correctly populated.");
    } else {
        TestParameters params = new TestParameters(getCurrentExecutingTCName(),
                getCurrentExecutingTCName());

        for (int index = 0; index < ((TestRunner) ctx).getTestListeners()
                .size(); index++) {
            if (((TestRunner) ctx).getTestListeners().get(index) instanceof TestProjectListener) {
                int thinkT = ((TestProjectListener) ((TestRunner) ctx)
                        .getTestListeners().get(index)).getMytp()
                        .getStepThinkTime();
                params.setStepThinkTime(thinkT);
                params.setGlobalAppCtx(((TestProjectListener) ((TestRunner) ctx)
                        .getTestListeners().get(index)).getMytp()
                        .getAppCtx());
                params.setTestProject(((TestProjectListener) ((TestRunner) ctx)
                        .getTestListeners().get(index)).getMytp());
                break;
            }
        }

        return new Object[][] { { params } };
    }

}
项目:wtf-core    文件:WTFTest.java   
@BeforeTest(alwaysRun = true)
public void beforeTest(ITestContext testContext) {
    TestRunner tr = (TestRunner) testContext;
    tr.setMethodInterceptor(new TestMultiplier());
}