Is this possible to exclude classes in testng.xml?
I tried with
As workaround, you can add pseudo groups to the each test with name, equals test method or test class via annotation transformer
public class TestNGAnnotationTransformer implements IAnnotationTransformer {
@Override
public void transform(ITestAnnotation annotation, Class testClass, Constructor testConstructor, Method testMethod) {
if (testMethod == null || annotation == null) {
return;
}
String pseudoGroupClass = testMethod.getDeclaringClass().getSimpleName();
String pseudoGroupMethod = pseudoGroupClass + "." + testMethod.getName();
String[] existingGroups = annotation.getGroups();
String[] extendedGroups;
if (existingGroups == null) {
extendedGroups = new String[] { pseudoGroupClass, pseudoGroupMethod };
} else {
List tmp = new ArrayList();
for (String group : existingGroups) {
tmp.add(group);
}
tmp.add(pseudoGroupClass);
tmp.add(pseudoGroupMethod);
extendedGroups = tmp.toArray(new String[0]);
}
annotation.setGroups(extendedGroups);
}
}
and use it in your testng.xml