Donate
Back to Software Engineering Career Track
Sign in to save your progress and earn a certificate.

Module 7: Testing & Debugging

Learning Objectives
  • Write a basic unit test for a function
  • Use a debugger to step through code and inspect variables
  • Apply a systematic process for isolating a bug's root cause

A unit test checks that one small piece of code, usually a single function, behaves correctly given a known input, and automated tests let a team change code confidently because any broken behavior is caught immediately rather than discovered by a user in production. You will learn to write simple tests that assert an expected output matches the actual output, and the basics of a debugger: a tool that lets you pause code mid-execution and inspect the exact value of every variable at that moment, which is almost always faster than scattering print statements everywhere. You will also learn a systematic debugging process: reproduce the bug reliably, isolate the smallest case that still shows it, form a hypothesis about the cause, and test that hypothesis directly, rather than guessing randomly.

Module Quiz

1. The main advantage of using a debugger over scattering print statements through code is:

2. A unit test is best described as:

3. The first step in a systematic debugging process should usually be to: