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

Related Items

Get this Album

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

Related Items