---
title: "Chapter 14: Testing"
description: "The 7 lessons of chapter 14: Testing, in teaching order."
url: "https://learnrust.net/chapter-14/"
last_updated: "2026-06-13"
---

# Chapter 14: Testing

- [14.1 Introduction to testing](https://learnrust.net/chapter-14/introduction-to-testing.md): Why automated tests matter, what makes a good test, and why Rust treats testing as a built-in habit rather than an external add-on.
- [14.2 Writing tests](https://learnrust.net/chapter-14/writing-tests.md): The #[test] attribute, the assert! family, assert_eq! and assert_ne!, testing for panics with #[should_panic], and tests that return Result.
- [14.3 Organizing unit tests](https://learnrust.net/chapter-14/organizing-unit-tests.md): The conventional #[cfg(test)] mod tests pattern, why tests live next to the code they test, and how unit tests can reach a module's private functions.
- [14.4 Integration tests](https://learnrust.net/chapter-14/integration-tests.md): Integration tests live in the tests/ directory, see only a crate's public API, and exercise it the way a real user would: the lib.rs split paying off.
- [14.5 Doc tests](https://learnrust.net/chapter-14/doc-tests.md): The examples in your /// doc comments compile and run as tests, so documentation can't drift out of sync with the code: how to write them and what they catch.
- [14.6 Running tests](https://learnrust.net/chapter-14/running-tests.md): Controlling cargo test: filtering by name, seeing println output, ignoring slow tests with #[ignore], and why tests run in parallel by default.
- [14.x Chapter 14 summary and quiz](https://learnrust.net/chapter-14/chapter-14-summary-and-quiz.md): Review of writing and organizing tests, integration and doc tests, and running tests, with a chapter quiz and a test-writing exercise.

## Sitemap

See the full [sitemap](https://learnrust.net/sitemap.md) for all pages.
