[testng-users] Setting up ReportNG in Eclipse

2024 views
Skip to first unread message

Gergely

unread,
May 6, 2010, 9:55:23 AM5/6/10
to testng-users
Hi Guys!

I'm trying to setup reportng for TestNg to work.

I tired to following xml template:

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

I'm not sure what <suite...> should do :) Or is this only a notation
that it should be between suits or what? I'm not using testng xml so i
don't have one.

I tried without it too, but in that case it throws a nullpointer
exception:
java.lang.NullPointerException
at
org.testng.xml.TestNGContentHandler.xmlListeners(TestNGContentHandler.java:
321)

I have the reportng file located in the project.

I also tried the annotation @Listeners and that helped but i have to
define that on each test class and i don't want to :)

Any help is appreciated!!

Thanks
Gergely.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

Cédric Beust ♔

unread,
May 6, 2010, 10:13:24 AM5/6/10
to testng...@googlegroups.com, Daniel Dyer
[+Daniel, the author of ReportNG]

Daniel, maybe your documentation should show a full testng.xml snippet instead of just the two listeners?

Gergely, you need to specify your test classes in your .xml file:

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

  <test>
    <classes>
      <class name="test.tmp.A"/>
    </classes>
  </test>
</suite>

-- 
Cédric
--
Cédric

Cédric Beust ♔

unread,
May 6, 2010, 10:15:05 AM5/6/10
to testng...@googlegroups.com, briti...@gmail.com

Gergely

unread,
May 6, 2010, 11:09:46 AM5/6/10
to testng-users
That is specified by Eclipse i don't create a testng.xml. eclipse
creates it so there is not <test> initially in the template because i
don't care about that part. That is the job of eclipse?!
> > testng-users...@googlegroups.com<testng-users%2Bunsubscribe@google groups.com>
> > .

Cédric Beust ♔

unread,
May 6, 2010, 12:19:59 PM5/6/10
to testng...@googlegroups.com
Then specify your listeners in the Eclipse configuration.

Here is the documentation for the latest version of the plugin (5.12.xxx).

-- 
Cédric

Gergely

unread,
May 6, 2010, 2:09:55 PM5/6/10
to testng-users
Yes i'm doing just that. And the template xml file is that that i
copied in:

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

And the attached null pointer error happens. Do i have to put reportng
to some other location?

Gergely

On May 6, 6:19 pm, Cédric Beust ♔ <ced...@beust.com> wrote:
> Then specify your listeners in the Eclipse configuration.
>
> Here is the documentation<http://testng.org/doc/eclipse.html#eclipse-listeners>for

Cédric Beust ♔

unread,
May 6, 2010, 2:22:19 PM5/6/10
to testng...@googlegroups.com
The NullPointerException is happening because you don't have a <suite> tag (your testng.xml is incorrect).

-- 
Cédric

Gergely

unread,
May 6, 2010, 3:56:07 PM5/6/10
to testng-users
Okey.

So the template should look like this? :

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

Almost worked but the report is not working. It only creates a
directory with the name null. And one html.

Okey if i understand correctly i'm missing a whole bunch of things
from this xml. But does things like suite name, test name, groups etc
are created by eclipse on the fly, so i don't wanna specify them. Or
am i getting this wrong?

Thanks!!
Gergely.

Cédric Beust ♔

unread,
May 6, 2010, 3:59:13 PM5/6/10
to testng...@googlegroups.com
Try specifying a suite name (<suite name="Foo">).

-- 
Cédric

Gergely

unread,
May 7, 2010, 1:25:16 AM5/7/10
to testng-users
Great!

Thanks, that helped. :)

Although now it displays Foo as test name of course :D I have to give
it some meaning full name. :)

Thanks very much!

Gergely.
Reply all
Reply to author
Forward
0 new messages