Search in sources :

Example 16 with XmlTest

use of org.testng.xml.XmlTest 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

XmlTest (org.testng.xml.XmlTest)16 XmlSuite (org.testng.xml.XmlSuite)12 XmlClass (org.testng.xml.XmlClass)11 XmlInclude (org.testng.xml.XmlInclude)6 ArrayList (java.util.ArrayList)3 File (java.io.File)2 List (java.util.List)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 Map (java.util.Map)1 JarEntry (java.util.jar.JarEntry)1 JarFile (java.util.jar.JarFile)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 IDEATestNGRemoteListener (org.testng.IDEATestNGRemoteListener)1 ISuite (org.testng.ISuite)1 ITestRunnerFactory (org.testng.ITestRunnerFactory)1 TestRunner (org.testng.TestRunner)1