As this ebook edition doesn't have fixed pagination, the page numbers below are hyperlinked for reference only, based on the printed edition of this book.
A
abstraction 19
acceptance testing tools 186, 187
replacing, with test doubles 166, 167
agile development 50
American Standard Code for Information Interchange (ASCII) 95
Application Programming Interface (API) 49, 77
Arrange-Act-Assert (AAA) 56
automated code analysis
benefits 204
limitations 204
automated testing 202, 203, 221
B
bad code
purpose 5
bad code, recognizing 6
cohesion 10
coupling 10
high coupling, between classes 12
black box component 77
blue-green deployment 193
broken tests
writing, concerns 35
build.gradle file
libraries, adding 284
business outcomes
C
Characterization Test technique 39
Chicago TDD 223
Chrysler Comprehensive Compensation project 200
CI/CD workflows
Classicist TDD 223
code
test-driving, to play game 298-304
code-and-fix style 32
code coverage metric
code coverage tool 216
code readability 83
code review 203
code smell
defining 82
reference link 82
cohesion 10
collaborators
error handling, testing challenges 121
unrepeatable behavior, testing challenges 120, 121
Computer-Aided Software Engineering (CASE) tools 215
Configuration Object 66
consumer-driven contract testing 183, 184
continuous delivery (CD) 190
benefits 189
defining 187
need for 189
continuous deployment (CD) 190
defining 187
continuous integration (CI)
defining 187
goal 188
continuous integration/continuous delivery (CI/CD) approach 209
coupling 10
Cucumber
URL 186
cyclomatic complexity (CYC) 21, 220
D
database
designing 173
database adapters
database integration test
database port
components 162
database-rider 195
DBRider
database test, creating with 269-271
dead-code path 21
dependency injection 125
dependency inversion (DI) 104, 125, 153, 154
Dependency Inversion Principle (DIP) 130
applying, to shapes code 106-109
irrelevant details, hiding 104-106
design
advancing, with two-letter combinations 85-92
design flaws
tests, writing benefits 23, 24
development environment
preparing 46
DevOps 208
diagnostic method 241
domain 20
domain layer
domain model
calls, abstracting to web services 163, 164
code, writing 164
database, abstracting 162, 163
frameworks, using 165
libraries, using 165
programming approach, deciding 165
web requests and responses, abstracting 161, 162
E
advantages and disadvantges 184
ensemble programming 205
error condition
error handling code
exceptions
exploratory testing 202
external system
abstracting 160
domain model requirement 160
test doubles, substituting 166
external systems, challenges 150
accidental transactions 151
environmental problems 151
operating system calls 152
system time 152
uncertain data 152
Extreme Programming (XP) 28
F
failing test
false negative test 180
fast, isolated, repeatable, self-checking, and timely (FIRST) 60, 61, 236
feature flags 210
flaky tests 180
foreign method 241
functional programming (FP) 20, 158
future defects
fuzzing
reference link 208
G
getters 241
getXxx() methods 241
Goodhart’s law 216
Google style guide
reference link 6
Google Tricorder 204
H
happy path manual tests 5
Hawaii false missile attack warning
reference link 152
hexagonal architecture 153-155
adapters, testing 227
domain logic, testing with 226, 227
golden rule 159
hexagon shape, need for 160
test boundaries, defining with 226
user stories, testing 228, 229
hexagonal architecture, components
adapters, connecting to ports 157, 158
external systems connect to adapters 156
overviewing 155
ports, connecting to domain model 158, 159
high cohesion 116
high coupling 12
HTTP server
creating 288
Hypertext Markup Language (HTML) 99
I
information hiding 19
inside-out TDD approach 222
challenges 224
using 223
advantages 180
consumer-driven contract testing 183, 184
database adapters, testing 181, 182
for database 194
limitations 180
web services, testing 182
IntelliJ IDE
download link 46
installing 46
Interface Segregation Principle (ISP)
effective interfaces 115
usage, reviewing in shapes code 115-117
Inversion of Control (IoC) 125
Invision
URL 207
J
Java
libraries and projects, setting up 46-48
Jest
URL 206
K
keep it simple, stupid (KISS) 71
L
leaky abstractions
preventing 25
legacy code 132
managing, without tests 39
libraries
adding, to project 284
Liskov Substitution Principle (LSP)
usage, reviewing in shapes code 111
live-like environment 191
logic flaws
manual testing, limits 26
preventing 25
test, automating to solve problems 26, 27
low cohesion 10
M
manual exploratory testing 201-203
manual testing
limits 26
method name 19
Mockito 244
distinction, blurring between stubs and mocks 142
URL 133
used, for writing mock 141, 142
used, for writing stub 133-141
verify() method 142
when() method 142
working with 133
mock objects 127
overuse, avoiding 130
usage, scenarios 132
using, to verify interactions 127-130
mocks
code, avoiding for concrete class written outside of team 130, 131
testing, avoidance 132
value objects, avoiding 131
N
Net Promoter Score®™ (NPS) 14
O
object-oriented (OO) design 97
object-oriented programming (OOP) 20, 95, 158
object wiring 125
Open-Closed Principle (OCP)
adding, to new type of shape code 114, 115
open source HTTP libraries 284
outside-in TDD approach 224, 225
advantages and disadvantages 225
OWASP Top 10 Web Application Security Risks
reference link 208
P
Pact
URL 184
penetration testing (pentesting) 208
Ports and Adapters 155
Postgres database
pre-canned results
stubs, using 126
procedural programming 20
public methods
encapsulation, preserving 64, 65
testing 64
pull model 127
pull request 204
push model 127
Q
Quality Assurance (QA) engineer 15
quality code
accidental complexity, avoiding 20-22
goal 18
R
RAID logs 215
random numbers adapters
designing 173
red, green, refactor (RGR) cycle 75-79
regression tests 201
repository 162
repository interfaces 168
RestAssured
URL 186
RestEasy
reference link 186
rider-junit5 library 269
S
sandbox APIs 183
scaffolding test 248
security risks 208
Selenium
reference link 186
shapes code
LSP usage, reviewing 111
OCP, adding to type of 114, 115
shift-left approach 222
Single Responsibility Principle (SRP)
Sonarqube
URL 203
Spoofing, Tampering, Repudiation, Information Disclosure, Denial of Service, and Elevation of Privilege (STRIDE)
reference link 208
Spring
URL 125
staging environment 191
stub
using, for pre-canned results 126
stub objects
usage scenarios 127
stubs and mocks
distinction, blurring between 142
switch-on-type 105
T
team performance
technical debt 13
test boundaries
defining, with hexagonal architecture 226
test doubles 122
benefits 166
production version of code, creating 124, 125
substituting, for external systems 166
used, for replacing adapters 166, 167
using, scenarios 130
test-driven application
Test-Driven Development (TDD) 3, 31, 95
agile development, combining with 52, 53
automated regression testing 201
benefits, of slowing down 32, 33
emergent design 217
expectations, managing 37
limits 200
objections to not catching every bug, overcoming 35
objections to tests slowing users down, overcoming 33
problem-inflated expectations 36
test, writing before production code 40
test environments 181, 187, 191
advantages and disadvantages 191
test-first
acting, as design tool 214
Act stage 214
adding 213
Arrange stage 214
Assert stage 215
code coverage metrics 215, 216
form executable specifications 215
used, for making design decisions 214
writing, in continuous delivery situations 218
testing timeline 222
test-later
benefits 219
tests 65
act step 66
arrange step 65
assert step 66
automating, to solve problems 26, 27
code coverage 67
common errors, catching 62, 63
defining 59
error handling code with 144, 145
FIRST principles, applying 60, 61
missing 24
running, in production 192
single assert, using per test 61
writing, for Wordz application 79-85
tests, writing
after code, versus tests writing before code 218
benefits, analyzing before production code 23, 24
leaky abstractions, preventing 25
two-letter combinations
U
UML diagram
for shapes code 98
Unified Modeling Language (UML) 97
unit testing
bigger units 167
advantages 178
Arrange-Act-Assert (AAA) 56
domain model 179
outcomes, working backwards 58
scope, deciding 61
workflow, increasing 59
untestable code
user acceptance tests 177, 184-186
user experience
evaluating 207
sections 52
V
variable name 19
verify() method 142
W
waterfall development 50
web services
testing 182
when() method 142
WordRepository adapter implementation 276, 277
GameRepository, implementing 279
Wordz 168
database, designing 173
error condition, testing 145-147
random numbers adapters, designing 173
repository interface, designing 168-173
Wordz application 48
rules, describing 49
word, fetching from database 194-197
Wordz game
coding 235
domain layer, connecting to 290-293
ending 254
HTTP server, creating 288
HTTP server routes, adding 289, 290
libraries, adding to project 284
score interface, designing 250-252
start game code, refactoring 293
starting 284
word selection logic, triangulating 244-249
Wordz game, end-of-game detection
correct guess, responding 255, 256
maximum number of guesses, triangulating 256, 257
response, triangulating to guess after game over 257-259
Wordz web service application
wrong tests
writing 67
Y