# Software testing

> Checking that software does what it should, mostly with code that tests other code.

- Level: Intermediate
- Topics: Software
- URL: https://tidbit.legios.com.ar/software-testing/
- In Spanish: [Testing de software](https://tidbit.legios.com.ar/es/software-testing/)

**Software testing** is everything done to find out whether a program works before its users do. Some of it is manual: a person clicks through the app looking for problems. Most of it, in modern teams, is **automated tests**: small programs that call the real code with known inputs and check the result. A test might say: "`total([10, 5])` must return `15`". If someone later breaks that, the test fails and tells them.

Tests come in layers. **Unit tests** check one small piece, like a single function, in milliseconds. **Integration tests** check that pieces work together, for example the code and a real database. **End-to-end tests** drive the whole app like a user would, opening a browser and clicking buttons; they are the most realistic but also the slowest and most fragile. The usual advice, called the **test pyramid**, is many unit tests, fewer integration tests and a handful of end-to-end ones.

The main value is confidence to change things. A good **test suite** runs automatically on every change in the CI pipeline, catching **regressions**, old features broken by new code, within minutes. Tests are not proof of correctness, though: they only check the cases someone thought of. As the computer scientist Edsger Dijkstra put it, testing can show the presence of bugs, never their absence.

## An analogy

Like a pilot's pre-flight checklist. It does not guarantee a perfect flight, but it reliably catches the known ways things go wrong, every single time, without depending on anyone's memory.

## Keep in mind

- Automated tests are code that runs your code and checks the results.
- Unit, integration and end-to-end tests trade speed for realism.
- They run on every change, so broken features are caught early.
- Passing tests mean the checked cases work, not that there are no bugs.

## Go deeper

- [The Practical Test Pyramid (martinfowler.com)](https://martinfowler.com/articles/practical-test-pyramid.html)
- [Software testing on Wikipedia](https://en.wikipedia.org/wiki/Software_testing)

## Related terms

- [Database](https://tidbit.legios.com.ar/database/): An organized store of data that programs can search and update safely.
- [Web browser](https://tidbit.legios.com.ar/web-browser/): The app that fetches web pages from the internet and draws them on your screen.
- [CI/CD](https://tidbit.legios.com.ar/ci-cd/): Automation that builds, tests and ships every code change, so releases become routine.
- [Bug](https://tidbit.legios.com.ar/bug/): A mistake in software that makes it behave differently from what was intended.
