How to add stacktrace in reportng (html file) for passed tests?

97 Views Asked by At

I'm executing my tests as a TestNGSuite. I'm running from testng.xml where I put all tests and two listeners e.g

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="ufe-klient" verbose="1" parallel="tests" thread-count="1">

<listeners>
    <listener class-name="org.uncommons.reportng.HTMLReporter" />
    <listener class-name="org.uncommons.reportng.JUnitXMLReporter" />
</listeners>

    <test name="Addresses" >
        <classes>
            <class name="com.individualclient.Addresses"/>
        </classes>
    </test>

After finish tests when I have error situation is ok. In index.html file I have stacktrace which presented steps don't execute. On the other side where my test is passed I don't have nothing in stactrace. Only green checkbox, path and name of test. What should I do to present stacktrace in passed tests?

1

There are 1 best solutions below

0
On

Add below in beforesuite

htmlReporter = new ExtentHtmlReporter(System.getProperty("user.dir") +"/test-output/testReport.html");


  //initialize ExtentReports and attach the HtmlReporter
  extent = new ExtentReports();
  extent.attachReporter(htmlReporter);

Refer the article

https://www.seleniumeasy.com/selenium-tutorials/creating-extent-reports-in-selenium-example