# Zig Level 9: Testing & Debugging

> Level 9: Testing & Debugging of the LoWisa Zig course: Built-In Testing, Debugging Native Programs, Safety Modes. 3 lessons and 9 ideas, each explained in one line.

Testing & Debugging is level 9 of 11 of the [LoWisa Zig course](/courses/zig/). It has 3 lessons and 9 ideas. Below is every lesson and what it teaches, in one line each.

## Built-In Testing

- **test blocks.** Tests are **test** blocks in the source file: zig build test running them all.
- **std.testing.** **std.testing** asserts equality and errors: with the testing allocator watching memory.
- **Doctests by proximity.** Tests beside the code they pin: the **file** is implementation, contract and proof together.

## Debugging Native Programs

- **Debug builds.** Debug builds keep **safety** checks on: bounds, overflow, unreachable: crashes at the true line.
- **Stack traces.** Panics print full **traces**: including error return traces on failure paths.
- **Debuggers.** Native **debuggers** work as on C: breakpoints, memory views, the systems toolkit intact.

## Safety Modes

- **Release modes.** Zig ships modes: Debug, ReleaseSafe, ReleaseFast, ReleaseSmall: **safety** chosen per build.
- **ReleaseSafe honestly.** **ReleaseSafe** keeps checks in production: the default worth defending until profiles argue.
- **undefined behaviour named.** Zig names its UB and checks it in safe modes: **unreachable** is a promise, tested.

## Before and after this level

- **Before:** [Level 8: C Interoperability](/courses/zig/level-8-c-interoperability/): Calling C, Exporting Zig, Replacing or Extending C Components.
- **Next:** [Level 10: Performance](/courses/zig/level-10-performance/): Memory Layout, Profiling, Systems-Level Optimisation.

In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See [Checkpoints and flashcards](/help/checkpoints-and-flashcards/).

## Frequently asked questions

### What does Zig Level 9: Testing & Debugging cover?

Built-In Testing, Debugging Native Programs, Safety Modes: 3 lessons and 9 ideas.

### What should I know before this level?

The level before it, Level 8: C Interoperability, which covers Calling C, Exporting Zig, Replacing or Extending C Components.

## Learn Zig on your phone

The first level is free. LoWisa is on Google Play and the App Store.

---

Source: https://lowisa.dev/courses/zig/level-9-testing-and-debugging/ · Updated 2026-11-25
