Create Xml virtual file

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Create Xml virtual file

nguyenki
Hi, i would like to create a virtual  file of the following xml file in testNG
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
 <suite name="TEST Suite" verbose="1" >
  <listeners>
    <listener class-name="com.FiftyFive.app.MyTransformer"/>
  </listeners>
    
  <test name="DashBord Test">
  <groups>
      <run>
       <include name = "Login"/>
        <include name = "Debug"/>
     </run>
  </groups>
   <classes>
       <class name="com.FiftyFive.app.AppTest"/>
       <class name="com.FiftyFive.app.VerifyAnnotationTransformer"/>
     </classes>
  </test>
</suite>
I can specify the classes name, name of suite, but i dont know how to specify the listener and groups
For the moment, my virtual file is just like that:
        XmlSuite suite = new XmlSuite();
    suite.setName(suiteName);
    XmlTest test = new XmlTest();
    test.setName("DashBord Test");
    List<XmlClass> classes = new ArrayList<XmlClass>();
    classes.add(new XmlClass("com.FiftyFive.app.AppTest"));
    classes.add(new XmlClass("com.FiftyFive.app.VerifyAnnotationTransformer"));
    test.setXmlClasses(classes);
    List<XmlTest> tests = new ArrayList<XmlTest>();
    tests.add(test);
    suite.setTests(tests);
    return suite;
 
  Any suggestions?
Thanks.


--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Create Xml virtual file

⇜Krishnan Mahadevan⇝
Would the below solve the purpose for your requirement ?

XmlSuite suite = new XmlSuite();
suite.setName("MySuiteName");
XmlTest test = new XmlTest();
test.setName("DashBord Test");
List<XmlClass> classes = new ArrayList<XmlClass>();
classes.add(new XmlClass("com.FiftyFive.app.AppTest"));
classes.add(new XmlClass("com.FiftyFive.app.VerifyAnnotationTransformer"));
test.setXmlClasses(classes);
ArrayList<String> groupsToRun = new ArrayList<String>();
test.setIncludedGroups(groupsToRun); // Adding the included groups to be executed
List<XmlTest> tests = new ArrayList<XmlTest>();
tests.add(test);
suite.setTests(tests);
suite.addListener("com.test.myListener"); //Configuring the Listeners here.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"




On Mon, Aug 20, 2012 at 5:09 PM, nguyenkim thuat <[hidden email]> wrote:
Hi, i would like to create a virtual  file of the following xml file in testNG
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
 <suite name="TEST Suite" verbose="1" >
  <listeners>
    <listener class-name="com.FiftyFive.app.MyTransformer"/>
  </listeners>
    
  <test name="DashBord Test">
  <groups>
      <run>
       <include name = "Login"/>
        <include name = "Debug"/>
     </run>
  </groups>
   <classes>
       <class name="com.FiftyFive.app.AppTest"/>
       <class name="com.FiftyFive.app.VerifyAnnotationTransformer"/>
     </classes>
  </test>
</suite>
I can specify the classes name, name of suite, but i dont know how to specify the listener and groups
For the moment, my virtual file is just like that:
        XmlSuite suite = new XmlSuite();
    suite.setName(suiteName);
    XmlTest test = new XmlTest();
    test.setName("DashBord Test");
    List<XmlClass> classes = new ArrayList<XmlClass>();
    classes.add(new XmlClass("com.FiftyFive.app.AppTest"));
    classes.add(new XmlClass("com.FiftyFive.app.VerifyAnnotationTransformer"));
    test.setXmlClasses(classes);
    List<XmlTest> tests = new ArrayList<XmlTest>();
    tests.add(test);
    suite.setTests(tests);
    return suite;
 
  Any suggestions?
Thanks.


--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.