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

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

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

TestNG.getReporters介绍

暂无

代码示例

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

@Test
public void testPruningOfDuplicateReporter() {
  XmlSuite xmlSuite = createXmlSuite("Suite");
  XmlTest xmlTest = createXmlTest(xmlSuite, "Test");
  createXmlClass(xmlTest, UniqueReporterInjectionSample1.class);
  createXmlClass(xmlTest, UniqueReporterInjectionSample2.class);
  TestNG tng = create(xmlSuite);
  tng.setUseDefaultListeners(false);
  tng.addListener((ITestNGListener) new ReporterListenerForIssue1227());
  tng.run();
  //Since we have another reporting listener that is injected via the service loader file
  //reporting listeners size will now have to be three (because the ExitCodeListener is also a reporter backed listener).
  Assert.assertEquals(tng.getReporters().size(),3);
  Assert.assertEquals(ReporterListenerForIssue1227.counter, 1);
}

代码示例来源:origin: salesforce/dockerfile-image-update

public void start() {
  IReporter stdoutReporter = new StdOutReporter();
  TestListenerAdapter tla = new TestListenerAdapter();
  TestNG testNG = new TestNG();
  testNG.setOutputDirectory(TEST_PATH);
  testNG.getReporters().add(stdoutReporter);
  testNG.setTestClasses(new Class[]{TestCollector.class});
  testNG.addListener(tla);
  testNG.run();
  if (testNG.hasFailure()) {
    log.error("Test(s) have failed see output above");
    System.exit(2);
  }
}

相关文章

TestNG类方法