When I execute my test with testng.xml then it runs fine, but when I execute with pom.xml then got the ERROR:
[ERROR] java.lang.UnsupportedClassVersionError: org/testng/ITestListener has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
My Java version: 1.8.0_333, and Apache Maven 3.8.4.
How can I resolve this?
As noted in the comments, the TestNG website says:
Requirements
TestNG Upto v7.5: JDK 8 or higher.
TestNG v7.6.0 and above: JDK 11 or higher.
So the possible solutions are:
Use an older version of TestNG than v7.6.0 if you want to use Java 8 as your development platform. The TestNG version will probably be in your project's POM file.
Upgrade your development platform to Java 11 or later.
If you installed TestNG via the Eclipse Marketplace, check out this answer.
If you are feeling brave1, attempt to backport the version of TestNG (>= v7.6.0) that you are using to run on Java 8 (or older).
1 - This could be trivial or complicated. You won't know until you try it.
I got same issue, tried some ways, but the following things worked for me.
Here actual issue is with TestNG plugin "java.lang.UnsupportedClassVersionError: org/testng/remote/RemoteTestNG"
Here I added testNG plugin from Market place then It was installed 7.8.0 version which was developed by using java 8+ I think, due that it even we used java 1.8(8) also showing that error.
Solution: Using following url copy 7.4.0 site and add using the following steps https://testng.org/testng-eclipse-update-site/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With