Please enable JavaScript to use CodeHS

Testing, QA, and CI

What is software testing?

Testing is the process of checking that software does what it is supposed to do — and does not do what it should not. It is how teams catch mistakes, build confidence, and ship code that works.

Testing ~10 min High School / College Prep
The Big Idea

Why test?

Every piece of software has hidden assumptions. A sign-up form might accept an email without an @. A shopping cart might charge twice. A game might crash when the score reaches exactly 1000. These mistakes are called bugs, and testing is the main way we find them before users do.

Testing is not about proving a program is perfect. It is about building confidence. A well-tested program gives you evidence that the important parts work, and it tells you quickly when something breaks.

The earlier you find a bug, the cheaper it is to fix. A bug caught while you are still typing costs almost nothing. A bug caught by a customer costs reputation, time, and money. That is why testing is a habit, not an afterthought.

Approaches

Manual vs automated testing

Manual testing means a person uses the software the way a user would: clicking buttons, typing inputs, and looking for problems. It is great for finding visual issues, confusing wording, and weird edge cases a script might miss.

Automated testing means writing code that checks the software for you. Once written, an automated test can run hundreds of times a day, every time the code changes. It is fast, repeatable, and never forgets to check something.

Key idea: Both matter. Manual testing is exploratory and human. Automated testing is precise and repeatable. Strong teams use both.

Frameworks

The test pyramid

The test pyramid is a way to think about how many tests of each type you should write. The bottom is wide, the top is narrow.

Hover over a layer to learn about it.

The pyramid tells you to write many small, fast tests and a few big, slow tests. If you flip the pyramid and only write end-to-end tests, your test suite becomes slow and fragile. If you only write unit tests, you might miss problems that only appear when parts connect.

Habits

A testing mindset

Good testers think like detectives. They ask questions like:

  • What is the normal case?
  • What could a user type that is unexpected?
  • What happens at the boundaries, like an empty list or a score of zero?
  • What happens when two things happen at the same time?

Testing is not only the job of a dedicated QA team. Developers write tests for their own code, designers test usability, and product managers test that features match requirements. Everyone owns quality.

Interactive

Pick the right test

For each scenario, decide which layer of the test pyramid is the best fit.

1. A function that calculates sales tax

You want to make sure it returns the right amount for different prices and tax rates.

2. Login flow

You want to check that the form, the user database, and the session cookie work together.

3. Buying a gift card on the website

You want to verify a real user can search, add to cart, pay, and receive a confirmation email.

Check Yourself

Quick quiz

1. What is the main purpose of software testing?

2. Where does the test pyramid have the most tests?

3. Which is a strength of automated testing?

Keep learning

You now understand the purpose of testing and the test pyramid. Next, zoom in on the most common kind of test: the unit test.

Part of the “Testing, QA, and CI” series.