Search in sources :

Example 11 with XmlClass

use of org.testng.xml.XmlClass in project intellij-community by JetBrains.

the class TestNGTreeHierarchyTest method doTest.

private static void doTest(XmlSuite suite, String expected) {
    final StringBuffer buf = new StringBuffer();
    final IDEATestNGRemoteListener listener = createListener(buf);
    for (XmlTest test : suite.getTests()) {
        for (XmlClass aClass : test.getClasses()) {
            final String classFQName = aClass.getName();
            for (XmlInclude include : aClass.getIncludedMethods()) {
                final String methodName = include.getName();
                List<Integer> numbers = include.getInvocationNumbers();
                if (numbers.isEmpty()) {
                    numbers = Collections.singletonList(0);
                }
                for (Integer integer : numbers) {
                    final MockTestNGResult result = new MockTestNGResult(classFQName, methodName, null, new Object[] { integer });
                    listener.onTestStart(result);
                    listener.onTestFinished(result);
                }
            }
        }
    }
    Assert.assertEquals("output: " + buf, expected, StringUtil.convertLineSeparators(buf.toString()));
}
Also used : XmlInclude(org.testng.xml.XmlInclude) XmlTest(org.testng.xml.XmlTest) IDEATestNGRemoteListener(org.testng.IDEATestNGRemoteListener) XmlClass(org.testng.xml.XmlClass)

Aggregations

XmlClass (org.testng.xml.XmlClass)11 XmlTest (org.testng.xml.XmlTest)11 XmlSuite (org.testng.xml.XmlSuite)8 XmlInclude (org.testng.xml.XmlInclude)6 ArrayList (java.util.ArrayList)3 File (java.io.File)2 Test (org.junit.Test)2 ParameterException (com.beust.jcommander.ParameterException)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 List (java.util.List)1 JarEntry (java.util.jar.JarEntry)1 JarFile (java.util.jar.JarFile)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 IDEATestNGRemoteListener (org.testng.IDEATestNGRemoteListener)1 ITestAnnotation (org.testng.annotations.ITestAnnotation)1 IAnnotationFinder (org.testng.internal.annotations.IAnnotationFinder)1 Parser (org.testng.xml.Parser)1 SAXException (org.xml.sax.SAXException)1