Microtesting

Testing Single Responsibilities at High Speed — C Edition

Art for Microtesting Check Out A Preview

By Mike Hill, Joshua Kerievsky, Gil Broza, C. Keith Ray, Jon Reid, Anthony Sciamanna

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.

Highlights

Instant Critiques
Instant Critiques: Take a microtesting exercise and get instant feedback from our automated band of experts. Learn more...
Expert Videos
Expert Videos: Learn tools & techniques by watching short videos from industry experts. Learn more...
Integrated Forums
Integrated Forums: Ask questions, get expert replies and read fascinating discussions. Learn more...

Includes

  • 4-7 hours of content
  • 141 pages
  • 14 Interactive quizzes
  • 5 Videos
  • 2 Exercises
  • Support for Visual Studio
  • Support for Eclipse CDT
  • Uses embUnit

Contents

Welcome to Microtesting! 3
You Are Here 4
Why Use Automated Microtests? ← Click to Preview 5
3 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
embUnit ← Click to Preview 31
Study Code Samples in Your Environment 32
Principles Of Writing xUnit Tests 33
Test Case 34
Test Functions 35
Assertions ← Click to Preview 36
Failure Messages 37
Duplicated Setup Code 38
Teardown 39
Principles of Running xUnit Tests 40
Failure, Error & Pass 41
Registering Tests 42
All Tests 43
Installing Our Plugin 44
Download & Play with the Code Samples 45
A Simple List 47
What Does List Do? 48
Is This Test a Micro Test? 49
The Problems With Elephant Tests 50
What About This Test? 51
Now This Is Micro! ← Click to Preview 52
Why So Micro? 53
Designing Effective Microtests 55
Aren't We Coupling Tests to Implementation? 56
Black-Box and White-Box Testing ← Click to Preview 57
The Dangers of White-Box Testing 58
One Case Seems to Require White-Box Testing 59
Is There an Acceptable Black-Box Approach? 60
Allowing White-Box Testing 61
White-Box Testing Quiz 62
One Way to Test List 63
Verifying a Method by Calling Another Method 64
Another Way to Test List 65
Two Different Ways to Test List 66
The One True Way 67
Summary 68
Review: Another Set of Tests 69
Review: Over-Testing? 70
Test Independence ← Click to Preview 72
Manifestations of Test Dependence 73
Limit Expectations 74
Eliminate Side-Effects 75
More Examples of Test Dependence 76
Writing Basic Tests 78
The Tail Data 79
Tail Priorities 80
Comparing Tails 81
Assessing the Exercise 82
Installing Our Plugin 83
Get the Starting Code 84
The Dumbest Case 85
Testing the Dumbest Case 86
The Same IDs 87
Now We're Making Progress! 88
The Same IDs Could Differ 89
How About Now? 90
Keep The Axe Sharp! 91
Sharing Data Creation 92
A Perfect Test? 93
Designing Your Test Data 94
Brain-Twister: Test Data vs. Coverage 95
The Rest of the Story 96
Upload Your Exercise 97
How You Scored 98
Your Customized Feedback 99
Our Solution 100
Happy Paths 102
Pathological Cases 103
Which Situations Are Pathological? 104
Context 105
Likelihood And Impact 106
Practice With TailQueue 107
Adding Tails 108
Cases of Adding Tails 109
The Interesting Pathologies ← Click to Preview 110
Which Test to Write First? 111
Installing Our Plugin 112
Download Last Solution Or Continue With Yours 113
Write the First Test 114
The First Test — Our Solution 115
Which Test to Write Second? 116
Testing Errors 117
Write the Second Test 118
The Second Test — Our Solution 119
That Was Easy 120
Catcher in the Try 121
Uninteresting Pathologies 122
Summary 123
Review 1: Order Of Testing 124
Review 2: To Write or Not to Write a Microtest 125
Practice, Practice, Practice ← Click to Preview 127
Four Priorities 128
The TailQueue Code 129
Unqueueing Tails ← Click to Preview 130
Assessing the Exercise 131
Installing Our Plugin 132
Download the Next Version 133
The TailQueue Mission 134
Upload Your Exercise 135
How You Scored 136
Your Customized Feedback 137
Instructor Solution Part 1: Testing Basic Retrieval 138
Instructor Solution Part 2: Testing Preferences 139
Conclusion: What's Next? 141

