1# Testing
2
3The `virtio-queue` crate is tested using:
4- unit tests - defined in their corresponding modules,
5- performance tests - defined in the [benches](../benches) directory. For now,
6  the benchmarks are not run as part of the CI, but they can be run locally.
7
8The crate provides a mocking framework for the driver side of a virtio queue,
9in the [mock](../src/mock.rs) module.
10This module is compiled only when using the `test-utils` feature. To run all
11the unit tests (which include the documentation examples), and the performance
12tests in this crate, you need to specify the `test-utils` feature, otherwise
13the build fails.
14
15```bash
16cargo test --features test-utils
17cargo bench --features test-utils
18cargo test --doc --features test-utils
19```
20
21The mocking framework and the helpers it provides can be used in other crates
22as well in order to test, for example, a specific device implementation. To be
23able to use these test utilities, add the following to your `Cargo.toml` in the
24`[dev-dependencies]` section:
25
26```toml
27[dev-dependencies]
28virtio-queue = { version = "0.1.0", features = ["test-utils"] }
29```
30