Introduction Unit Testing Framework
System.out.println("Bug or But");
logger.info("Bug or But");
How to find the information in so many messages ?
Watch the var by debugger, but ...... manually
Can testing save your life ?
Automatic unit testing can save your life !
Automatic => uniform testing tool Unit testing => divide and conquer
JUnit Testing `Framework' Framework =>  almost completed except for … You must write Test Case
Eating Framework with CookCallback/Strategy http://www.bubbleliao.idv.tw/gallery/main.php?g2_view=core.DownloadItem&g2_ite...
In OO-System What are Unit and Test Case ?
Unit => A class Or related Classes Test Case => condition, state, behavior
DO TEST Make a change to a runtime object snapshot Assert Before => Condition, State, Behavior <= After
Write Test Case in AAA, 3 steps A rrange,  A ct and  A ssert
Arrange Simulate a runtime object snapshot Create a instance to set up its state and related object
Act Send messages to object (invoke the method) (make a change)
Assert Check state in object is just what you expect
Upcoming SlideShare
Loading in …5
×

Unit Testing

672 views

Published on

Published in: Technology, Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
672
On SlideShare
0
From Embeds
0
Number of Embeds
9
Actions
Shares
0
Downloads
14
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Unit Testing

  1. 1. Introduction Unit Testing Framework
  2. 2. System.out.println(&quot;Bug or But&quot;);
  3. 3. logger.info(&quot;Bug or But&quot;);
  4. 4. How to find the information in so many messages ?
  5. 5. Watch the var by debugger, but ...... manually
  6. 6. Can testing save your life ?
  7. 7. Automatic unit testing can save your life !
  8. 8. Automatic => uniform testing tool Unit testing => divide and conquer
  9. 9. JUnit Testing `Framework' Framework => almost completed except for … You must write Test Case
  10. 10. Eating Framework with CookCallback/Strategy http://www.bubbleliao.idv.tw/gallery/main.php?g2_view=core.DownloadItem&g2_itemId=11702&g2_serialNumber=1
  11. 11. In OO-System What are Unit and Test Case ?
  12. 12. Unit => A class Or related Classes Test Case => condition, state, behavior
  13. 13. DO TEST Make a change to a runtime object snapshot Assert Before => Condition, State, Behavior <= After
  14. 14. Write Test Case in AAA, 3 steps A rrange, A ct and A ssert
  15. 15. Arrange Simulate a runtime object snapshot Create a instance to set up its state and related object
  16. 16. Act Send messages to object (invoke the method) (make a change)
  17. 17. Assert Check state in object is just what you expect

×