~/talk

Dirty Tests And How To Clean Them

Talkat JCON-ONLINE 2021 · 2021-10-05..10-08· [testing, developer-experience]
slides:none on file

Java Spring REST API calculator tests start as ~100 lines of duplicated JUnit5 code using RestTemplate and a controller POST to localhost and shrink to a focused suite (~27 tests) by applying extract fields to setup and extract method for HTTP calls, renaming tests to state intent, replacing literals with meaningful constants, introducing a builder for test data, and moving boilerplate into an ApiCallWrapper. The result reads like documentation, isolates failures faster in CI, and produces reusable, less fragile tests.

AI-written summary · about

  1. 0:00Start
  2. 6:50What Is Easy To Maintain
  3. 15:34What Clean Tests Are
  4. 16:11Test Show Intent
  5. 24:43Embedded Constants
  6. 25:38Example of Api Tests with Spring
  7. 36:39The Calculator
  8. 46:30Using Constructors over Builders
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.