Eclipse can not find JUnit test case folder - how

2019-09-03 05:05发布

问题:

I want to test methods of Java classes using JUnit. Therefore, I use Eclipse and create a source folder "TestCases" which contains a package with the name "test" that should be the place where I want to put the JUnit test cases. The whole directory set up is shown in the following pic:

My problem is, when I right-click on "test" and go to "JUnit Test Case", and write for example "ASTAnyExprTest"(see (1) in the following pic), and go to "Browse" (see (2)) and type "ASTAnyExpr" (see (3) ) to set the name of the class under test, then I see only a blank space (no class to choose).

So, I must have a path-problem, I thought. My first idea was to copy all classes to the package "test". But then I need to modify and adjust all dependencies in the classes. So is there a better solution for that ?

best regards,

标签: eclipse junit