Summary in Reading of JUnit in Action(1)

2008-04-09 04:05:59来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

Digest, Summary and Feelings after reading the book JUnit in action.

Part One: JUnit distilled

Chapter One: JUnit jumpstart

This chapter covers—The summary written by author
_ Writing simple tests by hand
_ Installing JUnit and running tests
_ Writing better tests with Junit

1. All code is tested, and must be tested.—tested P29
2. Play-testing code is one thing; running automated tests is another.—another thing P29
3. Junit is written by Erich Gamma and KentBeck, which is oneof the test framwork of xUnit focused on Java Language, and free for use even in economy condition—free p29
4. The term “test unit” is discribed in Junit as: a single unit of work on testing called “programming testing” which is different from others.—defference p30
5. A unit of work is a task that is not directly dependent on the completion of any other task.—independence p31
6. Any program feature without an automated test simply doesn’t exist.—automated p32
7. writing a simple test program for the method—simple test p33

8. Confirm your expected output with your input—expected p31 and p33
9. Three points of framework which the Test Framework required:
_ Each unit test must run independently of all other unit tests.
_ Errors must be detected and reported test by test.
_ It must be easy to define which unit tests will run.—require p35
10. Junit can be run in graphic or textual condition.
11. Steps of using Junit to test your case when coding:
_ extends the test class from the standard JUnit junit.framework.TestCase
_ the method which want to test named as testXXX() recommendly
_ make assertion expression whatever you want
_ test it
But you should follow these steps as you are preparing programming the test and thinking how to do it.
_ think what you want the test to do
_ making assertion
_ fillfull the test with the steps above to let the test case run.
12. Junit coding tip: assertEquals(number, number, number_ranges)
number which means the int, double, float type date, with the number_ranges argument you can set the distance between these two things.
13. The feathurs of Junit: help us write useful tests; create tests that retain their value over time; lower the cost of writing tests by reusing code.
14. Coding structure extends TestCase of the version pior to Junit 3.8.1 is different, be caution.

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:林锐——软件工程思想

下一篇:Focus on Mock Object(1)