By Mike Hill, Joshua Kerievsky, Gil Broza, C. Keith Ray

If you want to spend less time debugging or manually testing, and more time programming faster or making important design changes, you're ready for microtesting! A microtest (also known as a unit test) automatically verifies a single behavior of a single object.



Get this Album

Volume Licensing

Have Any Questions?

Highlights

Instant Critiques: Take a microtesting exercise and get instant feedback from our automated band of experts. Learn more...
Expert Videos: Learn tools & techniques by watching short videos from industry experts. Learn more...

Integrated Forums: Ask questions, get expert replies and read fascinating discussions. Learn more...

Includes

  • 4-7 hours of content
  • 142 pages
  • 14 Interactive quizzes
  • 5 Videos
  • 3 Exercises
  • Automated Microtesting Critiques
  • Support for Eclipse
  • Support for IntelliJ

Contents

Welcome to Microtesting! 3
You Are Here 4
Why Use Automated Microtests? ← Click to Preview 5
Three Dimensions Of Microtesting 6
This Album 7
What's In It For Me? 8
Definition Of A Microtest 10
What About Unit Tests? ← Click to Preview 11
Keyword: Microtest 12
Testing In Isolation ← Click to Preview 13
Testing In The Tool 14
Testing Production Code 16
Testing Execution Paths ← Click to Preview 17
Microtest Name and Scope 18
A Sample Microtest 19
The Universal Structure of Microtests 20
The Fidelity Rule ← Click to Preview 21
The Documentation Rule 22
Our Goal 24
Keyword: Interesting 25
What's 'Interesting'? 26
Keyword: Data Context 27
Data Context 28
The Judgment Premise 29
JUnit ← Click to Preview 31
Study Code Samples In Your Environment 32
Principles Of Writing xUnit Tests 33
Test Case 34
Test Methods 35
Assertions ← Click to Preview 36
Failure Messages 37
Testing Exceptions ← Click to Preview 38
Duplicated Setup Code 39
Teardown 40
One-Time Setup and Teardown 41
Test Organization 42
Principles of Running xUnit Tests 43
Pass, Fail & Error 44
Automatic Test Discovery 45
Download & Play with The Code Samples 46
Why Record? 48
The Steps You'll Take 49
Step 1. Install the Recorder 50
Step 2. Download the Exercise 51
Step 3. Import the Exercise 52
Step 4. Perform the Exercise 53
Step 5. Upload the Archive 54
Step 6. Critique Your Performance 55
Remaining Issues 56
Carry On! 57
A TagNode's Responsibilities 59
One Large Test 60
What's Wrong With Large Tests? 61
Refactoring A Large Test Into Microtests 62
Exercise Advice 63
Assessing The Exercise 64
Installing the Recorder 65
Download the Exercise 66
Upload your Exercise 67
How You Scored 68
Your Customized Feedback 69
Our Solution 70
Microtests Must Be Precise 72
What's The Difference? 73
Which Tests Are Precise? 74
Microtests Honor Boundaries 76
Why Boundaries Matter 77
Looking Inside Isn't Reaching Inside 78
Why To Look: A Branchy Situation 79
Looking Gives Us A Choice 80
Why To Look: Using Fakes 81
Let's Wrangle: Three Judgment Calls 82
The Puzzle Of The List 84
Capacity And Containers: A Survey 85
Test Independence 87
Manifestations Of Test Dependence 88
Limit Expectations 89
Eliminate Side-Effects 90
More Examples Of Test Dependence 91
Writing Basic Tests 93
The Tail Data 94
Tail Priorities 95
This Design Sucks 96
Comparing Tails 97
Assessing The Exercise 98
Installing the Recorder 99
Get The Starting Code 100
The Dumbest Case 101
Testing The Dumbest Case 102
The Same IDs 103
Now We're Making Progress! 104
The Same IDs could differ 105
How about now? 106
Keep The Axe Sharp! 107
Sharing Data Creation 108
A Perfect Test 109
Designing Your Test Data 110
Test Data vs. Coverage 111
The Rest Of The Story 112
Upload Your Exercise 113
How You Scored 114
Your Customized Feedback 115
Our Solution 116
Microtests and Exceptions 118
The Exception Syllogism 119
Microtesting A Throw 120
Microtesting A Catch 121
Testing That You Catch The Right Thing? 122
Testing A Simple Catch Resolution 123
My Catcher Is Complicated 124
Oh, And One More Thing… 125
Quiz: Your Exceptional Knowledge 126
Practice, Practice, Practice ← Click to Preview 128
Four Priorities 129
The TailQueue Code 130
Unqueueing Tails ← Click to Preview 131
Assessing The Exercise 132
Installing the Recorder 133
Download the Next Version 134
The TailQueue Mission 135
Upload Your Exercise 136
How You Scored 137
Your Customized Feedback 138
Instructor Solution Part 1: Testing Basic Retrieval 139
Instructor Solution Part 2: Testing Preferences 140
Conclusion: What's Next? 142

Related Items

Supported Browsers

  • Latest Firefox
  • Internet Explorer 8+
  • Latest Chrome
  • Latest Safari

Operating Systems

  • Windows
  • Linux
  • Mac OS X

Development Tools

You can use whatever developments tools you prefer. If you do use an IDE (Integrated Development Environment), many (though not all) of our labs come with projects pre-configured for Eclipse, IntelliJ and Visual Studio.

Speakers or headphones are required for our videos.

Flash is required to view charts or watch videos — download for free.