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)

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s