🧪Testing & Quality
Making sure code actually works · 44 terms
Test Basics
9What a test is made of, and the tool that runs them.
Checking that code does what it should, before real people use it.
One check in a test. It has a set input and a result you expect.
A line in a test that says what must be true, or the test fails.
A bunch of test cases you run at once, often for the whole app.
The tool that finds your tests, runs them and shows how many passed.
Tests written as code. A computer runs them on every change.
A person using the app by hand to check that it works.
The setup a test starts from. It might be a sample user or a cart.
A test in three steps. Set it up, run it, then check the result.
Test Types
10Kinds of test, from one small function to the whole app under a crowd.
A test that checks one small piece of code, like a function, by itself.
A test that checks a few parts work as a team, like code and its data.
A test that acts like a user. It clicks through the whole app.
A quick check that the main parts of an app work at all.
A test that checks old features still work after you change the code.
A test that saves some output once, then fails if it ever changes.
Tests that check how fast and steady an app is under use.
A test that sends many fake users at an app to see how it copes.
A test that checks a feature does what was asked for.
Real users try the app before release and sign it off.
Test Doubles
5Stand-ins that take the place of a real part while a test runs.
A stand-in that takes the place of a real part during a test.
A fake part that records how your code called it, so a test can check.
A fake part that always gives the answer you chose, so tests stay the same.
A small copy of a real part. It works, but only in tests.
A wrapper that watches a real function and notes each call to it.
Test Practices
8Habits and measures that decide how much a test suite can be trusted.
Write a test that fails first. Then write just enough code to pass.
How much of your code your tests really run, as a percent.
A test that passes on one run and fails the next, with no code change.
Many small unit tests at the base. Only a few big end-to-end tests at the top.
Testing what a program does. You do not look at its code.
Testing a program while you read its code. Each path gets a test.
Writing features as Given, When, Then lines. The lines also run as tests.
A note that tells the team what broke and how to make it happen again.
Test Frameworks
8Popular tools for writing tests in JavaScript, Python and the browser.
A test tool for JavaScript. It finds your tests and runs them.
A fast JavaScript test tool built on Vite, with an API much like Jest.
The best-known test tool for Python. It finds and runs your tests.
A tool that drives a real browser from code, to test a site like a user.
A JavaScript tool that tests web apps in a real browser. You see each step.
Tools that drive web browsers from code, in many languages.
A common tool for writing tests for Java code. It also runs them.
Tools that test screens the way a person uses them, by labels and text.
Code Quality
4Keeping code easy to read and change, and the signs that it is not.
A change to how code is written. What it does stays the same.
A hint that code has a deeper problem, even though it works.
The cost you pay later for a quick fix you pick today.
Checking code for mistakes just by reading it. It is never run.