TDD (Test-Driven Development)
intermediateDefinition
A backwards-feeling habit: write the test first, then write just enough code to make the test pass, then clean up. The discipline forces you to think about how your code should behave before you start writing it, which often produces simpler designs and fewer surprises later.
In the wild
A developer is about to write a function that turns a name like 'Hello World' into 'hello-world' for a URL. Before writing the function, she writes a test that says 'I expect hello-world to come out.' She then writes the smallest function that makes the test pass. And only then thinks about whether to clean it up.
More from Testing & Quality
Assertion
A statement inside a test that says 'I expect this to be true.' If the expectation is wrong, the test fails and tells you exactly what didn't match. Assertions are how a test actually checks that the code is doing what it's supposed to.
End-to-End (E2E) Test
A test that drives the whole app from the outside, just like a real person would: clicking buttons, filling out forms, going from one page to the next. It's the most realistic kind of test (it catches problems no other test would), but also the slowest and the most easily upset by little changes.
Fixture
A pre-prepared piece of fake data that tests can rely on: like a sample user, a stock list of products, or a saved response. Using the same fixture across many tests keeps them tidy and consistent, instead of every test inventing its own slightly different sample.
Flaky Test
A test that sometimes passes and sometimes fails for no clear reason: usually because it depends on something it shouldn't, like the time of day, the order other tests ran in, or how fast the network is responding. Flaky tests slowly destroy the team's trust in the whole test suite.
Integration Test
A test that checks whether several pieces of an app work correctly when they're put together: talking to a real database, hitting a real internal service, the way they would in real life. It catches the kinds of bugs that only show up when separate pieces have to cooperate.
Linting
Automatic proofreading for code. A linter scans through the source files and flags stylistic mistakes, suspicious patterns, and likely bugs: without actually running the code. It catches the small problems early, before they reach reviewers or tests.