@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; }
@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) { 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; }
@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; }
@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; }
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); }
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); }
@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; }
@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; }
@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; }
@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; }
@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()); } }
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()); }
/** * 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 } }; } }
@BeforeTest(alwaysRun = true) public void beforeTest(ITestContext testContext) { TestRunner tr = (TestRunner) testContext; tr.setMethodInterceptor(new TestMultiplier()); }