Related Items

Volume Licensing

Have Any Questions?

Highlights

Instant Critiques
Instant Critiques: Take a microtesting exercise and get instant feedback from our automated band of experts. Learn more...
Expert Videos
Expert Videos: Learn tools & techniques by watching short videos from industry experts. Learn more...
Integrated Forums
Integrated Forums: Ask questions, get expert replies and read fascinating discussions. Learn more...

Includes

  • 4-7 hours of content
  • 141 pages
  • 14 Interactive quizzes
  • 5 Videos
  • 2 Exercises
  • Support for Visual Studio
  • Support for Eclipse CDT
  • Uses embUnit

Contents

Welcome to Microtesting! 3
You Are Here 4
Why Use Automated Microtests? ← Click to Preview 5
3 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
embUnit ← Click to Preview 31
Study Code Samples in Your Environment 32
Principles Of Writing xUnit Tests 33
Test Case 34
Test Functions 35
Assertions ← Click to Preview 36
Failure Messages 37
Duplicated Setup Code 38
Teardown 39
Principles of Running xUnit Tests 40
Failure, Error & Pass 41
Registering Tests 42
All Tests 43
Installing Our Plugin 44
Download & Play with the Code Samples 45
A Simple List 47
What Does List Do? 48
Is This Test a Micro Test? 49
The Problems With Elephant Tests 50
What About This Test? 51
Now This Is Micro! ← Click to Preview 52
Why So Micro? 53
Designing Effective Microtests 55
Aren't We Coupling Tests to Implementation? 56
Black-Box and White-Box Testing ← Click to Preview 57
The Dangers of White-Box Testing 58
One Case Seems to Require White-Box Testing 59
Is There an Acceptable Black-Box Approach? 60
Allowing White-Box Testing 61
White-Box Testing Quiz 62
One Way to Test List 63
Verifying a Method by Calling Another Method 64
Another Way to Test List 65
Two Different Ways to Test List 66
The One True Way 67
Summary 68
Review: Another Set of Tests 69
Review: Over-Testing? 70
Test Independence ← Click to Preview 72
Manifestations of Test Dependence 73
Limit Expectations 74
Eliminate Side-Effects 75
More Examples of Test Dependence 76
Writing Basic Tests 78
The Tail Data 79
Tail Priorities 80
Comparing Tails 81
Assessing the Exercise 82
Installing Our Plugin 83
Get the Starting Code 84
The Dumbest Case 85
Testing the Dumbest Case 86
The Same IDs 87
Now We're Making Progress! 88
The Same IDs Could Differ 89
How About Now? 90
Keep The Axe Sharp! 91
Sharing Data Creation 92
A Perfect Test? 93
Designing Your Test Data 94
Brain-Twister: Test Data vs. Coverage 95
The Rest of the Story 96
Upload Your Exercise 97
How You Scored 98
Your Customized Feedback 99
Our Solution 100
Happy Paths 102
Pathological Cases 103
Which Situations Are Pathological? 104
Context 105
Likelihood And Impact 106
Practice With TailQueue 107
Adding Tails 108
Cases of Adding Tails 109
The Interesting Pathologies ← Click to Preview 110
Which Test to Write First? 111
Installing Our Plugin 112
Download Last Solution Or Continue With Yours 113
Write the First Test 114
The First Test — Our Solution 115
Which Test to Write Second? 116
Testing Errors 117
Write the Second Test 118
The Second Test — Our Solution 119
That Was Easy 120
Catcher in the Try 121
Uninteresting Pathologies 122
Summary 123
Review 1: Order Of Testing 124
Review 2: To Write or Not to Write a Microtest 125
Practice, Practice, Practice ← Click to Preview 127
Four Priorities 128
The TailQueue Code 129
Unqueueing Tails ← Click to Preview 130
Assessing the Exercise 131
Installing Our Plugin 132
Download the Next Version 133
The TailQueue Mission 134
Upload Your Exercise 135
How You Scored 136
Your Customized Feedback 137
Instructor Solution Part 1: Testing Basic Retrieval 138
Instructor Solution Part 2: Testing Preferences 139
Conclusion: What's Next? 141

Related Items