Please enable JavaScript to use CodeHS

Testing, QA, and CI

Continuous integration

Continuous integration means merging small changes into the main branch often and running tests automatically. The goal is to find problems quickly and keep the shared codebase in a working state.

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

What is continuous integration?

Imagine a group project where everyone works on their own copy of a document for weeks and then tries to combine them the night before the deadline. The merge is messy, full of conflicts, and nobody is sure what changed. That is what software development can feel like without continuous integration.

Continuous integration (CI) is the practice of merging small changes into the shared main branch frequently — often many times a day. Each merge triggers an automated pipeline that builds the project and runs the test suite. If something breaks, the team knows immediately.

CI does not require a specific tool. It is a workflow: integrate early, test automatically, and fix problems while they are still small.

Workflows

Small, frequent merges

Long-lived branches are risky. The longer a branch lives, the more it diverges from main, and the harder it becomes to merge. Small changes reduce that risk. They are easier to review, easier to test, and easier to roll back if something goes wrong.

The mantra is: “If it hurts, do it more often.” Merging hurts when it is rare. When it is frequent and automated, it becomes routine.

Stages

The CI pipeline

A CI pipeline is a sequence of automated stages. A common pipeline looks like this:

📝

Build

Compile or bundle the code

🔬

Unit tests

Run fast, focused tests

🔗

Integration tests

Check connected parts

🚀

Deploy

Ship to staging or production

Each stage must pass before the next one runs. If unit tests fail, the integration tests do not run, and the broken change is blocked until someone fixes it. This is called failing fast.

Culture

Keep main green

A green main branch means the latest shared code builds and passes all tests. Teams try hard to keep it green because everyone else depends on it. If the main branch is broken, everyone else's work stops until it is fixed.

“Red” means something failed. The team’s first priority is usually to fix the red build before adding more changes. This shared responsibility keeps quality high and prevents small bugs from piling up.

Key idea: CI is not only a machine process. It is a team habit: commit small changes, watch the results, and fix failures quickly.

Interactive

Simulate a CI run

Four commits arrive in order. Some pass tests, one fails. Click Run CI to see how the pipeline stops at the first failure and keeps main safe.

$ ci ready waiting for commits...
Check Yourself

Quick quiz

1. What is the main goal of continuous integration?

2. What does “failing fast” mean in a CI pipeline?

3. Why is it better to merge small changes often?

Keep learning

CI keeps tests running, but people still make quality happen. Next, learn about the broader practice of quality assurance.

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