Amy Blankenship
1 min readDec 20, 2023

--

This is neat, but has nothing to do with TDD.

Your problem is you're considering the launched web page with the intact feature as a "unit." A unit would be your endpoint. You'd hit your write endpoint with a given payload and expect to see the payload reflected in the DB (or not, if it should be rejected for bad payload). You'd have certain data in the table and expect your read endpoint to retrieve the records that match the criteria. Etc. Then, on the View side, you'd pass in some data and expect to see certain UI elements. You'd click certain UI elements and expect to have certain methods called. For a slightly larger unit you might want to check the API call was made (and fake the response). Because your units are smaller, you can literally test every path and also some paths that it's difficult or impossible to create the data for in the DB. Yes, it's still possible to have problems in the integration, but these usually surface easily through manual testing/

--

--

Amy Blankenship
Amy Blankenship

Written by Amy Blankenship

Full Stack developer at fintech company. I mainly write about React, Javascript, Typescript, and testing.

No responses yet