Neeraj
Neeraj

Reputation: 592

junit runs fine when run with gradle on command line but fails to run on eclipse as a junit test

junit runs fine when run with gradle on command line but fails to run on eclipse as a junit test. Why?? All tests pass with command: gradlew clean test on commandline but fail on eclipse when RunAs -> Junit

I am using jmockit as mocking framework in the test that is failing (only from eclipse). Also using, jmockit-coverage for test coverage. Here is the stacktrace:

Class not found app.services.storage.daos.LoggedInUserDaoTest
java.lang.ClassNotFoundException: app.services.storage.daos.LoggedInUserDaoTest
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at      org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:685)
at  org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:421)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)

Upvotes: 0

Views: 1324

Answers (1)

Sergiy Beley
Sergiy Beley

Reputation: 11

Please remove bin and build folders in your project. Than refresh project in Eclipse (F5)

Upvotes: 1

Related Questions