About the Starter Kit | p. xi |
Preface | p. xiii |
Introduction | p. 1 |
Coding With Confidence | p. 2 |
What is Unit Testing? | p. 3 |
Why Should I Bother with Unit Testing? | p. 4 |
What Do I Want to Accomplish? | p. 5 |
How Do I Do Unit Testing? | p. 7 |
Excuses For Not Testing | p. 7 |
Roadmap | p. 12 |
Your First Unit Tests | p. 13 |
Planning Tests | p. 14 |
Testing a Simple Method | p. 15 |
Running Tests with NUnit | p. 16 |
Running the Example | p. 22 |
More Tests | p. 26 |
Writing Tests in NUnit | p. 27 |
Structuring Unit Tests | p. 27 |
NUnit Asserts | p. 29 |
NUnit Framework | p. 31 |
NUnit Test Selection | p. 33 |
NUnit Custom Asserts | p. 40 |
NUnit and Exceptions | p. 41 |
Temporarily Ignoring Tests | p. 42 |
What to Test: The Right-BICEP | p. 45 |
Are the Results Right? | p. 46 |
Boundary Conditions | p. 49 |
Check Inverse Relationships | p. 50 |
Cross-check Using Other Means | p. 50 |
Force Error Conditions | p. 51 |
Performance Characteristics | p. 52 |
Correct Boundary Conditions | p. 55 |
Conformance | p. 56 |
Ordering | p. 57 |
Range | p. 59 |
Reference | p. 62 |
Existence | p. 63 |
Cardinality | p. 64 |
Time | p. 66 |
Try It Yourself | p. 68 |
Using Mock Objects | p. 73 |
Simple Stubs | p. 74 |
Mock Objects | p. 75 |
Formalizing Mock Objects | p. 79 |
When Not To Mock | p. 93 |
Properties of Good Tests | p. 95 |
Automatic | p. 96 |
Thorough | p. 97 |
Repeatable | p. 99 |
Independent | p. 99 |
Professional | p. 100 |
Testing the Tests | p. 102 |
Testing on a Project | p. 105 |
Where to Put Test Code | p. 105 |
Test Courtesy | p. 108 |
Test Frequency | p. 109 |
Tests and Legacy Code | p. 110 |
Tests and Reviews | p. 113 |
Design Issues | p. 117 |
Designing for Testability | p. 117 |
Refactoring for Testing | p. 119 |
Testing the Class Invariant | p. 130 |
Test-Driven Design | p. 132 |
Testing Invalid Parameters | p. 134 |
Gotchas | p. 137 |
As Long As The Code Works | p. 137 |
"Smoke" Tests | p. 137 |
"Works On My Machine" | p. 138 |
Floating-Point Problems | p. 138 |
Tests Take Too Long | p. 139 |
Tests Keep Breaking | p. 139 |
Tests Fail on Some Machines | p. 140 |
Resources | p. 141 |
On The Web | p. 141 |
Bibliography | p. 143 |
Summary: Pragmatic Unit Testing | p. 145 |
Answers to Exercises | p. 147 |
Table of Contents provided by Rittenhouse. All Rights Reserved. |
The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.
The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.