use of org.testng.xml.XmlTest in project powermock by powermock.
the class SimpleBaseTest method createXmlTest.
protected XmlTest createXmlTest(XmlSuite suite, String name, String... classes) {
XmlTest result = new XmlTest(suite);
int index = 0;
result.setName(name);
for (String c : classes) {
XmlClass xc = new XmlClass(c, index++, true);
result.getXmlClasses().add(xc);
}
return result;
}
use of org.testng.xml.XmlTest in project powermock by powermock.
the class SimpleBaseTest method createXmlTest.
protected XmlTest createXmlTest(XmlSuite suite, String name, Class clazz, Class... classes) {
XmlTest result = new XmlTest(suite);
int index = 0;
result.setName(name);
XmlClass xc = new XmlClass(clazz.getName(), index++, true);
result.getXmlClasses().add(xc);
for (Class c : classes) {
xc = new XmlClass(c.getName(), index++, true);
result.getXmlClasses().add(xc);
}
return result;
}
use of org.testng.xml.XmlTest in project druid by druid-io.
the class TestNG method createSuiteRunners.
/**
* Creates the {@code SuiteRunner}s and populates the suite runner map with
* this information
*
* @param suiteRunnerMap Map with XMLSuite as key and it's respective
* SuiteRunner as value. This is updated as part of this method call
* @param xmlSuite Xml Suite (and its children) for which {@code SuiteRunner}s are created
*/
private void createSuiteRunners(SuiteRunnerMap suiteRunnerMap, /* OUT */
XmlSuite xmlSuite) {
if (null != m_isJUnit && !m_isJUnit.equals(XmlSuite.DEFAULT_JUNIT)) {
xmlSuite.setJUnit(m_isJUnit);
}
// takes precedence
if (null != m_skipFailedInvocationCounts) {
xmlSuite.setSkipFailedInvocationCounts(m_skipFailedInvocationCounts);
}
// Override the XmlSuite verbose value with the one from TestNG
if (m_verbose != null) {
xmlSuite.setVerbose(m_verbose);
}
if (null != m_configFailurePolicy) {
xmlSuite.setConfigFailurePolicy(m_configFailurePolicy);
}
for (XmlTest t : xmlSuite.getTests()) {
for (Map.Entry<String, Integer> ms : m_methodDescriptors.entrySet()) {
XmlMethodSelector xms = new XmlMethodSelector();
xms.setName(ms.getKey());
xms.setPriority(ms.getValue());
t.getMethodSelectors().add(xms);
}
}
suiteRunnerMap.put(xmlSuite, createSuiteRunner(xmlSuite));
for (XmlSuite childSuite : xmlSuite.getChildSuites()) {
createSuiteRunners(suiteRunnerMap, childSuite);
}
}
use of org.testng.xml.XmlTest in project druid by druid-io.
the class TestNG method checkTestNames.
/**
* Ensure that two XmlTest within the same XmlSuite don't have the same name
*/
private void checkTestNames(List<XmlSuite> suites) {
for (XmlSuite suite : suites) {
Set<String> testNames = Sets.newHashSet();
for (XmlTest test : suite.getTests()) {
if (testNames.contains(test.getName())) {
throw new TestNGException("Two tests in the same suite " + "cannot have the same name: " + test.getName());
} else {
testNames.add(test.getName());
}
}
checkTestNames(suite.getChildSuites());
}
}
use of org.testng.xml.XmlTest in project intellij-community by JetBrains.
the class IDEARemoteTestNG method run.
public void run() {
try {
initializeSuitesAndJarFile();
List<XmlSuite> suites = Lists.newArrayList();
calculateAllSuites(m_suites, suites);
if (suites.size() > 0) {
for (XmlSuite suite : suites) {
final List<XmlTest> tests = suite.getTests();
for (XmlTest test : tests) {
try {
if (myParam != null) {
for (XmlClass aClass : test.getXmlClasses()) {
List<XmlInclude> includes = new ArrayList<XmlInclude>();
for (XmlInclude include : aClass.getIncludedMethods()) {
includes.add(new XmlInclude(include.getName(), Collections.singletonList(Integer.parseInt(myParam)), 0));
}
aClass.setIncludedMethods(includes);
}
}
} catch (NumberFormatException e) {
System.err.println("Invocation number: expected integer but found: " + myParam);
}
}
}
attachListeners(new IDEATestNGRemoteListener());
super.run();
System.exit(0);
} else {
System.out.println("##teamcity[enteredTheMatrix]");
System.err.println("Nothing found to run");
}
} catch (Throwable cause) {
cause.printStackTrace(System.err);
}
}
Aggregations