0Pricing
Learn Rust Coding · Lesson

Integration Tests

The tests directory.

What Are Integration Tests?

Integration tests verify your crate's public API the way an external user would. They live outside src and can only call public items.

The tests Directory

Cargo treats every file in the top-level tests/ directory as a separate test crate. No #[cfg(test)] module is needed there.

  • tests/api.rs
  • tests/parsing.rs

All lessons in this course

  1. Unit Tests
  2. Integration Tests
  3. Doc Comments
  4. Doc Tests
← Back to Learn Rust Coding