Tuesday, May 22, 2012

Run tesng programatically

        XmlSuite xml = new XmlSuite();
        xml.setName("Test");

        XmlTest test = new XmlTest(xml);
        test.setName("Sample Test");
        List<XmlClass> classes = new ArrayList<XmlClass>();
        classes.add(new XmlClass("main.Sample"));
        test.setXmlClasses(classes);

        List<XmlSuite> suites = new ArrayList<XmlSuite>();
        suites.add(xml);
        TestNG tng = new TestNG();
        tng.setXmlSuites(suites);
        tng.run();

No comments:

Post a Comment