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

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

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

TestNG.hasFailure介绍

暂无

代码示例

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

@Test
 public void testMethod() {
  String suite = "src/test/resources/parametertest/1417.xml";
  TestNG testNG = new TestNG();
  testNG.setTestSuites(Collections.singletonList(suite));
  testNG.run();
  Assert.assertFalse(testNG.hasFailure());
  Assert.assertFalse(testNG.hasSkip());
  Assert.assertEquals(AnotherTestClassSample.getInstance().getBrowsername(), "chrome");
  List<String> actual = YetAnotherTestClassSample.getInstance().getBrowsers();
  Assert.assertEquals(actual.size(), 2);
  Assert.assertEquals(actual, Arrays.asList("safari", "safari"));
 }
}

代码示例来源: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);
  }
}

代码示例来源:origin: prestodb/tempto

private void run()
{
  LOG.debug("running tempto with options: {}", options);
  if (options.isHelpRequested()) {
    parser.printHelpMessage();
    return;
  }
  XmlSuite testSuite = getXmlSuite();
  testSuite.setThreadCount(options.getThreadCount());
  setupTestsConfiguration();
  System.setProperty(CONVENTION_TESTS_DIR_KEY, options.getConventionTestsDirectory());
  TestNG testNG = new TestNG();
  testNG.setXmlSuites(singletonList(testSuite));
  testNG.setOutputDirectory(options.getReportDir());
  setupTestsFiltering(testNG);
  options.getConventionResultsDumpPath()
      .ifPresent(path -> System.setProperty(CONVENTION_TESTS_RESULTS_DUMP_PATH_KEY, path));
  testNG.run();
  if (testNG.hasFailure()) {
    System.exit(1);
  }
}

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

testNG.run();
if(testNG.hasFailure()) { // Throw an exception to make mvn goal fail
  throw new Exception("Failed Tests");

代码示例来源:origin: org.jboss.webbeans.tck/webbeans-tck-impl

@Override
public boolean runUnitTests()
{
 TestNG testNG = new TestNG();
 setXmlSuitePath(testNG);
 if (configuration.getTestSuite().getOutputDirectory() != null)
 {
   testNG.setOutputDirectory(configuration.getTestSuite().getOutputDirectory());
 }
 testNG.run();
 return !(testNG.hasFailure() || testNG.hasSkip());
}

相关文章

TestNG类方法