本文整理了Java中org.testng.TestNG.setConfigFailurePolicy()
方法的一些代码示例,展示了TestNG.setConfigFailurePolicy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TestNG.setConfigFailurePolicy()
方法的具体详情如下:
包路径:org.testng.TestNG
类名称:TestNG
方法名:setConfigFailurePolicy
暂无
代码示例来源:origin: org.testng/testng
/**
* @deprecated Use {@link #setConfigFailurePolicy(org.testng.xml.XmlSuite.FailurePolicy)} instead
*/
@Deprecated
public void setConfigFailurePolicy(String failurePolicy) {
setConfigFailurePolicy(XmlSuite.FailurePolicy.getValidPolicy(failurePolicy));
}
代码示例来源:origin: cbeust/testng
@Test(description = "GITHUB-990")
public void ensureConfigurationRunsFromBaseClass() {
TestNG testng = create(ChildClassSample.class);
testng.setConfigFailurePolicy(XmlSuite.FailurePolicy.CONTINUE);
testng.run();
assertThat(AbstractBaseSample.messages).containsExactly("cleanup");
}
}
代码示例来源:origin: cbeust/testng
@Test(dataProvider = "dp")
public void reproduceIssue(XmlSuite.FailurePolicy policy, String[] expectedMsgs) {
TestNG testNG = create(ExampleClassSample.class);
testNG.setConfigFailurePolicy(policy);
ExampleClassListener listener = new ExampleClassListener();
testNG.addListener(listener);
testNG.run();
String[] expected = new String[]{
"beforeInvocation:_test_method: test1", "afterInvocation:_test_method: test1",
"beforeInvocation:_test_method: test2", "afterInvocation:_test_method: test2"
};
assertThat(listener.messages).containsExactly(expected);
assertThat(listener.configMsgs).containsExactly(expectedMsgs);
}
代码示例来源:origin: cbeust/testng
private static void runTest(Class<?> clazz, String groups, boolean shouldContinue, String expected) {
XmlSuite xmlsuite = createXmlSuite("sample_suite", "sample_test", clazz);
xmlsuite.addIncludedGroup(groups);
TestNG testng = create(xmlsuite);
if (shouldContinue) {
testng.setConfigFailurePolicy(FailurePolicy.CONTINUE);
}
LocalConfigListener listener = new LocalConfigListener();
testng.addListener(listener);
testng.run();
assertThat(listener.getMessages()).containsExactly(expected);
}
代码示例来源:origin: cbeust/testng
@Test(dataProvider = "dp")
public void testListenerInvocation(Class<?> clazz, XmlSuite.FailurePolicy policy, List<String> expected) {
TestNG tng = create(clazz);
ListenerForIssue1602 listener = new ListenerForIssue1602();
tng.setConfigFailurePolicy(policy);
tng.setVerbose(2);
tng.addListener(listener);
tng.run();
assertThat(listener.getLogs()).containsExactlyElementsOf(expected);
}
代码示例来源: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: org.testng/testng
setConfigFailurePolicy(cla.configFailurePolicy);
代码示例来源:origin: cbeust/testng
setConfigFailurePolicy(XmlSuite.FailurePolicy.getValidPolicy(cla.configFailurePolicy));
代码示例来源:origin: cbeust/testng
@Test(dataProvider = "dp")
public void confFailureTest(
Class[] classesUnderTest,
int configurationFailures,
int configurationSkips,
int skippedTests) {
TestListenerAdapter tla = new TestListenerAdapter();
TestNG testng = new TestNG();
testng.setOutputDirectory(OutputDirectoryPatch.getOutputDirectory());
testng.setTestClasses(classesUnderTest);
testng.addListener(tla);
testng.setVerbose(0);
testng.setConfigFailurePolicy(XmlSuite.FailurePolicy.CONTINUE);
testng.run();
verify(tla, configurationFailures, configurationSkips, skippedTests);
}
内容来源于网络,如有侵权,请联系作者删除!