Index

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

adapters 156, 180

replacing, with test doubles 166, 167

agile development 50

combining, with TDD 52, 53

exploring 50, 51

user stories, reading 51, 52

American Standard Code for Information Interchange (ASCII) 95

Application Programming Interface (API) 49, 77

argument matchers 142-144

Arrange-Act-Assert (AAA) 56

automated code analysis

benefits 204

limitations 204

automated testing 202, 203, 221

B

bad code

purpose 5

writing 3, 4, 5

bad code, recognizing 6

cohesion 10

coupling 10

error-prone constructs 9, 10

high coupling, between classes 12

low cohesion, in class 10, 11

namespacing 7-9

technical issues 6, 7

black box component 77

blue-green deployment 193

broken tests

writing, concerns 35

build.gradle file

libraries, adding 284

business outcomes

diminishing 14, 15, 16

C

Characterization Test technique 39

Chicago TDD 223

Chrysler Comprehensive Compensation project 200

CI/CD pipelines 187, 190

stages 190, 191

CI/CD workflows

manual elements 209, 210

Classicist TDD 223

code

documenting 28, 29

test-driving, to play game 298-304

code-and-fix style 32

code coverage metric

avoiding, as target 216, 217

code coverage tool 216

code readability 83

code review 203

approaches 204, 205

code smell

defining 82

reference link 82

cohesion 10

collaborators

error handling, testing challenges 121

testing, challenges 120, 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

need for 187, 188

continuous integration/continuous delivery (CI/CD) approach 209

coupling 10

Cucumber

URL 186

cyclomatic complexity (CYC) 21, 220

D

database

designing 173

word, fetching from 194-197

database adapters

testing 181, 182

database integration test

creating 268, 269

production code 272-276

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

revealing 22, 23

tests, writing benefits 23, 24

development environment

preparing 46

DevOps 208

diagnostic method 241

domain 20

domain layer

connecting to 290-293

domain model

calls, abstracting to web services 163, 164

code, writing 164

database, abstracting 162, 163

deciding 164, 165

frameworks, using 165

libraries, using 165

programming approach, deciding 165

web requests and responses, abstracting 161, 162

E

end-to-end tests 177, 184-186

advantages and disadvantges 184

ensemble programming 205

error condition

testing, in Wordz 145-147

error handling code

with tests 144, 145

exceptions

asserting 63, 64

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

third-party services 152, 153

uncertain data 152

Extreme Programming (XP) 28

F

failing test

writing 285-287

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

protecting against 27, 28

fuzzing

reference link 208

G

getters 241

getXxx() methods 241

Goodhart’s law 216

Google style guide

reference link 6

Google Tricorder 204

green phase 77, 78

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

routes, adding 289, 290

Hypertext Markup Language (HTML) 99

I

information hiding 19

inside-out TDD approach 222

advantages 223, 224

challenges 224

using 223

integration tests 177-180

adapter layer 180, 181

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)

swappable objects 109, 110

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

argument matcher 142-144

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

dependency injection 131, 132

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

extensible design 112, 113

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

pair programming 38, 205

penetration testing (pentesting) 208

Ports and Adapters 155

Postgres database

installing 267, 268

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

abstraction 19, 20

accidental complexity, avoiding 20-22

designing 17, 18

goal 18

information hiding 19, 20

naming 18, 19

R

RAID logs 215

random numbers adapters

designing 173

red, green, refactor (RGR) cycle 75-79

refactor phase 78, 79

regression tests 201

repository 162

repository interfaces 168

designing 169-173

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

DIP, applying 106-109

ISP usage, reviewing 115-117

LSP usage, reviewing 111

OCP, adding to type of 114, 115

shift-left approach 222

Single Responsibility Principle (SRP)

blocks, building 97-104

SOLID principles 37, 97

Sonarqube

URL 203

spike 40, 41

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

writing, with Mockito 133-140

stub objects

usage scenarios 127

stubs and mocks

distinction, blurring between 142

switch-on-type 105

T

team performance

decreasing 12, 13

technical debt 13

test boundaries

defining, with hexagonal architecture 226

test doubles 122

benefits 166

production version of code, creating 124, 125

purpose 122-124

substituting, for external systems 166

used, for replacing adapters 166, 167

using, scenarios 130

test-driven application

integrating 304-306

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

guide 96, 97

limits 200

myths 31-39

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

limitation 219-221

test pyramid 176-178

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

traffic partitioning 193, 194

triangulation 73, 86

two-letter combinations

design, advancing with 85-92

U

UML diagram

for shapes code 98

Unified Modeling Language (UML) 97

unit testing

bigger units 167

user stories 167, 168

unit tests 177-179

advantages 178

Arrange-Act-Assert (AAA) 56

domain model 179

limitations 66, 178

outcomes, working backwards 58

scope, deciding 61

structure, defining 56-58

workflow, increasing 59

untestable code

causes 37, 38

user acceptance tests 177, 184-186

user experience

evaluating 207

user interface (UI) 27, 33

testing 205, 206

user stories 50, 51

reading 51, 52

sections 52

V

value object 64, 131

variable name 19

verify() method 142

W

waterfall development 50

web services

testing 182

when() method 142

WordRepository adapter implementation 276, 277

database, accessing 277-279

GameRepository, implementing 279

Wordz 168

database, designing 173

error condition, testing 145-147

random numbers adapters, designing 173

repository interface, designing 168-173

writing 67-73

Wordz application 48

rules, describing 49

tests, writing 79-85

word, fetching from database 194-197

Wordz game

code, test-driving 298-304

coding 235

domain layer, connecting to 290-293

ending 254

errors, handling 294- 296

failing test, fixing 296-298

failing test, writing 285-287

HTTP server, creating 288

HTTP server routes, adding 289, 290

libraries, adding to project 284

progress, tracking 238-254

score interface, designing 250-252

start game code, refactoring 293

starting 284

test-driving 236, 237

word selection logic, triangulating 244-249

Wordz game, end-of-game detection

correct guess, responding 255, 256

design, reviewing 260-263

maximum number of guesses, triangulating 256, 257

response, triangulating to guess after game over 257-259

Wordz web service application

using, with Postman 306-309

wrong tests

writing 67

Y

you ain’t gonna need it (YAGNI) 71, 250

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.104.250