Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Eclipse: Could not find or load main class org.testng.remote.RemoteTestNG

Tags:

Configuration

I have version 2019-12 (4.14.0) of Eclipse (having recently upgraded from 2019-03) with the following plugins installed (amongst others):

TestNG 6.14.3.201902250526
TestNG M2E (Maven) Integration (Optional) 6.14.3.201902250526
TestNG P2 Features 6.14.3.r201802240500

Eclipse is running against jdk1.8.0_152.

In Eclipse, my Java Build Path includes testng-6.14.3. I've tried to match the Eclipse plugin version against the version using in the project.

Under Properties -> TestNG I have all the default settings. There is no setting here for "Use Project TestNG.jar".

What Works

When I run tests from the command line with Gradle they all pass with no issue.

There are no complile errors showing in Eclipse.

What Does Not Work

When I run a test from Eclipse (by right clicking on a class) the console shows:

Error: Could not find or load main class org.testng.remote.RemoteTestNG

It appears I need a copy of testng-remote.jar. Should this have been installed as part of the plug-in, or am I meant to have included that in my build.gradle as a dependency?

Why can't I run tests from Eclipse? Do I need to install something further to resolve this error?

What I have Tried

I have tried removing and re-installing the TestNG plugin.

like image 848
WW. Avatar asked Dec 20 '19 00:12

WW.


1 Answers

It seems you hit the bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=558495 in Windows. I reverted my version back to 2019-09 because of it.

The bug causes jars which should be on the classpath not to be on the classpath. This affects projects with long classpaths.

like image 104
qtxo Avatar answered Oct 02 '22 16:10

qtxo