Reporting after the fact

61 views
Skip to first unread message

Dan Fabulich

unread,
Mar 17, 2008, 2:56:27 PM3/17/08
to testng...@googlegroups.com

Is there any way to take a TestNG XML file and generate a TestNG-style
HTML report on it, long after the run has finished? I know you can use
JUnitReport, but that report doesn't have all the information available in
a real TestNG report.

(I'm also aware of some unofficial XSLT transformers, but I'd prefer the
official goodness.)

All the APIs I'm looking at seem to require that your reported be attached
to TestNG at the time of the run, which is a big downer.

-Dan

Cédric Beust ♔

unread,
Mar 17, 2008, 3:29:03 PM3/17/08
to testng...@googlegroups.com
Hi Dan,

That's an interesting question.

It's not possible without some work, because as you correctly diagnosed, the current HTML reporter works off the IReporter listener interface.

There are two approaches you could try:
  • See if ISuite can be serialized.  If it can, then the current HTML reporter will work off that serialized information with very few changes.
  • Modify the current reporter to be able to work off the XML file that is generated.  I would recommend forking a different reporter for that, though, and you might find that the XML file is still missing some information (I haven't looked in details at that file).
--
Cédric

Dan Fabulich

unread,
Apr 29, 2008, 2:09:38 PM4/29/08
to testng...@googlegroups.com
I'm following up on this question that I'd asked about a month ago. I
want to be able to generate HTML reports long after the run has finished,
using testng-results.xml. Apparently there's no way to do that at
present, so I'm looking into a way to code it.

However, I'd like to start with a more general question about
testng-results.xml. Is there *any* code currently in existence that
consumes testng-results.xml?

It seems to me that there isn't. Am I right in thinking that
testng-results.xml is currently not used by any Java code?

I ask because it seems like the first thing I'd want to do is take a
testng-results.xml file and turn it into an in-memory object model. If
there's no code like that yet in existence, I guess I'd need to start
writing a SAX parser for it, but it seems very weird that I'd be the first
person to do this.

-Dan

Cédric Beust ♔ wrote:

> Hi Dan,
>
> That's an interesting question.
>
> It's not possible without some work, because as you correctly diagnosed, the
> current HTML reporter works off the IReporter listener interface.
>
> There are two approaches you could try:
>

> - See if ISuite can be serialized. If it can, then the current HTML


> reporter will work off that serialized information with very few changes.

> - Modify the current reporter to be able to work off the XML file that

Cédric Beust ♔

unread,
Apr 29, 2008, 2:22:06 PM4/29/08
to testng...@googlegroups.com
Hi Dan,

I'm not 100% positive, but I think that ReportNG (the XSL reporter) uses it to produce its reports.

--
Cédric

Dan Fabulich

unread,
Apr 29, 2008, 11:35:14 PM4/29/08
to testng...@googlegroups.com
Cédric Beust ♔ wrote:

> I'm not 100% positive, but I think that ReportNG (the XSL reporter) uses it
> to produce its reports.

I don't think so. Scroll down to "How to use ReportNG;" it says you need
to attach it as a listener to your run.

https://reportng.dev.java.net/

Assuming I'm right, am I definitely right in thinking that no code in the
TestNG source tree consumes testng-results.xml?

-Dan

Cédric Beust ♔

unread,
Apr 29, 2008, 11:55:05 PM4/29/08
to testng...@googlegroups.com

None that I can think of.  Then again, I've had a very long day...

--
Cédric

Cosmin Marginean

unread,
Apr 30, 2008, 2:42:36 AM4/30/08
to testng...@googlegroups.com
Hello Dan,

There isn't code in the TestNG codebase doing this, however there is this XSL consumer for this: http://code.google.com/p/testng-xslt/

My best regards,
-- 
Cosmin Marginean

Cédric Beust ♔

unread,
Apr 30, 2008, 11:03:20 AM4/30/08
to testng...@googlegroups.com
On Tue, Apr 29, 2008 at 11:42 PM, Cosmin Marginean <cos...@cosminaru.ro> wrote:
Hello Dan,

There isn't code in the TestNG codebase doing this, however there is this XSL consumer for this: http://code.google.com/p/testng-xslt/

Ah, that's the one I was thinking of, I had it confused with ReportNG.  Thanks Cosmin.

--
Cédric
Reply all
Reply to author
Forward
0 new messages