@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; }
@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; }
/** * [IClassListener] * Invoked after the test class is instantiated and before * {@link org.testng.annotations.BeforeClass @BeforeClass} * configuration methods are called. * * @param testClass TestNG representation for the current test class */ @Override public void onBeforeClass(ITestClass testClass) { synchronized (classListeners) { for (IClassListener classListener : Lists.reverse(classListeners)) { classListener.onBeforeClass(testClass); } } }
/** * [IClassListener] * Invoked after all of the test methods of the test class have been invoked * and before {@link org.testng.annotations.AfterClass @AfterClass} * configuration methods are called. * * @param testClass TestNG representation for the current test class */ @Override public void onAfterClass(ITestClass testClass) { synchronized (classListeners) { for (IClassListener classListener : classListeners) { classListener.onAfterClass(testClass); } } }
@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; }