چه کسانی این کتاب را می‌خوانند

دانشجوعلاقه‌مند یادگیری
کتابخوان حرفه‌ایلذت مطالعه
نویسندهالهام‌گیری

Pragmatic unit testing : in Java with JUnit

Andy Hunt, Dave Thomas, Dave Thomas

قیمت نهایی

۴۹٬۰۰۰ تومان

نسخه اصلی و اورجینال

بلافاصله پس از خرید، فایل کتاب روی دستگاه شما آمادهٔ دانلود است.

تحویل فوری
پرداخت امن
ضمانت فایل
پشتیبانی

مشخصات کتاب

سال انتشار
۲۰۰۳
فرمت
PDF
زبان
انگلیسی
حجم فایل
۱٫۳ مگابایت
شابک
9780974514017، 0974514012

دربارهٔ کتاب

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.

About the Starter Kit 8 Preface 10 Introduction 13 Coding With Confidence 14 What is Unit Testing? 15 Why Should I Bother with Unit Testing? 16 What Do I Want to Accomplish? 16 How Do I Do Unit Testing? 19 Excuses For Not Testing 19 Roadmap 24 Your First Unit Tests 25 Planning Tests 26 Testing a Simple Method 27 More Tests 32 Writing Tests in JUnit 33 Structuring Unit Tests 33 JUnit Asserts 34 JUnit Framework 38 JUnit Test Composition 39 JUnit Custom Asserts 44 JUnit and Exceptions 45 More on Naming 47 JUnit Test Skeleton 47 What to Test: The Right-BICEP 49 Are the Results Right? 49 Boundary Conditions 52 Check Inverse Relationships 54 Cross-check Using Other Means 54 Force Error Conditions 55 Performance Characteristics 56 CORRECT Boundary Conditions 58 Conformance 59 Ordering 60 Range 62 Reference 65 Existence 66 Cardinality 67 Time 69 Try It Yourself 71 Using Mock Objects 75 Simple Stubs 76 Mock Objects 77 Testing a Servlet 81 Easy Mock Objects 84 Properties of Good Tests 89 Automatic 90 Thorough 91 Repeatable 92 Independent 93 Professional 94 Testing the Tests 95 Testing on a Project 99 Where to Put Test Code 99 Test Courtesy 103 Test Frequency 104 Tests and Legacy Code 105 Tests and Reviews 108 Design Issues 111 Designing for Testability 111 Refactoring for Testing 113 Testing the Class Invariant 124 Test-Driven Design 127 Testing Invalid Parameters 129 Gotchas 131 As Long As The Code Works 131 ``Smoke'' Tests 131 ``Works On My Machine'' 132 Floating-Point Problems 132 Tests Take Too Long 133 Tests Keep Breaking 133 Tests Fail on Some Machines 134 My main is Not Being Run 135 Installing JUnit 136 Command-line installation 137 Does it work? 138 JUnit Test Skeleton 139 Helper Class 141 Basic Template 141 Resources 144 On The Web 144 Bibliography 146 Summary: Pragmatic Unit Testing 147 Answers to Exercises 148 Volume II of the Pragmatic Starter Kit, a set of guides for getting project teams up and running. In the second volume of the sequence, Hunt and Thomas (software developers) offer guidance on writing better code, detecting and fixing potential problems, testing pieces of code, and testing with a whole team. They describe the process of unit testing with the freely-available JUnit library in Java, but the techniques they describe can be applied in other languages and frameworks as well. 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.

قیمت نهایی

۴۹٬۰۰۰ تومان