Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassNotFoundException while using the rerun junit5 functionality #57

Closed
vik-chand opened this issue May 17, 2022 · 6 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@vik-chand
Copy link
Member

While testing https://www.eclipse.org/eclipse/news/4.24/jdt.php#junit5-rerun-failures-first


import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.Test;

class t {

	@Test
	void atest() {
		//fail("Not yet implemented");
	}
	@Test
	void test() {
		fail("Not yet implemented");
	}

}

While running re-run I get


May 17, 2022 10:33:39 PM org.junit.jupiter.engine.config.InstantiatingConfigurationParameterConverter logFailureMessage
WARNING: Failed to load default method orderer class 'org.eclipse.jdt.internal.junit5.runner.FailuresFirstMethodOrderer' set via the 'junit.jupiter.testmethod.order.default' configuration parameter. Falling back to default behavior.
java.lang.ClassNotFoundException: org.eclipse.jdt.internal.junit5.runner.FailuresFirstMethodOrderer
	at org.eclipse.pde.internal.junit.runtime.MultiBundleClassLoader.findClass(MultiBundleClassLoader.java:40)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
	at org.junit.platform.commons.util.ReflectionUtils.lambda$tryToLoadClass$9(ReflectionUtils.java:829)
	at org.junit.platform.commons.function.Try.lambda$call$0(Try.java:57)
	at org.junit.platform.commons.function.Try.of(Try.java:93)
@jjohnstn
Copy link
Contributor

I can test this on I20220517 by creating a Plug-in project that depends on org.junit.jupiter.api, and org.eclipse.jdt.junit5.runtime. Works fine. Is there some requires needed in JDT so it works in your scenario?

@jjohnstn
Copy link
Contributor

After thinking about it, the jar containing the FailuresFirstMethodOrder class (currently org.eclipse.jdt.junit5.runtime) needs to be added on the classpath by default instead of manually, but I am not sure how to do this. I tried adding it in JUnitLaunchConfigurationDelegate.getVMRunnerConfiguration() where we add jupiter jars to the classpath, but it wasn't successful. The feature will need to be marked incomplete and removed from the N&N until I can sort this out.

@jjohnstn jjohnstn self-assigned this May 18, 2022
@jjohnstn jjohnstn added the bug Something isn't working label May 18, 2022
@jjohnstn
Copy link
Contributor

I tried running the same test as JUnit test and it works fine so I'll leave the feature in and keep this as an open issue. The workaround is to add org.eclipse.jdt.junit5.runtime as a test plug-in dependency.

@jjohnstn
Copy link
Contributor

A fix has been proposed to PDE to fix this. See issue: eclipse-pde/eclipse.pde#117

@jjohnstn
Copy link
Contributor

@vik-chand Can you review the PR mentioned above?

@jjohnstn
Copy link
Contributor

The PDE changes have fixed this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants