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
  • 132 pages
  • 14 Interactive quizzes
  • 5 Videos
  • 2 Exercises
  • Automated Microtesting Critique
  • Platform-independent code
  • Support for Visual Studio
  • Support for Eclipse CDT
  • Uses Google Test

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
gTest ← 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
Teardown Vs Destructor 41
One-Time Setup and Teardown 42
Typed Tests 43
Principles of Running xUnit Tests 44
Pass, Fail & Error 45
ASSERT vs. EXPECT 46
Automatic Test Discovery 47
Installing Our Plugin 48
Download & Play with The Code Samples 49
Why Record? 51
The Steps You'll Take 52
Step 1. Install the GTest Result Viewer (Optional) 53
Step 2. Download the Exercise 54
Step 3. Import the Exercise 55
Step 4. Perform the Exercise 56
Step 5. Upload the Archive 57
Step 6. Critique Your Performance 58
Remaining Issues 59
Carry On! 60
A TagNode's Responsibilities 62
One Large Test 63
What's Wrong With Large Tests? 64
Refactoring A Large Test Into Microtests 65
Exercise Advice 66
Download the Exercise 67
Our Solution 68
Microtests Honor Boundaries 70
Why Boundaries Matter 71
Looking Inside Isn't Reaching Inside 72
Why To Look: A Branchy Situation 73
Looking Gives Us A Choice 74
Why To Look: Using Fakes 75
Let's Wrangle: Three Judgment Calls 76
Test Independence 78
Manifestations Of Test Dependence 79
Limit Expectations 80
Eliminate Side-Effects 81
More Examples Of Test Dependence 82
Writing Basic Tests 84
The Tail Data 85
Tail Priorities 86
Comparing Tails 87
Assessing The Exercise 88
Installing Our Plugin 89
Get The Starting Code 90
The Dumbest Case 91
Testing The Dumbest Case 92
The Same IDs 93
Now We're Making Progress! 94
The Same IDs Could Differ 95
How About Now? 96
Keep The Axe Sharp! 97
Sharing Data Creation 98
A Perfect Test 99
Designing Your Test Data 100
Test Data vs. Coverage 101
The Rest Of The Story 102
Upload Your Exercise 103
How You Scored 104
Your Customized Feedback 105
Our Solution 106
Microtests and Exceptions 108
The Exception Syllogism 109
Microtesting A Throw 110
Microtesting A Catch 111
Testing That You Catch The Right Thing? 112
Testing A Simple Catch Resolution 113
My Catcher Is Complicated 114
Oh, And One More Thing… 115
Quiz: Your Exceptional Knowledge 116
Practice, Practice, Practice ← Click to Preview 118
Four Priorities 119
The TailQueue Code 120
Unqueueing Tails ← Click to Preview 121
Assessing The Exercise 122
Installing Our Plugin 123
Download the Next Version 124
The TailQueue Mission 125
Upload Your Exercise 126
How You Scored 127
Your Customized Feedback 128
Instructor Solution Part 1: Testing Basic Retrieval 129
Instructor Solution Part 2: Testing Preferences 130
Conclusion: What's Next? 132

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.