本文整理汇总了Java中org.testng.xml.XmlSuite.setName方法的典型用法代码示例。如果您正苦于以下问题:Java XmlSuite.setName方法的具体用法?Java XmlSuite.setName怎么用?Java XmlSuite.setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.testng.xml.XmlSuite
的用法示例。
在下文中一共展示了XmlSuite.setName方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tests
import org.testng.xml.XmlSuite; //导入方法依赖的package包/类
@Override
public File tests() throws SuiteException {
XmlSuite xmlSuite = new XmlSuite();
xmlSuite.setName(SUITE_NAME);
try {
for (SunshineTest sunshineTest : this.artifacts.tests()) {
XmlTest test = new TestNGTest(sunshineTest).object();
test.setSuite(xmlSuite);
xmlSuite.addTest(test);
}
this.suiteXml.write(xmlSuite.toXml());
return this.suiteXml;
} catch (TestException | IOException e) {
throw new SuiteException(e);
}
}
示例2: getXmlSuite
import org.testng.xml.XmlSuite; //导入方法依赖的package包/类
private XmlSuite getXmlSuite()
{
// we cannot use singletonLists here as testNG later
// modifies lists stored in XmlSuite ... zonk
XmlSuite testSuite = new XmlSuite();
testSuite.setName("tempto-tests");
testSuite.setFileName("tempto-tests");
XmlTest test = new XmlTest(testSuite);
test.setName("all");
XmlPackage testPackage = new XmlPackage(options.getTestsPackage());
List<XmlPackage> testPackages = newArrayList(testPackage);
test.setPackages(testPackages);
XmlClass conventionBasedTestsClass = new XmlClass("io.prestodb.tempto.internal.convention.ConventionBasedTestFactory");
List<XmlClass> classes = newArrayList(conventionBasedTestsClass);
test.setClasses(classes);
test.setParallel(XmlSuite.ParallelMode.METHODS);
return testSuite;
}
示例3: createSuites
import org.testng.xml.XmlSuite; //导入方法依赖的package包/类
/**
* Creates the suite list with given parameters.
*
* @param logLevels
* @param suite
* @return
*/
private List<XmlSuite> createSuites(String logLevels, XmlSuite suite) {
String[] levels = logLevels.split(",");
ArrayList<XmlSuite> result = new ArrayList<>();
for (String level : levels) {
level = level.trim();
if (StringUtils.isNotEmpty(level)) {
suite.getParameters().put(LOG_LEVEL_PARAM_NAME, level);
}
XmlSuite suite1 = (XmlSuite) suite.clone();
suite1.setName(suite1.getName() + "-" + level);
result.add(suite1);
}
return result;
}
示例4: runTests
import org.testng.xml.XmlSuite; //导入方法依赖的package包/类
public void runTests(KWDTestCase kwdTestCase, String testSuiteName, String outputDirectory) {
this.kwdTestCase = kwdTestCase;
XmlSuite suite = new XmlSuite();
suite.setName(testSuiteName);
XmlTest xmlTest = new XmlTest(suite);
xmlTest.setName(kwdTestCase.getTestCaseName());
xmlTest.setVerbose(0);
System.out.println("Total number of Tests to be run: " + kwdTestCase.getTestMethods().size());
{
XmlClass xmlClass = new XmlClass("com.carteblanche.kwd.testng.TestNGDriver");
xmlTest.getClasses().add(xmlClass);
List<XmlInclude> xmlIncludeMethods = xmlClass.getIncludedMethods();
XmlInclude xmlInclude = new XmlInclude("runnableTest");
xmlIncludeMethods.add(xmlInclude);
xmlClass.setIncludedMethods(xmlIncludeMethods);
}
System.out.println("Running Tests using command ..");
testNG.setXmlSuites(Arrays.asList(suite));
testNG.setPreserveOrder(true);
testNG.setUseDefaultListeners(true);
testNG.setOutputDirectory(outputDirectory);
testNG.run();
}
示例5: constructXmlSuiteForParallel
import org.testng.xml.XmlSuite; //导入方法依赖的package包/类
public XmlSuite constructXmlSuiteForParallel(String pack, List<String> testcases,
Map<String, List<Method>> methods,
int deviceCount, ArrayList<String> deviceSerail) {
ArrayList<String> listeners = new ArrayList<>();
listeners.add("com.appium.manager.AppiumParallelTestListener");
listeners.add("com.appium.utils.RetryListener");
include(listeners, "LISTENERS");
include(groupsInclude, "INCLUDE_GROUPS");
include(groupsExclude, "EXCLUDE_GROUPS");
XmlSuite suite = new XmlSuite();
suite.setName("TestNG Forum");
suite.setThreadCount(deviceCount);
suite.setDataProviderThreadCount(deviceCount);
suite.setParallel(ParallelMode.TESTS);
suite.setVerbose(2);
suite.setListeners(listeners);
for (int i = 0; i < deviceCount; i++) {
XmlTest test = new XmlTest(suite);
test.setName("TestNG Test" + i);
test.setPreserveOrder("false");
test.addParameter("device", deviceSerail.get(i));
test.setIncludedGroups(groupsInclude);
test.setExcludedGroups(groupsExclude);
List<XmlClass> xmlClasses = new ArrayList<>();
writeXmlClass(testcases, methods, xmlClasses);
test.setXmlClasses(xmlClasses);
}
System.out.println(suite.toXml());
writeTestNGFile(suite);
return suite;
}
示例6: constructXmlSuiteForDistribution
import org.testng.xml.XmlSuite; //导入方法依赖的package包/类
public XmlSuite constructXmlSuiteForDistribution(String pack, List<String> tests,
Map<String, List<Method>> methods,
int deviceCount) {
include(listeners, "LISTENERS");
include(groupsInclude, "INCLUDE_GROUPS");
XmlSuite suite = new XmlSuite();
suite.setName("TestNG Forum");
suite.setThreadCount(deviceCount);
suite.setParallel(ParallelMode.CLASSES);
suite.setVerbose(2);
listeners.add("com.appium.manager.AppiumParallelMethodTestListener");
listeners.add("com.appium.utils.RetryListener");
suite.setListeners(listeners);
if (prop.getProperty("LISTENERS") != null) {
suite.setListeners(listeners);
}
XmlTest test = new XmlTest(suite);
test.setName("TestNG Test");
test.addParameter("device", "");
include(groupsExclude, "EXCLUDE_GROUPS");
test.setIncludedGroups(groupsInclude);
test.setExcludedGroups(groupsExclude);
List<XmlClass> xmlClasses = new ArrayList<>();
writeXmlClass(tests, methods, xmlClasses);
test.setXmlClasses(xmlClasses);
System.out.println(suite.toXml());
writeTestNGFile(suite);
return suite;
}
示例7: constructXmlSuiteForDistributionMethods
import org.testng.xml.XmlSuite; //导入方法依赖的package包/类
public XmlSuite constructXmlSuiteForDistributionMethods(String pack, List<String> tests,
Map<String, List<Method>> methods,
int deviceCount) {
include(listeners, "LISTENERS");
include(groupsInclude, "INCLUDE_GROUPS");
XmlSuite suite = new XmlSuite();
suite.setName("TestNG Forum");
suite.setThreadCount(deviceCount);
suite.setDataProviderThreadCount(deviceCount);
suite.setVerbose(2);
suite.setParallel(ParallelMode.METHODS);
listeners.add("com.appium.manager.AppiumParallelMethodTestListener");
listeners.add("com.appium.utils.RetryListener");
suite.setListeners(listeners);
if (prop.getProperty("LISTENERS") != null) {
suite.setListeners(listeners);
}
List<XmlClass> xmlClasses = new ArrayList<>();
xmlClasses = writeXmlClass(tests, methods, xmlClasses);
XmlTest test = new XmlTest(suite);
test.setName("TestNG Test");
test.addParameter("device", "");
include(groupsExclude, "EXCLUDE_GROUPS");
test.setIncludedGroups(groupsInclude);
test.setExcludedGroups(groupsExclude);
List<XmlClass> writeXml = new ArrayList<>();
for (int i = 0; i < xmlClasses.size(); i++) {
writeXml.add(new XmlClass(xmlClasses.get(i).getName()));
test.setClasses(writeXml);
}
System.out.println(suite.toXml());
writeTestNGFile(suite);
return suite;
}
示例8: createSuite
import org.testng.xml.XmlSuite; //导入方法依赖的package包/类
private XmlSuite createSuite() {
final XmlSuite suite = new XmlSuite();
suite.setName(this.clazz.getName());
suite.setSkipFailedInvocationCounts(true);
final XmlTest test = new XmlTest(suite);
test.setName(this.clazz.getName());
final XmlClass xclass = new XmlClass(this.clazz.getName());
test.setXmlClasses(Collections.singletonList(xclass));
if (!this.includedTestMethods.isEmpty()) {
List<XmlInclude> xmlIncludedTestMethods = new ArrayList<>();
for (String includedTestMethod : includedTestMethods) {
XmlInclude includedMethod = new XmlInclude(includedTestMethod);
xmlIncludedTestMethods.add(includedMethod);
}
xclass.setIncludedMethods(xmlIncludedTestMethods);
}
if (!this.config.getExcludedGroups().isEmpty()) {
suite.setExcludedGroups(this.config.getExcludedGroups());
}
if (!this.config.getIncludedGroups().isEmpty()) {
suite.setIncludedGroups(this.config.getIncludedGroups());
}
return suite;
}
示例9: createSuite
import org.testng.xml.XmlSuite; //导入方法依赖的package包/类
private static XmlSuite createSuite(String testName) {
XmlSuite suite = new XmlSuite();
suite.setName(SUITE_PREFIX + testName);
XmlTest test = new XmlTest(suite);
test.setName(testName);
List<XmlClass> classes = new ArrayList<>();
classes.add(new XmlClass(ConfigMethodsTest.class));
test.setXmlClasses(classes);
return suite;
}
示例10: createXmlSuite
import org.testng.xml.XmlSuite; //导入方法依赖的package包/类
protected XmlSuite createXmlSuite(String name) {
XmlSuite result = new XmlSuite();
result.setName(name);
return result;
}
示例11: checkHealth
import org.testng.xml.XmlSuite; //导入方法依赖的package包/类
private void checkHealth(ISuite suite, String className, String[] methods) {
if (className.isEmpty()) {
return;
}
// create runtime XML suite for health check
XmlSuite xmlSuite = new XmlSuite();
xmlSuite.setName("HealthCheck XmlSuite - " + className);
XmlTest xmltest = new XmlTest(xmlSuite);
xmltest.setName("HealthCheck TestCase");
XmlClass healthCheckClass = new XmlClass();
healthCheckClass.setName(className);
// TestNG do not execute missed methods so we have to calulate expected methods count to handle potential mistakes in methods naming
int expectedMethodsCount = -1;
if (methods != null) {
// declare particular methods if they are provided
List<XmlInclude> methodsToRun = constructIncludes(methods);
expectedMethodsCount = methodsToRun.size();
healthCheckClass.setIncludedMethods(methodsToRun);
}
xmltest.setXmlClasses(Arrays.asList(new XmlClass[] { healthCheckClass }));
xmlSuite.setTests(Arrays.asList(new XmlTest[] { xmltest }));
LOGGER.info("HealthCheck '" + className + "' is started.");
LOGGER.debug("HealthCheck suite content:" + xmlSuite.toXml());
// Second TestNG process to run HealthCheck
TestNG testng = new TestNG();
testng.setXmlSuites(Arrays.asList(xmlSuite));
TestListenerAdapter tla = new TestListenerAdapter();
testng.addListener(tla);
testng.run();
synchronized (this) {
boolean passed = false;
if (expectedMethodsCount == -1) {
if (tla.getPassedTests().size() > 0 && tla.getFailedTests().size() == 0
&& tla.getSkippedTests().size() == 0) {
passed = true;
}
} else {
LOGGER.info("Expected passed tests count: " + expectedMethodsCount);
if (tla.getPassedTests().size() == expectedMethodsCount && tla.getFailedTests().size() == 0
&& tla.getSkippedTests().size() == 0) {
passed = true;
}
}
if (passed) {
LOGGER.info("HealthCheck suite '" + className + "' is finished successfully.");
} else {
throw new SkipException("Skip test(s) due to health check failures for '" + className + "'");
}
}
}