وبلاگ بلیان

Pragmatic unit testing : in Java with JUnit

معرفی کتاب «Pragmatic unit testing : in Java with JUnit» نوشتهٔ Andy Hunt, Dave Thomas, Dave Thomas، منتشرشده توسط نشر The Pragmatic Programmers در سال 2003. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است. «Pragmatic unit testing : in Java with JUnit» در دستهٔ بدون دسته‌بندی قرار دارد.

Even if you are familiar with Unit Testing, JUnit, and Test Driven Development your skills will be sharpened by the content in this book. The book jumps right into general principles of unit testing such as what to test, how much test code to write, and when to test. A concept named Right-BICEP is introduced to serve as a reminder for the types of unit tests you should be building in order to maximize test coverage. Another acronym named CORRECT is introduced to ensure boundary conditions are being thoroughly checked. Boundary conditions are notorious for runtime errors and must be carefully tested. This book definitely makes a good reference book to ensure your team is producing high quality tests. About the Starter Kit......Page 8 Preface......Page 10 Introduction......Page 13 Coding With Confidence......Page 14 What is Unit Testing?......Page 15 What Do I Want to Accomplish?......Page 16 Excuses For Not Testing......Page 19 Roadmap......Page 24 Your First Unit Tests......Page 25 Planning Tests......Page 26 Testing a Simple Method......Page 27 More Tests......Page 32 Structuring Unit Tests......Page 33 JUnit Asserts......Page 34 JUnit Framework......Page 38 JUnit Test Composition......Page 39 JUnit Custom Asserts......Page 44 JUnit and Exceptions......Page 45 JUnit Test Skeleton......Page 47 Are the Results Right?......Page 49 Boundary Conditions......Page 52 Cross-check Using Other Means......Page 54 Force Error Conditions......Page 55 Performance Characteristics......Page 56 CORRECT Boundary Conditions......Page 58 Conformance......Page 59 Ordering......Page 60 Range......Page 62 Reference......Page 65 Existence......Page 66 Cardinality......Page 67 Time......Page 69 Try It Yourself......Page 71 Using Mock Objects......Page 75 Simple Stubs......Page 76 Mock Objects......Page 77 Testing a Servlet......Page 81 Easy Mock Objects......Page 84 Properties of Good Tests......Page 89 Automatic......Page 90 Thorough......Page 91 Repeatable......Page 92 Independent......Page 93 Professional......Page 94 Testing the Tests......Page 95 Where to Put Test Code......Page 99 Test Courtesy......Page 103 Test Frequency......Page 104 Tests and Legacy Code......Page 105 Tests and Reviews......Page 108 Designing for Testability......Page 111 Refactoring for Testing......Page 113 Testing the Class Invariant......Page 124 Test-Driven Design......Page 127 Testing Invalid Parameters......Page 129 ``Smoke'' Tests......Page 131 Floating-Point Problems......Page 132 Tests Keep Breaking......Page 133 Tests Fail on Some Machines......Page 134 My main is Not Being Run......Page 135 Installing JUnit......Page 136 Command-line installation......Page 137 Does it work?......Page 138 JUnit Test Skeleton......Page 139 Basic Template......Page 141 On The Web......Page 144 Bibliography......Page 146 Summary: Pragmatic Unit Testing......Page 147 Answers to Exercises......Page 148

Learn how to improve your Java coding skills using unit testing. Despite it's name, unit testing is really a coding technique, not a testing technique. Unit testing is done by programmers, for programmers. It's primarily for our benefit: we get improved confidence in our code, better ability to make deadlines, less time spent in the debugger, and less time beating on the code to make it work correctly.

This book shows how to write tests, but more importantly, it goes where other books fear to tread and gives you concrete advice and examples of what to test—the common things that go wrong in all of our programs. Discover the tricky hiding places where bugs breed, and how to catch them using the freely available JUnit framework. It's easy to learn how to think of all the things in your code that are likely to break. We'll show you how with helpful mnemonics, summarized in a handy tip sheet (also available from our www.pragmaticprogrammer.com website) to help you remember all this stuff.

With this book you will:

  • Write better code, and take less time to write it
  • Discover the tricky places where bugs breed
  • Learn how to think of all the things that could go wrong
  • Test individual pieces of code without having to include the whole project
  • Test effectively with the whole team
We'll also cover how to use Mock Objects for testing, how to write high quality test code, and how to use unit testing to improve your design skills. We'll show you frequent "gotchas"—along with the fixes—to save you time when problems come up. We'll show you how with helpful mnemonics, summarized in a handy tip sheet (also available from our www.pragmaticprogrammer.com website).

But the best part is that you don't need a sweeping mandate to change your whole team or your whole company. You don't need to adopt Extreme Programming or Test-Driven Development, or change your development process in order to reap the proven benefits of unit testing. You can start unit testing, the pragmatic way, right away.

Introduction Your first unit tests Writing tests in JUnit What to test : the right-BICEP CORRECT boundary conditions Using mock objects Properties of good tests Testing on a project Design issues. Presents a guide to unit testing with the JUnit library in Java along with providing information on writing code, detecting and fixing problems, testing pieces of code, and testing with a team.
دانلود کتاب Pragmatic unit testing : in Java with JUnit