Ferris, the Rust mascotRustacean

Home

❯

mocs

❯

Testing & Documentation

Testing & Documentation

Jun 21, 20261 min read

  • rust
  • testing
  • documentation
  • moc

Testing & Documentation

Testing and documentation in Rust form an executable feedback loop: tests protect behavior, rustdoc explains public APIs, and doctests keep examples honest.

Concepts

  • Test Functions
  • Assertion Macros in Tests
  • Unit Tests
  • Integration Tests
  • Test Harness and cargo test
  • Ignored Tests
  • Documentation Comments
  • Documentation Tests
  • Doctest Attributes
  • Intra-doc Links
  • rustdoc

Patterns

  • Test Organization
  • Result Returning Tests
  • Testable Documentation Examples
  • Test-Driven Development in Rust
  • Snapshot Testing

Antipatterns

  • Broad should_panic Tests
  • Shared State Between Parallel Tests
  • Untested Documentation Examples

See also

Testing & Documentation · Cargo & Dependencies · Modules & Project Structure · Error Handling · Publishing to crates.io · Documentation Comments · Test Functions

Sources

  • The Rust Programming Language, ch. 11 “Writing Automated Tests” — the-book, https://doc.rust-lang.org/book/ch11-00-testing.html
  • The Rust Programming Language, ch. 14.2 “Publishing a Crate to Crates.io” — the-book, https://doc.rust-lang.org/book/ch14-02-publishing-to-crates-io.html
  • The rustdoc book — rustdoc-book, https://doc.rust-lang.org/rustdoc/
  • The Rust Reference, “Testing attributes” — the-reference, https://doc.rust-lang.org/reference/attributes/testing.html

Graph View

  • Testing & Documentation
  • Concepts
  • Patterns
  • Antipatterns
  • See also
  • Sources

Backlinks

  • Rust Brain Home
  • Broad should_panic Tests
  • Shared State Between Parallel Tests
  • Untested Documentation Examples
  • Assertion Macros in Tests
  • Doctest Attributes
  • Documentation Tests
  • Ignored Tests
  • Integration Tests
  • Intra-doc Links
  • Test Functions
  • Test Harness and cargo test
  • Unit Tests
  • rustdoc
  • index
  • Ecosystem & Crate Playbooks
  • Testing & Documentation
  • Result Returning Tests
  • Snapshot Testing
  • Test Organization
  • Test-Driven Development in Rust
  • Testable Documentation Examples

Created with Quartz v4.5.2 © 2026

  • GitHub
  • Download (.zip)
  • Latest release