Setting TestNG listeners through the TestNG Eclipse plug-in

325 views
Skip to first unread message

ngog...@gmail.com

unread,
Jan 26, 2010, 10:25:46 AM1/26/10
to testng-users
Hi friends,

Lately we upgraded our TestNG eclipse plugin and we found that the
text box used for attaching TestNG listeners is missing. I guess
another way of setting those listeners is used now.

Can you please advice on this.

thanks, Nikolay

Cédric Beust ♔

unread,
Jan 26, 2010, 11:00:38 AM1/26/10
to testng...@googlegroups.com
Hi Nikolay,

Yes, this setting has been replaced by the "Template XML file".  In this box, you give the path of an existing TestNG XML file in which you can specify your listeners (and other settings) which will be used whenever you launch a Run/Debug configuration from the plug-in.

Let me know if you need more help.

--
Cedric



--
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


Cédric Beust ♔

unread,
Jan 26, 2010, 7:50:55 PM1/26/10
to testng...@googlegroups.com, ngog...@gmail.com
Nikolay,

I updated the documentation to explain this new feature in details:

http://testng.org/doc/eclipse.html#eclipse-listeners

Let me know if something is not clear.

--
Cedric



2010/1/26 Cédric Beust ♔ <cbe...@google.com>



--
Cédric


Cédric Beust ♔

unread,
Jan 27, 2010, 5:51:19 AM1/27/10
to testng-users, Nikolay Gogovski
Mmmh this seems to be a Windows problem...  Anyone else using Windows seeing the same thing as Nikolay?  (see attached screen shot)

--
Cedric


---------- Forwarded message ----------
From: Nikolay Gogovski <ngog...@gmail.com>
Date: 2010/1/27
Subject: Re: [testng-users] Setting TestNG listeners through the TestNG Eclipse plug-in
To: Cédric Beust ♔ <cbe...@google.com>


Thank you for the info Cedric.

But i am facing another issue now.  Looking at the TestNG plugin preferences page i see the "Use an XML template file" checkbox, but no matter if checked or not, the text box for specifying the template file is missing. You can see the screenshot attached to the mail.

I have a new install of Eclipse version 3.5.1 and TestNG plugin version  5.11.0.28 download from http://beust.com/eclipse


I was wondering if there is an easy way to specify the listeners using the TestNG API. The main class in the testng.jar org.testng.TestNG does not provide a singletone like structure so i can not reach the instance created by the plugin in order to attach myself the needed listeners.


best regards,
Nikolay



--
Cédric


TestngPlugin.JPG

ngog...@gmail.com

unread,
Jan 27, 2010, 6:09:00 AM1/27/10
to testng-users
The missing GUI controls show up if you expand the window ... so no
big issue indeed :)

ngog...@gmail.com

unread,
Jan 27, 2010, 6:15:30 AM1/27/10
to testng-users
In fact both controls show up when the window is small enough, you can
not see them for example if the window is maximized.
I guess it is some problem with the GUI elements Layout

Cédric Beust ♔

unread,
Jan 27, 2010, 2:43:53 PM1/27/10
to testng...@googlegroups.com
Hi Nikolay,

I fixed the problem and I pushed a new version of the plug-in, can you update and verify?

--
Cedric


--
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


ngog...@gmail.com

unread,
Jan 28, 2010, 3:26:54 AM1/28/10
to testng-users
He Cedric,
it works just fine. Thank you for this so quick fix.

I think there is one more thing that needs fixing. The problem is that
the suite name from the template file gets precedence over the suite
name from the xml file which defines which tests to run.

We are implementing a ISuiteListener and the following code:

public void onStart( ISuite suite ) {
String suiteName = suite.getName()
}

results in giving us the suite name from the template file. If no such
name is defined, we get a null


thank you very much for your support,
Nikolay

Cédric Beust ♔

unread,
Jan 28, 2010, 1:31:18 PM1/28/10
to testng...@googlegroups.com
On Thu, Jan 28, 2010 at 12:26 AM, ngog...@gmail.com <ngog...@gmail.com> wrote:
He Cedric,
it works just fine. Thank you for this so quick fix.

I think there is one more thing that needs fixing. The problem is that
the suite name from the template file gets precedence over the suite
name from the xml file which defines which tests to run.

Not sure I follow:  the XML template file is used only if you launch a test from something else than an XML file...

In other words:
  • If you launch an XML file, the name found in that file is used
  • If you launch something else (class, group, package, method), the name found in the template file is used
Can you elaborate on what you're seeing exactly?

--
Cédric


ngog...@gmail.com

unread,
Jan 29, 2010, 4:16:58 AM1/29/10
to testng-users
Yes, you are right.

- If you launch an XML file, the name found in that file is used.
THE PROBLEM IS: we have to specify the listeners in each XML file,
while before we were able to globally specify them in the TestNG
preferences page. This was more convenient to us as we needed t
- If you launch something else (class, group, package, method),
the name found in the template file is used.
THE PROBLEM IS: It will use the name in the template, while before it
would construct it by the class name for example

regards,
Nikolay

Reply all
Reply to author
Forward
0 new messages