1 package test.yaml; 2 3 import org.testng.Assert; 4 import org.testng.annotations.DataProvider; 5 import org.testng.annotations.Test; 6 import org.testng.xml.Parser; 7 import org.testng.xml.XmlSuite; 8 import org.xml.sax.SAXException; 9 10 import test.SimpleBaseTest; 11 12 import javax.xml.parsers.ParserConfigurationException; 13 14 import java.io.File; 15 import java.io.IOException; 16 import java.util.Collection; 17 18 public class YamlTest extends SimpleBaseTest { 19 20 @DataProvider dp()21 public Object[][] dp() { 22 return new Object[][] { 23 new Object[] { "a1" }, 24 new Object[] { "a2" }, 25 new Object[] { "a3" }, 26 new Object[] { "a4" }, 27 }; 28 } 29 30 @Test(dataProvider = "dp") compareFiles(String name)31 public void compareFiles(String name) 32 throws ParserConfigurationException, SAXException, IOException { 33 Collection<XmlSuite> s1 = 34 new Parser(getPathToResource("yaml" + File.separator + name + ".yaml")).parse(); 35 Collection<XmlSuite> s2 = 36 new Parser(getPathToResource("yaml" + File.separator + name + ".xml")).parse(); 37 38 Assert.assertEquals(s1, s2); 39 } 40 } 41