How to write integration tests

Create a tests directory at your project root and write functions annotated with #[test] that import and verify your library's public API.

Write integration tests by placing test files in a tests directory at the root of your project, where each file is a separate crate that imports your library.

// File: tests/integration_test.rs
use my_library::add;

#[test]
fn test_add() {
    assert_eq!(add(2, 2), 4);
}

Run these tests with cargo test.