I want to generate HTML testNG reports. By default we have a report file after running testNG called "emailable-reports". But now i want to create my own HTML report. I tried to use ITestListener and ITestReport.But even if i override those methods it is not doing any thing. I dono how and where to use those methods. I have two test cases. So now where i have to put the code to produce reports...
相关问题
- TestNG report with customized error in place of st
- TESTNG: how to send emailable report as an email
- org.testng.TestNGException: sun.security.provider.
- Combining 2 reports into one 1 in (testng) allure
- Debugging TestNG configuration failures
相关文章
- TestNG skipping tests - why?
- How to test a Validator which implements Constrain
- Is it safe to use DateTimeUtils.setCurrentMillisFi
- How to use @FindBy annotation in Selenium WebDrive
- use verify on mocked (with Mockito) objects inject
- How to run TestNG suite with failsafe without unpa
- How to install TestNG eclipse plugin offline?
- TetsNG SoftAssert with Hamcrest matcher
you can use QAF with which you will be able to generate json based reporting dashboard.
I know this is an old thread, but I have explained here how to customize
TestHTMLReporter
and here it is:With your
customReport
You'd have to implementIReporter
, extendTestListenerAdapter
and overridegenerateReport
method if you want to implement a customTestHTMLReporter
. For other reporters you may have to do things a bit differently but the concept will remain the same. You'd achieve custom 'TestHTMLReporter' like below .Create a
CustomReport.java
file in your project and copy-paste the whole content ofTestHTMLReporter.java
, change the name of file ingetOutputFile
method and it would look like belowMake sure all your imports are in place from
TestHTMLReporter.java
Now, in this file change as per your requirement . For ex: if you'd like to add the end time of each of the test then at the correct place ingenerateTable
method add the below snippetThen you'll get like below
Now, You'll get two reports one with default and the other with your file name. The only thing now remains is switching off the default reporting listeners, so you get only one report. For that you can follow this or you may search for solutions. Hope this helps
@Feanor - As per your implementataion
We have a problem here. Assume we have implemented as instance of Ireporter say "CustomReporter" and override generateReport which gets called by adding listener in xml file
After this testng will ALSO call EmailableReport which also implements Ireporter which reverts back to default testNg report
Per the documentation, implementations of the ITestListener interface are designed for real-time reporting, while implementations of the IReporter interface are intended to generate reports after the suite run is finished.
Implementing an instance of IReporter and the
generateReport(List<ISuite> suites, String outputDirectory)
method should allow you to look at the test results and create an HTML report.