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
  • 144 pages
  • 14 Interactive quizzes
  • 5 Videos
  • 2 Exercises
  • Automated Microtesting Critique
  • Support for Visual Studio

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
NUnit and MSTest ← 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
Principles of Running xUnit Tests 42
Failure, Error & Pass 43
Automatic Test Discovery 44
Download & Play with the Code Samples 45
Why Record? 47
The Steps To Take 48
Install the Recorder 49
Download the Exercise 50
Import the Exercise 51
Perform the Exercise 52
Upload the Archive 53
Critique Your Performance 54
Remaining Issues 55
Carry On! 56
A TagNode's Responsibilities 58
One Large Test 59
What's Wrong With Large Tests? 60
Refactoring a Large Test Into Microtests 61
Exercise Advice 62
Download the Exercise 63
Our Solution 64
A Different Approach: AssertThat() 66
Special Assertions 67
Chaining Assertions 68
Pros and Cons 69
Example 70
How to Get Started 71
A Simple List 73
What Does List Do? 74
Is This Test a Micro Test? 75
The Problems With Elephant Tests 76
What About This Test? 77
Now This Is Micro! ← Click to Preview 78
Why So Micro? 79
Microtests Honor Boundaries 81
Why Boundaries Matter 82
Looking Inside Isn't Reaching Inside 83
Why To Look: A Branchy Situation 84
Looking Gives Us A Choice 85
Why To Look: Using Fakes 86
Let's Wrangle: Three Judgment Calls 87
Test Independence ← Click to Preview 89
Manifestations of Test Dependence 90
Limit Expectations 91
Eliminate Side-Effects 92
More Examples of Test Dependence 93
Writing Basic Tests 95
The Tail Data 96
Tail Priorities 97
This Design Sucks 98
Comparing Tails 99
Assessing the Exercise 100
Installing the Recorder 101
Get the Starting Code 102
The Dumbest Case 103
Testing the Dumbest Case 104
The Same IDs 105
Now We're Making Progress! 106
The Same IDs Could Differ 107
How About Now? 108
Keep The Axe Sharp! 109
Sharing Data Creation 110
A Perfect Test? 111
Designing Your Test Data 112
Brain-Twister: Test Data vs. Coverage 113
The Rest of the Story 114
Upload Your Exercise 115
How You Scored 116
Your Customized Feedback 117
Our Solution 118
Microtests and Exceptions 120
The Exception Syllogism 121
Microtesting a Throw 122
Microtesting a Catch 123
Testing That You Catch the Right Thing? 124
Testing a Simple Catch Resolution 125
My Catcher Is Complicated 126
Oh, and One More Thing… 127
Quiz: Your Exceptional Knowledge 128
Practice, Practice, Practice ← Click to Preview 130
Four Priorities 131
The TailQueue Code 132
Unqueueing Tails ← Click to Preview 133
Assessing the Exercise 134
Installing the Recorder 135
Download the Next Version 136
The TailQueue Mission 137
Upload Your Exercise 138
How You Scored 139
Your Customized Feedback 140
Instructor Solution Part 1: Testing Basic Retrieval 141
Instructor Solution Part 2: Testing Preferences 142
Conclusion: What's Next? 144

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
  • 144 pages
  • 14 Interactive quizzes
  • 5 Videos
  • 2 Exercises
  • Automated Microtesting Critique
  • Support for Visual Studio

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
NUnit and MSTest ← 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
Principles of Running xUnit Tests 42
Failure, Error & Pass 43
Automatic Test Discovery 44
Download & Play with the Code Samples 45
Why Record? 47
The Steps To Take 48
Install the Recorder 49
Download the Exercise 50
Import the Exercise 51
Perform the Exercise 52
Upload the Archive 53
Critique Your Performance 54
Remaining Issues 55
Carry On! 56
A TagNode's Responsibilities 58
One Large Test 59
What's Wrong With Large Tests? 60
Refactoring a Large Test Into Microtests 61
Exercise Advice 62
Download the Exercise 63
Our Solution 64
A Different Approach: AssertThat() 66
Special Assertions 67
Chaining Assertions 68
Pros and Cons 69
Example 70
How to Get Started 71
A Simple List 73
What Does List Do? 74
Is This Test a Micro Test? 75
The Problems With Elephant Tests 76
What About This Test? 77
Now This Is Micro! ← Click to Preview 78
Why So Micro? 79
Microtests Honor Boundaries 81
Why Boundaries Matter 82
Looking Inside Isn't Reaching Inside 83
Why To Look: A Branchy Situation 84
Looking Gives Us A Choice 85
Why To Look: Using Fakes 86
Let's Wrangle: Three Judgment Calls 87
Test Independence ← Click to Preview 89
Manifestations of Test Dependence 90
Limit Expectations 91
Eliminate Side-Effects 92
More Examples of Test Dependence 93
Writing Basic Tests 95
The Tail Data 96
Tail Priorities 97
This Design Sucks 98
Comparing Tails 99
Assessing the Exercise 100
Installing the Recorder 101
Get the Starting Code 102
The Dumbest Case 103
Testing the Dumbest Case 104
The Same IDs 105
Now We're Making Progress! 106
The Same IDs Could Differ 107
How About Now? 108
Keep The Axe Sharp! 109
Sharing Data Creation 110
A Perfect Test? 111
Designing Your Test Data 112
Brain-Twister: Test Data vs. Coverage 113
The Rest of the Story 114
Upload Your Exercise 115
How You Scored 116
Your Customized Feedback 117
Our Solution 118
Microtests and Exceptions 120
The Exception Syllogism 121
Microtesting a Throw 122
Microtesting a Catch 123
Testing That You Catch the Right Thing? 124
Testing a Simple Catch Resolution 125
My Catcher Is Complicated 126
Oh, and One More Thing… 127
Quiz: Your Exceptional Knowledge 128
Practice, Practice, Practice ← Click to Preview 130
Four Priorities 131
The TailQueue Code 132
Unqueueing Tails ← Click to Preview 133
Assessing the Exercise 134
Installing the Recorder 135
Download the Next Version 136
The TailQueue Mission 137
Upload Your Exercise 138
How You Scored 139
Your Customized Feedback 140
Instructor Solution Part 1: Testing Basic Retrieval 141
Instructor Solution Part 2: Testing Preferences 142
Conclusion: What's Next? 144

Related Items