0

I have the following code

    XmlSuite suite = new XmlSuite();
    suite.setName(sheet.substring(0, 3) + " Test Suite");

    for (int i = startRow; i <= endRow; i++) {
        XmlTest test = new XmlTest(suite);
        test.setName(sheet.substring(0, 3) + "_" + i);
        test.addParameter("Row", Integer.toString(i));
        test.addParameter("Sheet", sheet);      

        List<XmlClass> classes = new ArrayList<XmlClass>();
        classes.add(new XmlClass(testClass));
        test.setXmlClasses(classes);
    }

    suite.addListener("atu.testng.reports.listeners.ATUReportsListener");
    suite.addListener("atu.testng.reports.listeners.ConfigurationListener");
    suite.addListener("atu.testng.reports.listeners.MethodListener");

which produces the following XML file

 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
 <suite name="BCS Test Suite">
   <listeners>
     <listener class-     name="atu.testng.reports.listeners.ATUReportsListener"/>
     <listener class-name="atu.testng.reports.listeners.ConfigurationListener"/>
     <listener class-name="atu.testng.reports.listeners.MethodListener"/>
   </listeners>
   <test name="BCS_73">
     <parameter name="Row" value="73"/>
     <parameter name="Sheet" value="BCSSheet"/>
     <classes>
       <class name="com.mad.bcs.sprint4.BCSTestCase"/>
     </classes>
   </test> <!-- BCS_73 -->
 </suite> <!-- BCS Test Suite -->

as you can see the XML comments <!-- .* -->, and I am wondering how to avoid having those added to the XML file?

I have looked at TestNG javadocs, but searching for "comments" yielded zero results.

Part of the reason why I wish to avoid the comments is that you cannot nest XML comments for some reason. We like to comment out test case for debugging purposes at times.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Zaxxon
  • 182
  • 1
  • 4
  • 18

1 Answers1

0

No, currently you cannot change this behavior because it is hardcoded.

But you can ask for a way to configure it on htt://github.com/cbeust/testng

juherr
  • 5,640
  • 1
  • 21
  • 63