use of org.testng.xml.XmlSuite 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.XmlSuite in project druid by druid-io.
the class TestNG method runSuitesSequentially.
/**
* Recursively runs suites. Runs the children suites before running the parent
* suite. This is done so that the results for parent suite can reflect the
* combined results of the children suites.
*
* @param xmlSuite XML Suite to be executed
* @param suiteRunnerMap Maps {@code XmlSuite}s to respective {@code ISuite}
* @param verbose verbose level
* @param defaultSuiteName default suite name
*/
private void runSuitesSequentially(XmlSuite xmlSuite, SuiteRunnerMap suiteRunnerMap, int verbose, String defaultSuiteName) {
for (XmlSuite childSuite : xmlSuite.getChildSuites()) {
runSuitesSequentially(childSuite, suiteRunnerMap, verbose, defaultSuiteName);
}
SuiteRunnerWorker srw = new SuiteRunnerWorker(suiteRunnerMap.get(xmlSuite), suiteRunnerMap, verbose, defaultSuiteName);
srw.run();
}
use of org.testng.xml.XmlSuite in project druid by druid-io.
the class TestNG method populateSuiteGraph.
/**
* Populates the dynamic graph with the reverse hierarchy of suites. Edges are
* added pointing from child suite runners to parent suite runners, hence making
* parent suite runners dependent on all the child suite runners
*
* @param suiteGraph dynamic graph representing the reverse hierarchy of SuiteRunners
* @param suiteRunnerMap Map with XMLSuite as key and its respective SuiteRunner as value
* @param xmlSuite XML Suite
*/
private void populateSuiteGraph(DynamicGraph<ISuite> suiteGraph, /* OUT */
SuiteRunnerMap suiteRunnerMap, XmlSuite xmlSuite) {
ISuite parentSuiteRunner = suiteRunnerMap.get(xmlSuite);
if (xmlSuite.getChildSuites().isEmpty()) {
suiteGraph.addNode(parentSuiteRunner);
} else {
for (XmlSuite childSuite : xmlSuite.getChildSuites()) {
suiteGraph.addEdge(parentSuiteRunner, suiteRunnerMap.get(childSuite));
populateSuiteGraph(suiteGraph, suiteRunnerMap, childSuite);
}
}
}
use of org.testng.xml.XmlSuite in project druid by druid-io.
the class TestNG method checkSuiteNamesInternal.
private void checkSuiteNamesInternal(List<XmlSuite> suites, Set<String> names) {
for (XmlSuite suite : suites) {
final String name = suite.getName();
if (names.contains(name)) {
throw new TestNGException("Two suites cannot have the same name: " + name);
}
names.add(name);
checkSuiteNamesInternal(suite.getChildSuites(), names);
}
}
use of org.testng.xml.XmlSuite 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());
}
}
Aggregations