So I\'m new to JUnit, and we have to use it for a homework assignment. Our professor gave us a project that has one test class, BallTest.java
. When I right clic
right click -> build path -> remove from build path and then again add it -> Right click on the folder named 'Test' > Build Path > Use as Source Folder.
Click 'Run'->choose your JUnit->in 'Test Runner' select the JUnit version you want to run with.
junit4
require that test classname should be use Test
as suffix.
In Eclipse Photon you may need to add JUnit 4 or 5 to the build path. Right click @Test and select 'Add JUnit 4 to build path'.
Some time if lots if Test files are there then Eclipse failed to pass -classpath options for all libs and path due to classpath param lenght limitations. To Solve it go to Run
Configerations -> JUnit -> Your Project Config -> ClassPath -> Check "Use Temporary Jar Options"
At least it solved my problem.
Any solution didn't work for me until I change the name of the my test method. When name of test method starts with "test" is OK. I am new in android programing and it was for me big surprise.