# Generating a documentation for tests

**URL:** <https://internals.rust-lang.org/t/generating-a-documentation-for-tests/21442>\
**Category:** documentation\
**Created:** [August 27, 2024, 8:46am UTC](https://internals.rust-lang.org/t/generating-a-documentation-for-tests/21442 "2024-08-27T08:46:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ifxfrancois](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/ifxfrancois/32/12498_2.png) [@ifxfrancois](https://internals.rust-lang.org/u/ifxfrancois)\
**Post date:** [August 27, 2024, 8:46am UTC](https://internals.rust-lang.org/t/generating-a-documentation-for-tests/21442/1 "2024-08-27T08:46:29Z")

</div>

During the development of embedded software, Quality or certifications teams need a quick overview of the tests of a project. Typical relevant information are what, how and why a test tests.

This information can easily be written as markdown in the documentation of a test function but the current rustdoc/cargo doc excludes all modules and functions marked as `#[test]` for the generation of the documentation.

We would like to add a new option to rustdoc/cargo so that the tests are not filtered out during documentation generation. Additionally the test functions would be grouped in a paragraph called "Tests" instead of being added to the "Function" paragraph.

We have a proof of concept in this [repo](https://github.com/Infineon/rust/tree/test_documentation). In this POC in the branch `test_documentation` we added the option `--document-tests` for rustdoc. When this option is set :

- the test modules are not filtered out of the documentation,
- the test functions are gathered in a category called tests.

A limitation in this proof of concept is that integration tests are not added to the produced documentation.

An example project of the documentation can be found at [demo](https://github.com/ifxfrancois/rust_doc_test_demo). The generated doc is located in the usual folder [target/doc](https://ifxfrancois.github.io/rust_doc_test_demo/target/doc/rust_doc_test_demo/index.html).

We would like to have feedback and idea on how to manage the integration tests.

---

<div class="post-metadata">

**Author:** ![steffahn](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/steffahn/32/13288_2.png) [@steffahn](https://internals.rust-lang.org/u/steffahn)\
**Post date:** [February 18, 2026, 8:47am UTC](https://internals.rust-lang.org/t/generating-a-documentation-for-tests/21442/4 "2026-02-18T08:47:10Z")

</div>

Closed on February 18, 2026, 8:47am UTC

This topic was automatically closed 540 days after the last reply. New replies are no longer allowed.
