1

I've been trying to get CDT Test Runner to work with Eclipse Neon.3 and Google test but I'm getting the following exception in the Eclipse log whenever I try to execute a test using "Run":

!ENTRY org.eclipse.equinox.registry 4 1 2017-04-11 16:19:51.036
!MESSAGE Plug-in "org.eclipse.cdt.testsrunner" was unable to instantiate class "org.eclipse.cdt.testsrunner.internal.launcher.RunTestsLaunchDelegate".
!STACK 0
java.lang.NoClassDefFoundError: org/eclipse/cdt/debug/core/cdi/CDIException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getConstructor0(Class.java:3075)
at java.lang.Class.newInstance(Class.java:412)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:184)
at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
at org.eclipse.debug.internal.core.LaunchDelegate.getDelegate(LaunchDelegate.java:86)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:763)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.lang.ClassNotFoundException: org.eclipse.cdt.debug.core.cdi.CDIException cannot be found by org.eclipse.cdt.testsrunner_7.0.0.201112081129
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:461)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:372)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:364)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:161)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 14 more

Has anyone else seen this problem and solved it or is the CDT Test Runner dead?

I posted a similar question in the Eclipse-CDT forum but haven't seen any responses.

DaveR
  • 1,295
  • 1
  • 13
  • 35
  • I believe CDI is a plugin that was removed in a recent CDT release. Not sure why it's causing an error running tests though. Might be worth asking on the [CDT mailing list](https://dev.eclipse.org/mailman/listinfo/cdt-dev). – HighCommander4 Apr 13 '17 at 21:39

1 Answers1

1

Does CDT test runner work with Eclipse Neon.3 and Google Test

Yes!

The specific problem you were facing is answered below the line.

Steps to install CDT's Tests Runner

  1. Download, Install and Run Eclipse Neon
  2. From Help menu -> Install New Software:

enter image description here

  1. Choose the Neon update site and select "C/C++ Unit Testing Support"

enter image description here

  1. Create and run your unit test launch configuration:

enter image description here


You have org.eclipse.cdt.testsrunner_7.0.0, the current version in Neon of that plug-in is 8.1.0, part of CDT 9.2 (browse the Neon.3 release repo). I am not sure how you got 7.0.0 installed, but my guess is that there is a missing dependency somewhere that allowed that to happen. Perhaps an upgrade went wrong. (Note the 7.0.0 version is from 2011, the 8.1.0 version is from 2017.)

You should be able to resolve the problem by explicitly installing the correct version, either from the Neon.3 update site (http://download.eclipse.org/releases/neon/) or the CDT 9.2.2 one (http://download.eclipse.org/tools/cdt/releases/9.2/) (CDT 9.2.2 is the version of CDT in Neon.3)

If you have a reproducible way of ending up with a bad Eclipse CDT install, please file a bug.

Jonah Graham
  • 7,890
  • 23
  • 55
  • Neon already has the CDT test runner?? Where?? I downloaded Neon.3, imported my existing projects and none of the C++ Unit test run configurations showed up. I created a new project and tried to create a new run configuration but there was no option to create a C++ Unit test. It was then that I installed the CDT test runner version 7, which was the only one I could find. This gave me the option to create a C++ Unit test run configuration but...the rest is documented above. What did I miss?? – DaveR Apr 19 '17 at 15:57
  • I'll run through install and post step-by-step in answer (and/or I'll file a bug if I can reproduce). Can you please share where you got the cdt test runner from (url)? – Jonah Graham Apr 19 '17 at 22:29
  • PS have you already tried installing test runner from update site I provided? – Jonah Graham Apr 19 '17 at 22:31
  • Thanks Jonah! That did it. I assumed that when you said the test runner was part of CDT that it would just be there. My misunderstanding. I installed the test runner, as you described, and I now have unit test. All I need now is a fix to the problem I posted here: http://stackoverflow.com/questions/43395656/eclipse-neon-cdt-run-configuration-not-setting-environment-variables, and Eclipse would once again be a real IDE! – DaveR Apr 20 '17 at 16:40