Integration or black box tests

The test/directory contains all the integration tests. These are tests that combine the usage of several larger pieces of code together. These tests are compiled as if they were separate crates. Crate is Rust's naming for external libraries, and the whole module system will be covered in the next chapter. The only thing we care about right now is that for an integration test, we need to specify all the crates we are using, even our program's own crate (which is sum in the next example).

In this example, I have created a project, sum, with the same contents in the library as in the previous unit test, and added this integration test:

sum-with-doctest/tests/sum.rsextern crate sum; #[test] fn test_sum_integration() ...

Get Mastering Rust now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.