You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The graph based dependency evaluation ist wrong, when one of the found classes does not contain any test methods. This can be the case if the package name is not only for testng tests, but can contain services etc. In this scenario the following method from the TestRunner:
privateListMultiMap<ITestNGMethod, ITestNGMethod> createClassDependencies(
ITestNGMethod[] methods, XmlTesttest)
{
Map<String, List<ITestNGMethod>> classes = Maps.newHashMap();
// Note: use a List here to preserve the ordering but make sure// we don't add the same class twiceList<XmlClass> sortedClasses = Lists.newArrayList();
for (XmlClassc : test.getXmlClasses()) {
classes.put(c.getName(), newArrayList<ITestNGMethod>());
if (! sortedClasses.contains(c)) sortedClasses.add(c);
}
// Sort the classes based on their order of appearance in the XMLCollections.sort(sortedClasses, newComparator<XmlClass>() {
@Overridepublicintcompare(XmlClassarg0, XmlClassarg1) {
returnarg0.getIndex() - arg1.getIndex();
}
});
Map<String, Integer> indexedClasses1 = Maps.newHashMap();
Map<Integer, String> indexedClasses2 = Maps.newHashMap();
inti = 0;
for (XmlClassc : sortedClasses) {
indexedClasses1.put(c.getName(), i);
indexedClasses2.put(i, c.getName());
i++;
}
ListMultiMap<String, ITestNGMethod> methodsFromClass = Maps.newListMultiMap();
for (ITestNGMethodm : methods) {
methodsFromClass.put(m.getTestClass().getName(), m);
}
ListMultiMap<ITestNGMethod, ITestNGMethod> result = Maps.newListMultiMap();
for (ITestNGMethodm : methods) {
Stringname = m.getTestClass().getName();
Integerindex = indexedClasses1.get(name);
// The index could be null if the classes listed in the XML are different// from the methods being run (e.g. the .xml only contains a factory that// instantiates methods from a different class). In this case, we cannot// perform any ordering.if (index != null && index > 0) {
// Make this method depend on all the methods of the class in the previous// indexStringclassDependedUpon = indexedClasses2.get(index - 1);
List<ITestNGMethod> methodsDependedUpon = methodsFromClass.get(classDependedUpon);
if (methodsDependedUpon != null) {
for (ITestNGMethodmdu : methodsDependedUpon) {
result.put(mdu, m);
}
}
}
}
returnresult;
}
creates no method dependencies when the successor class is not a test class with test methods. This results in a broken dependency tree for all following test methods. The intended behavior is that any method of a test class depends on all methods of the successor class!
Possible solutions are:
To not depend on "test.getXmlClasses()" to determine the sequence of possible classes (sortedClasses), but to use an indirect way with an iteration over all test methods and extract a list of test classes while iteration.
Extend the looping at the end to not only find a successor test class with -1, but iterate backwards so long until at least one successor test class with one active test method is found.
If desired, i can provide a pull request.
The text was updated successfully, but these errors were encountered:
When using a testng.xml definition file, which contains a test definition with package based scanning of test classes. Like:
The graph based dependency evaluation ist wrong, when one of the found classes does not contain any test methods. This can be the case if the package name is not only for testng tests, but can contain services etc. In this scenario the following method from the TestRunner:
creates no method dependencies when the successor class is not a test class with test methods. This results in a broken dependency tree for all following test methods. The intended behavior is that any method of a test class depends on all methods of the successor class!
Possible solutions are:
If desired, i can provide a pull request.
The text was updated successfully, but these errors were encountered: