org.testng.TestNG.setListenerClasses()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(187)

本文整理了Java中org.testng.TestNG.setListenerClasses()方法的一些代码示例,展示了TestNG.setListenerClasses()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TestNG.setListenerClasses()方法的具体详情如下:
包路径:org.testng.TestNG
类名称:TestNG
方法名:setListenerClasses

TestNG.setListenerClasses介绍

[英]Define which listeners to user for this run.
[中]定义要为此运行使用的侦听器。

代码示例

代码示例来源:origin: cbeust/testng

@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);
//    }
 }

代码示例来源:origin: org.testng/testng

setListenerClasses(classes);

代码示例来源:origin: cbeust/testng

setListenerClasses(classes);

代码示例来源:origin: apache/maven-surefire

@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 ) );
}

代码示例来源:origin: org.apache.maven.surefire/surefire-testng

@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 ) );
}

代码示例来源:origin: stackoverflow.com

@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();
}

相关文章

TestNG类方法