Re: [testng-users] Java 1.7 and TestNG

938 views
Skip to first unread message

Mark Derricutt

unread,
Mar 6, 2013, 5:39:30 PM3/6/13
to testng...@googlegroups.com
Strange,

I can't say I've seen that under Java 1.7 with TestNG, at least not in any recent memory - JDK 1.7 switched to using the new TimSort by default, which actively reports on mismatched behaviour between equals/hashCode methods and fast fails.

How are you switching your TestNG versions? Do you know if any other version is creeping into your class path?

Fredrik Lännergren wrote:

Hi all,

while running a test suite in TestNG (6.3.1 or 6.8) with Java 1.7, I
ran into the following stack trace:

    Caused by: java.lang.IllegalArgumentException: Comparison method
    violates its general contract!
    at java.util.TimSort.mergeHi(TimSort.java:868)

Fredrik Lännergren

unread,
Mar 7, 2013, 4:22:30 AM3/7/13
to testng...@googlegroups.com

Mmm, it's definitely possible if a bit hard to find out... we use Maven:

    <dependencies>
      <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.8</version>
      </dependency>
      <dependency>
        <groupId>org.easymock</groupId>
        <artifactId>easymock</artifactId>
        <version>3.0</version>
        <exclusions>
          <exclusion>
            <groupId>cglib</groupId>
            <artifactId>cglib-nodep</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.easytesting</groupId>
        <artifactId>fest-assert</artifactId>
        <version>1.3</version>
      </dependency>
      <dependency>
        <groupId>org.easytesting</groupId>
        <artifactId>fest-reflect</artifactId>
        <version>1.3</version>
      </dependency>
      <dependency>
        <groupId>org.easytesting</groupId>
        <artifactId>fest-swing</artifactId>
        <!-- 1.2.1: http://alexruiz.developerblogs.com/?p=1275 -->
        <version>1.2.1</version>
      </dependency>
      <dependency>
        <groupId>org.easytesting</groupId>
        <artifactId>fest-swing-testng</artifactId>
        <version>1.2.1</version>
      </dependency>
      <dependency>
        <groupId>javax.help</groupId>
        <artifactId>javahelp</artifactId>
        <version>2.0.05</version>
      </dependency>
    </dependencies>

I tried cleaning out ~/.m2/repository and running again, same result.

So TestNG 6.3.1+ works with 1.7? I guess I'll just have to dig through the other things then.
For example, it seems that fest-swing-testng 1.2.1 uses TestNG 5.7, maybe that one wins over 6.8 somehow.

Thanks.

Yevhen Bilevych

unread,
Mar 7, 2013, 4:39:54 AM3/7/13
to testng...@googlegroups.com
Fredrik,

Do you use maven-compiler-plugin to set version?
If not, then the default version is 1.5. That's even you have Java 7 installed.

Thanks,
Yevhen
--
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...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at http://groups.google.com/group/testng-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Krishnan Mahadevan

unread,
Mar 7, 2013, 4:42:26 AM3/7/13
to testng...@googlegroups.com
Yevhen has a valid point because by default Maven resorts to using JDK 1.4. But what baffles me here is that, if the tests are being driven by Maven, there should already have been a lot errors because I think annotations was ONLY introduced into Java ad part of JDK 1.5. 
--
Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

Fredrik Lännergren

unread,
Mar 7, 2013, 4:59:34 AM3/7/13
to testng...@googlegroups.com
Hi :-)

Yeah, we do:
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>2.3.2</version>
          <configuration>
            <source>1.6</source>
            <target>1.6</target>
          </configuration>
        </plugin>

Compiling everything and running individual tests works just fine, it's the execution of the suites, either with Surefire or with Eclipse plugin (Run as->TestNG Suite), that fails. At the moment I'm leaning towards Mark's idea that the class path is picking up too old testng jars.

Thanks,
  Fredrik
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 http://groups.google.com/group/testng-users?hl=en.
For more options, visit

--
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 http://groups.google.com/group/testng-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Yevhen Bilevych

unread,
Mar 7, 2013, 5:01:50 AM3/7/13
to testng...@googlegroups.com
Just went ahead and found why Krishnan thought about 1.4 - maven2 was changing default setting from 1.3 to 1.5: http://thinkinginsoftware.blogspot.com/2012/03/maven-compiler-version-from-command.html

Thanks,
Yevhen

Fredrik Lännergren

unread,
Mar 7, 2013, 9:51:41 AM3/7/13
to testng...@googlegroups.com
Small update; it's actually not about class pathing... after some reduction of possibilities, it seems that this exception happens for me only when I have a certain set of 32 tests (spread over 4 unrelated test classes). Removing any of those 32 tests will make everything work just fine; adding other tests will make no difference.

I'm going to try to figure out what's going on and find the actual reason for this, but it feels like voodoo at the moment...

/Fredrik
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 http://groups.google.com/group/testng-users?hl=en.
For more options, visit
--
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 http://groups.google.com/group/testng-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Oleg Estekhin

unread,
Mar 22, 2013, 6:44:11 AM3/22/13
to testng...@googlegroups.com
Hi everybody
 
After some changes to the test code I started to get this error too.
 
I am using Java 7 with TestNG 6.8 for a long time, but this error started to appear only after I started to use @Factory feature.
 
And as far as I can tell, it has something to with whether the testng.xml is used or not. Running the tests from Idea (it uses testing.xml) causes "Comparison method violates its general contract". Running exactly the same tests from the command line (mvn test) works as usual.
 

четверг, 7 марта 2013 г., 18:51:41 UTC+4 пользователь Fredrik Lännergren написал:

Gabriel Neer

unread,
Feb 14, 2014, 3:31:51 PM2/14/14
to testng...@googlegroups.com
Was any progress ever made on this mystery? I've started running into it as well, seemingly quite suddenly. Like Oleg, I've found the combination of @Factory and an xml test suite seems to be involved.

Krishnan Mahadevan

unread,
Feb 14, 2014, 10:57:15 PM2/14/14
to testng...@googlegroups.com
Gabriel,

Would you please create a small reproducible sample of the problem so that we can try simulating it and see what is going on ?
Personally I haven't encountered this problem [ but then again, I dont use too much @Factory myself]

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/


--
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...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.

Oleg Estekhin

unread,
Feb 15, 2014, 1:25:51 PM2/15/14
to testng...@googlegroups.com
Krishnan, the first post contains both stacktrace and the description of the actual problem.

Andreas Kluth

unread,
Jun 2, 2014, 5:03:31 AM6/2/14
to testng...@googlegroups.com
This should be fixed in the next release:
 
Reply all
Reply to author
Forward
0 new messages