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

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

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

TestNG.alwaysRunListeners介绍

暂无

代码示例

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

@Test(description = GITHUB_1777)
public void testOnStartInvokedForSkippedTests() {
 TestNG testNG = create(TestClassSample.class);
 testNG.alwaysRunListeners(true);
 testNG.setConfigFailurePolicy(XmlSuite.FailurePolicy.CONTINUE);
 MyListener listener = new MyListener();
 testNG.addListener(listener);
 testNG.run();
 List<String> expectedTestMessages =
   Arrays.asList(
     "testStart_test_method: test1",
     "before_test_method: test1", "after_test_method: test1",
     "testSkipped_test_method: test1",
     "testStart_test_method: test2",
     "before_test_method: test2", "after_test_method: test2",
     "testSuccess_test_method: test2");
 assertThat(listener.tstMsgs).containsExactlyElementsOf(expectedTestMessages);
 List<String> expectedConfigMessages =
   Arrays.asList(
     "before_configuration_method: beforeMethod[test1]",
       "after_configuration_method: beforeMethod[test1]",
     "before_configuration_method: afterMethod[test1]",
       "after_configuration_method: afterMethod[test1]",
     "before_configuration_method: beforeMethod[test2]",
       "after_configuration_method: beforeMethod[test2]",
     "before_configuration_method: afterMethod[test2]",
       "after_configuration_method: afterMethod[test2]");
 assertThat(listener.cfgMsgs).containsExactlyElementsOf(expectedConfigMessages);
}

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

private static void runTest(List<String> expected, Class<?> clazz, boolean skipInvocationCount) {
 TestNG testng = create(clazz);
 testng.setSkipFailedInvocationCounts(skipInvocationCount);
 UniversalListener listener = new UniversalListener();
 testng.addListener(listener);
 testng.alwaysRunListeners(false);
 testng.run();
 Assertions.assertThat(listener.getMessages()).containsExactlyElementsOf(expected);
}

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

private static void runTest(List<String> expected, Class<?> clazz, boolean skipInvocationCount) {
 TestNG testng = create(clazz);
 testng.setSkipFailedInvocationCounts(skipInvocationCount);
 UniversalListener listener = new UniversalListener();
 testng.addListener(listener);
 testng.alwaysRunListeners(true);
 testng.run();
 Assertions.assertThat(listener.getMessages()).containsExactlyElementsOf(expected);
}

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

alwaysRunListeners(cla.alwaysRunListeners);

相关文章

TestNG类方法