Home » Java » java – In TestNg How to rename the suite names in testng-failed.xml-Exceptionshub

java – In TestNg How to rename the suite names in testng-failed.xml-Exceptionshub

Posted by: admin February 25, 2020 Leave a comment

Questions:

In TestNG, Suppose I have a suite file “dummy.xml” like this –

<suite name="Dummy" verbose="1">
<test name="Dummy Test">
    <classes>
        <class name="scripts.Dummy"/>
    </classes>
</test>

and on running this if any test fails a testng-failed.xml file is created as below-

    <suite guice-stage="DEVELOPMENT" verbose="0" name="Failed suite [Dummy]">
  <test thread-count="5" verbose="0" name="Dummy Test(failed)">
    <classes>
      <class name="scripts.Dummy">
        <methods>
          <include name="test8"/>
          <include name="copyProperties"/>
          <include name="test3"/>
          <include name="setupUsers"/>
          <include name="closeAllBrowsers"/>
        </methods>
      </class> <!-- scripts.Dummy -->
    </classes>
  </test> <!-- Dummy Test(failed) -->
</suite> <!-- Failed suite [Dummy] -->

Here as we can see the suite name is changed from “Dummy” to “Failed suite [Dummy]”.
How can I prevent this renaming of suite in testng-failed.xml? or can perform a renaming back to its original name?

How to&Answers: