Problem with testing Groovy code with newer version of TestNg (>=6.1) when using <package> tag.

12 views
Skip to first unread message

Filus

unread,
Nov 7, 2011, 10:01:15 AM11/7/11
to testng-users
Hi,

In nowadays I'm using TestNg very often with Groovy code. In general
it is brilliant combination, but lately I've been bad surprised by the
way TestNg find classes when package is specified instead of every
single class in xml suite and version newer than 6.0 is used.

Problem is that if in this specified package any Groovy interface is
present, private method registerClass() of
org.testng.internal.ClassInfoMap class throws
java.lang.NoClassDefFoundError: package_name/InterfaceName$1
throwable. As I found out it is Groovy issue with getClasses() method
for instance Class object which always throws that error.

Anyway, of course I have a some workarounds - stay with 6.0 or specify
test classes for packages with Groovy interfaces instead of package
tag in xml suite. But I've looked into TestNg code and I have question
or maybe even small request:

In mentioned above ClassInfoMap.registerClass() method there is local
variable includeNestedClasses, and it's tested in if statement some
lines below. But it is always set to true. Is it possible to make this
behavior/variable somehow parametrized? Or it doesn't make sense and
define this variable to false will made some other issues? (To be
honest I haven't analized TestNg internal construction deeply, I've
only found this difference between 6.0 and newer versions).

Of course, I am aware that the best solution is Groovy team fix their
issues, so I'm only asking without any pressure. :)

--
Filus

Cédric Beust ♔

unread,
Nov 7, 2011, 11:05:26 AM11/7/11
to testng...@googlegroups.com
Hi,

Well, yes, if it's a Groovy issue, I'd rather wait until they fix it than adding complexity to the TestNG code base :-)

This behavior is important for the Java version because it's what users expect (I changed it a few months ago because the old behavior -- not running inner classes unless you specify them explicitly in testng.xml -- was causing surprises).

-- 
Cédric





--
Filus

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


Filus

unread,
Nov 7, 2011, 2:34:58 PM11/7/11
to testng-users
On 7 Lis, 17:05, Cédric Beust ♔ <ced...@beust.com> wrote:
> Well, yes, if it's a Groovy issue, I'd rather wait until they fix it than
> adding complexity to the TestNG code base :-)

Roger that, all clear. I can live with it, so thanks for reply!

--
Filus
Reply all
Reply to author
Forward
0 new messages