Search in sources :

Example 1 with TestRunner

use of org.testng.TestRunner in project druid by druid-io.

the class RemoteTestNG method buildTestRunnerFactory.

/**
   * Override by the plugin if you need to configure differently the <code>TestRunner</code>
   * (usually this is needed if different listeners/reporters are needed).
   * <b>Note</b>: you don't need to worry about the wiring listener, because it is added
   * automatically.
   */
protected ITestRunnerFactory buildTestRunnerFactory() {
    //################### PATCH STARTS
    if (System.getProperty("testrunfactory") != null) {
        m_customTestRunnerFactory = (ITestRunnerFactory) ClassHelper.newInstance(ClassHelper.fileToClass(System.getProperty("testrunfactory")));
    //################## PATCH ENDS
    } else 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;
}
Also used : TestHTMLReporter(org.testng.reporters.TestHTMLReporter) JUnitXMLReporter(org.testng.reporters.JUnitXMLReporter) ISuite(org.testng.ISuite) TestRunner(org.testng.TestRunner) ITestRunnerFactory(org.testng.ITestRunnerFactory) XmlTest(org.testng.xml.XmlTest) List(java.util.List)

Aggregations

List (java.util.List)1 ISuite (org.testng.ISuite)1 ITestRunnerFactory (org.testng.ITestRunnerFactory)1 TestRunner (org.testng.TestRunner)1 JUnitXMLReporter (org.testng.reporters.JUnitXMLReporter)1 TestHTMLReporter (org.testng.reporters.TestHTMLReporter)1 XmlTest (org.testng.xml.XmlTest)1