2. Debugging single java class with JUnit

Debugging single java class with JUnit

– The Great thing About JUnit is I can debug every line of my Code, Without run the whole of my application such as Ear file into Server.

After I successfully setting the BuildPath for Junit jar.

1. Create a Simple java program – LoopCount.java and testcase.java from this page Example :

2. Add the breakpoint on left side of the code that we would like to start debugging:

breakpoint

3. Then we click to debug mode.

debug

4.  Right click , Debug As JUnit Test.

debugUnitTest

 

5. Press button keyboard F6 , to go trough line by line of the codes. F8 to end of debugging or to start to next breakpoint. (In Eclipse)