How to disable the default HTMLReport generater and XMLReport generator?

212 views
Skip to first unread message

Terry ZUO

unread,
Dec 3, 2016, 8:34:53 PM12/3/16
to testng-users
Hi all,

I am using testng to implementing some tests for my project. I am right now facing the java.lang.OutOfMemoryError: Java heap space ( OOME ) on testng-6.9.14-20161130 (this issue happens from 6.9.9 to 6.9.14, all tested). The main reason for this is that testng is generating the test-output and ge tthe OOME. I used the default setting and didn't use any listener or reporter myself. So is there a way to disable the default generation of HTMLreport and XML report?

Expected behavior


JLM_Tests_Suite
Total tests run: 166, Failures: 0, Skips: 0

===============================================

[TestNG] Time taken by org.testng.reporters.jq.Main@187c3681: 251 ms
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@26e6de0: 55 ms
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@e7896399: 57 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter@e7798d62: 66 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@edcb7885: 27 ms
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 0 ms

Actual behavior

JLM_Tests_Suite
Total tests run: 166, Failures: 0, Skips: 0
===============================================

[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@9d76475e: 106 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@95ff6bfa: 33 ms
JVMDUMP039I Processing dump event "systhrow", detail "java/lang/OutOfMemoryError" at 2016/12/02 19:46:00 - please wait.
JVMDUMP032I JVM requested System dump using '/tmp/bld_328360/core.20161202.194600.29058.0001.dmp' in response to an event
JVMPORT030W /proc/sys/kernel/core_pattern setting "|/usr/libexec/abrt-hook-ccpp %s %c %p %u %g %t e" specifies that the core dump is to be piped to an external program.  Attempting to rename either core or core.29082.

JVMDUMP010I System dump written to /tmp/bld_328360/core.20161202.194600.29058.0001.dmp
JVMDUMP032I JVM requested Heap dump using '/tmp/bld_328360/heapdump.20161202.194600.29058.0002.phd' in response to an event
JVMDUMP010I Heap dump written to /tmp/bld_328360/heapdump.20161202.194600.29058.0002.phd
JVMDUMP032I JVM requested Java dump using '/tmp/bld_328360/javacore.20161202.194600.29058.0003.txt' in response to an event
JVMDUMP010I Java dump written to /tmp/bld_328360/javacore.20161202.194600.29058.0003.txt
JVMDUMP032I JVM requested Snap dump using '/tmp/bld_328360/Snap.20161202.194600.29058.0004.trc' in response to an event
JVMDUMP010I Snap dump written to /tmp/bld_328360/Snap.20161202.194600.29058.0004.trc
JVMDUMP013I Processed dump event "systhrow", detail "java/lang/OutOfMemoryError".
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
	at sun.nio.cs.StreamEncoder.write(java.base/StreamEncoder.java:144)
	at java.io.Writer.write(java.base/Writer.java:154)
	at java.io.OutputStreamWriter.append(java.base/OutputStreamWriter.java:297)
	at org.testng.reporters.FileStringBuffer.flushToFile(FileStringBuffer.java:115)
	at org.testng.reporters.FileStringBuffer.append(FileStringBuffer.java:51)
	at org.testng.reporters.FileStringBuffer.append(FileStringBuffer.java:28)
	at org.testng.reporters.XMLUtils.xmlClose(XMLUtils.java:115)
	at org.testng.reporters.XMLStringBuffer.pop(XMLStringBuffer.java:182)
	at org.testng.reporters.jq.BaseMultiSuitePanel.generate(BaseMultiSuitePanel.java:25)
	at org.testng.reporters.jq.Main.generateReport(Main.java:63)
	at org.testng.TestNG.generateReports(TestNG.java:1184)
	at org.testng.TestNG.run(TestNG.java:1109)
	at org.testng.TestNG.privateMain(TestNG.java:1434)
	at org.testng.TestNG.main(TestNG.java:1403)

Another failure on a different run and failed on different line (the third line.)

Expected behavior

JLM_Tests_Suite
Total tests run: 166, Failures: 0, Skips: 0
===============================================

[TestNG] Time taken by org.testng.reporters.jq.Main@187c3681: 251 ms
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@26e6de0: 55 ms
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@e7896399: 57 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter@e7798d62: 66 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@edcb7885: 27 ms
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 0 ms

Actual behavior

JLM_Tests_Suite
Total tests run: 166, Failures: 0, Skips: 0
===============================================

[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@7cfd766d: 132 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter@1997b051: 185 ms
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@97a2d45: 89 ms
JVMDUMP039I Processing dump event "systhrow", detail "java/lang/OutOfMemoryError" at 2016/12/02 19:46:25 - please wait.
JVMDUMP032I JVM requested System dump using '/tmp/bld_328360/core.20161202.194625.10223720.0001.dmp' in response to an event
JVMDUMP010I System dump written to /tmp/bld_328360/core.20161202.194625.10223720.0001.dmp
JVMDUMP032I JVM requested Heap dump using '/tmp/bld_328360/heapdump.20161202.194625.10223720.0002.phd' in response to an event
JVMDUMP010I Heap dump written to /tmp/bld_328360/heapdump.20161202.194625.10223720.0002.phd
JVMDUMP032I JVM requested Java dump using '/tmp/bld_328360/javacore.20161202.194625.10223720.0003.txt' in response to an event
JVMDUMP010I Java dump written to /tmp/bld_328360/javacore.20161202.194625.10223720.0003.txt
JVMDUMP032I JVM requested Snap dump using '/tmp/bld_328360/Snap.20161202.194625.10223720.0004.trc' in response to an event
JVMDUMP010I Snap dump written to /tmp/bld_328360/Snap.20161202.194625.10223720.0004.trc
JVMDUMP013I Processed dump event "systhrow", detail "java/lang/OutOfMemoryError".
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
        at sun.nio.cs.StreamEncoder.write(java.base/StreamEncoder.java:144)
        at java.io.Writer.write(java.base/Writer.java:154)
        at java.io.OutputStreamWriter.append(java.base/OutputStreamWriter.java:297)
        at org.testng.reporters.FileStringBuffer.flushToFile(FileStringBuffer.java:115)
        at org.testng.reporters.FileStringBuffer.append(FileStringBuffer.java:51)
        at org.testng.reporters.FileStringBuffer.append(FileStringBuffer.java:28)
        at org.testng.reporters.XMLUtils.xmlClose(XMLUtils.java:115)
        at org.testng.reporters.XMLStringBuffer.pop(XMLStringBuffer.java:182)
        at org.testng.reporters.jq.BaseMultiSuitePanel.generate(BaseMultiSuitePanel.java:25)
        at org.testng.reporters.jq.Main.generateReport(Main.java:63)
        at org.testng.TestNG.generateReports(TestNG.java:1184)
        at org.testng.TestNG.run(TestNG.java:1109)
        at org.testng.TestNG.privateMain(TestNG.java:1434)
        at org.testng.TestNG.main(TestNG.java:1403)

Julien Herr

unread,
Dec 4, 2016, 10:57:19 AM12/4/16
to testng-users
You can use the "-usedefaultlisteners" option from the command line.
This option is also available with ant/maven/gradle.

Cédric Beust ♔

unread,
Dec 5, 2016, 3:33:33 PM12/5/16
to testng...@googlegroups.com
It would be nice to fix the reporters one of these days, some of them are still doing things with StringBuffers that take too much memory (and yes, that code is most likely mine :-) ).


-- 
Cédric


--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users+unsubscribe@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

Terry ZUO

unread,
Dec 5, 2016, 4:08:17 PM12/5/16
to testng-users
Hi Julien

Thanks for your answer. I tried the "-usedefaultlisteners" and the test-output was not generated for each test run any more. But I also found that the test-failed assertion stackTrace disappeared as well. I usually set verbose="2" in  testng.xml to display asertion stackTrace in the console output. As it is very convenient to see that test failure without having to look inside the generated test ourputs. It is also useful to disagnose the test failure. 

May I know if there is a way to disable testng generating test-output folder but keep the stackTrace in the console output?

Julien Herr

unread,
Dec 5, 2016, 5:48:17 PM12/5/16
to testng-users

Just add the expected reporter by hand in your configuration. It should make the job.

@Cédric
I don't know if the fix of reporters has a high priority because it exists many good 3rd party reporters too.


--
You received this message because you are subscribed to a topic in the Google Groups "testng-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/testng-users/vhGK8yPracU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to testng-users...@googlegroups.com.

Cédric Beust ♔

unread,
Dec 5, 2016, 6:07:08 PM12/5/16
to testng...@googlegroups.com
Sure but it's still not a good out of the box experience. The default reporters don't have to be good but they should be bug free :)

-- 
Cédric


To unsubscribe from this group and all its topics, send an email to testng-users+unsubscribe@googlegroups.com.

To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages