Unit Test
beginnerDefinition
A small, fast test that checks one tiny piece of an app on its own, a single calculation, one rule, one function, without any of the surrounding parts. Unit tests are quick to run and form the bulk of most teams' testing because they catch problems instantly.
In the wild
A developer writes a small function that calculates the discount price after a coupon is applied. He writes a unit test that says 'a $50 item with a 10% off coupon should cost $45.' The test runs in a fraction of a second. And any future change that breaks that math will be caught immediately.
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.