aspose file tools*
The moose likes Testing and the fly likes eclipse: Junit ClassNotFoundException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "eclipse: Junit ClassNotFoundException" Watch "eclipse: Junit ClassNotFoundException" New topic

eclipse: Junit ClassNotFoundException

m pa

Joined: Apr 17, 2013
Posts: 17
I have a Struts 2 project with JUnit4 in eclipse Juno.

I want to run a test in one of my action classes. I use the @Test annotation for the method I want to test. So far so good.

To run the test, I right click on the action class, select Run as -> JUnit Test.

Now it appears that the build.xml, which compliles all classes, is used but once build finishes, some classes are not in the build folder so I get the ClassNotFoundException. (the console is cleared before the exception is displayed so difficult to capture see what happened).

I have 3 action classes but only 1 has .class file in the build folder. (obviously this is not the one that I want to JUnit test)

Using Project -> Clean will result in all .class files being in the build folder.

Why is Run Junit test using build.xml and why are some classes getting cleared?
It is sorta covered in the JavaRanch Style Guide.
subject: eclipse: Junit ClassNotFoundException