Microtesting

Testing Single Responsibilities at High Speed — Java 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
  • 149 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
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
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
Failure, Error & Pass 44
Automatic Test Discovery 45
Download & Play with the Code Samples 46
Why Record? 48
The Steps To Take 49
Install the Recorder 50
Download the Exercise 51
Import the Exercise 52
Perform the Exercise 53
Upload the Archive 54
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
A Different Approach: assertThat() 72
Special Assertions 73
Chaining Assertions 74
Pros and Cons 75
Example 76
How to Get Started 77
Microtests Must Be Precise 79
What's the Difference? 80
Which Tests Are Precise? 81
Microtests Honor Boundaries 83
Why Boundaries Matter 84
Looking Inside Isn't Reaching Inside 85
Why To Look: A Branchy Situation 86
Looking Gives Us A Choice 87
Why To Look: Using Fakes 88
Let's Wrangle: Three Judgment Calls 89
The Puzzle of the List 91
Capacity and Containers: A Survey 92
Test Independence ← Click to Preview 94
Manifestations of Test Dependence 95
Limit Expectations 96
Eliminate Side-Effects 97
More Examples of Test Dependence 98
Writing Basic Tests 100
The Tail Data 101
Tail Priorities 102
This Design Sucks 103
Comparing Tails 104
Assessing the Exercise 105
Installing the Recorder 106
Get the Starting Code 107
The Dumbest Case 108
Testing the Dumbest Case 109
The Same IDs 110
Now We're Making Progress! 111
The Same IDs Could Differ 112
How About Now? 113
Keep The Axe Sharp! 114
Sharing Data Creation 115
A Perfect Test? 116
Designing Your Test Data 117
Brain-Twister: Test Data vs. Coverage 118
The Rest of the Story 119
Upload Your Exercise 120
How You Scored 121
Your Customized Feedback 122
Our Solution 123
Microtests and Exceptions 125
The Exception Syllogism 126
Microtesting a Throw 127
Microtesting a Catch 128
Testing That You Catch the Right Thing? 129
Testing a Simple Catch Resolution 130
My Catcher Is Complicated 131
Oh, and One More Thing… 132
Quiz: Your Exceptional Knowledge 133
Practice, Practice, Practice ← Click to Preview 135
Four Priorities 136
The TailQueue Code 137
Unqueueing Tails ← Click to Preview 138
Assessing the Exercise 139
Installing the Recorder 140
Download the Next Version 141
The TailQueue Mission 142
Upload Your Exercise 143
How You Scored 144
Your Customized Feedback 145
Instructor Solution Part 1: Testing Basic Retrieval 146
Instructor Solution Part 2: Testing Preferences 147
Conclusion: What's Next? 149

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
  • 149 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
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
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
Failure, Error & Pass 44
Automatic Test Discovery 45
Download & Play with the Code Samples 46
Why Record? 48
The Steps To Take 49
Install the Recorder 50
Download the Exercise 51
Import the Exercise 52
Perform the Exercise 53
Upload the Archive 54
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
A Different Approach: assertThat() 72
Special Assertions 73
Chaining Assertions 74
Pros and Cons 75
Example 76
How to Get Started 77
Microtests Must Be Precise 79
What's the Difference? 80
Which Tests Are Precise? 81
Microtests Honor Boundaries 83
Why Boundaries Matter 84
Looking Inside Isn't Reaching Inside 85
Why To Look: A Branchy Situation 86
Looking Gives Us A Choice 87
Why To Look: Using Fakes 88
Let's Wrangle: Three Judgment Calls 89
The Puzzle of the List 91
Capacity and Containers: A Survey 92
Test Independence ← Click to Preview 94
Manifestations of Test Dependence 95
Limit Expectations 96
Eliminate Side-Effects 97
More Examples of Test Dependence 98
Writing Basic Tests 100
The Tail Data 101
Tail Priorities 102
This Design Sucks 103
Comparing Tails 104
Assessing the Exercise 105
Installing the Recorder 106
Get the Starting Code 107
The Dumbest Case 108
Testing the Dumbest Case 109
The Same IDs 110
Now We're Making Progress! 111
The Same IDs Could Differ 112
How About Now? 113
Keep The Axe Sharp! 114
Sharing Data Creation 115
A Perfect Test? 116
Designing Your Test Data 117
Brain-Twister: Test Data vs. Coverage 118
The Rest of the Story 119
Upload Your Exercise 120
How You Scored 121
Your Customized Feedback 122
Our Solution 123
Microtests and Exceptions 125
The Exception Syllogism 126
Microtesting a Throw 127
Microtesting a Catch 128
Testing That You Catch the Right Thing? 129
Testing a Simple Catch Resolution 130
My Catcher Is Complicated 131
Oh, and One More Thing… 132
Quiz: Your Exceptional Knowledge 133
Practice, Practice, Practice ← Click to Preview 135
Four Priorities 136
The TailQueue Code 137
Unqueueing Tails ← Click to Preview 138
Assessing the Exercise 139
Installing the Recorder 140
Download the Next Version 141
The TailQueue Mission 142
Upload Your Exercise 143
How You Scored 144
Your Customized Feedback 145
Instructor Solution Part 1: Testing Basic Retrieval 146
Instructor Solution Part 2: Testing Preferences 147
Conclusion: What's Next? 149

Related Items