@Test(description = "Make sure only one listener is created and not 2^3") public void run() { final TestNG tng = new TestNG(); tng.setUseDefaultListeners(false); tng.setListenerClasses(Arrays.asList(TestListenerAdapter.class, SimpleReporter.class)); final List<XmlSuite> suites = createSuites(); tng.setXmlSuites(suites); tng.setVerbose(0); tng.run(); // Reporter.log(tng.getSuiteListeners().size() + "", true); // for (final XmlSuite xmlSuite : suites) // { // Reporter.log(xmlSuite.getName() + ": " + xmlSuite.getListeners().size(), true); // } }
setListenerClasses(classes);
@Override public void configure( TestNG testng, Map<String, String> options ) throws TestSetFailedException { System.out.println( "\n\n\n\nCONFIGURING TESTNG\n\n\n\n" ); // kind of ugly, but listeners are configured differently final String listeners = options.remove( "listener" ); // DGF In 4.7, default listeners dump XML files in the surefire-reports directory, // confusing the report plugin. This was fixed in later versions. testng.setUseDefaultListeners( false ); configureInstance( testng, options ); // TODO: we should have the Profile so that we can decide if this is needed or not testng.setListenerClasses( loadListenerClasses( listeners ) ); }
@Override public void configure( TestNG testng, Map<String, String> options ) throws TestSetFailedException { System.out.println( "\n\n\n\nCONFIGURING TESTNG\n\n\n\n" ); // kind of ugly, but listeners are configured differently final String listeners = options.remove( "listener" ); // DGF In 4.7, default listeners dump XML files in the surefire-reports directory, // confusing the report plugin. This was fixed in later versions. testng.setUseDefaultListeners( false ); configureInstance( testng, options ); // TODO: we should have the Profile so that we can decide if this is needed or not testng.setListenerClasses( loadListenerClasses( listeners ) ); }
@BeforeSuite public static void TestSuite() { TestNG testNG = new TestNG(); List<Class> listnerClasses = new ArrayList<Class>(); List<String> suiteNameList = new ArrayList<String>(); Class[] classList = new Class[]{ ManagementClient.class, ProcessManagementClient.class, DeployClient.class, RedeployClient.class}; listnerClasses.add(org.wso2.platform.test.core.PlatformTestManager.class); listnerClasses.add(org.wso2.platform.test.core.PlatformSuiteManager.class); testNG.setDefaultSuiteName("suite"); testNG.setListenerClasses(listnerClasses); testNG.setTestClasses(classList); testNG.run(); }