Add unit tests to all workspace packages in the Torrust Tracker.
After the refactoring packages and the extraction of many new packages, which can be found here, we now have a better structure.
While we have good test coverage due to a robust E2E test suite, writing unit tests for individual packages is critical as we publish these new crates.
Objective
Our goal is to review and enhance the unit test coverage for all packages, focusing on critical features to ensure robustness and reliability. Given the recent overhaul of the tracker core, writing unit tests for these packages should be much easier.
This is a great opportunity for newcomers to dive into the Torrust Tracker project, learning about BitTorrent, Rust, and our core architecture.
How to Proceed
-
Sub-Issue Creation:
- Open a new sub-issue for each package. I'll start by creating some with additional comments or suggestions.
- Write down in the issue the initial code coverage for the package.
-
Test Existing Structures:
- Refer to the tracker-core package as it already has good test coverage.
-
Expand Tests:
- Whenever possible, add integration tests or examples. For server packages (
*-server), consider creating examples such as running a program with a single HTTP tracker.
You can generate the coverage report for a package with:
cargo llvm-cov --package bittorrent-tracker-core
cargo llvm-cov --package PACKAGE_NAME (the name in the `Config.toml` file).
Best Practices
Inspiration
If you are looking for some examples. Here you have some issues related to adding tests to the tracker core package:
NOTICE: not all sub-issues have been opened. Feel free to open new issues for other packages.
cc @da2ce7 @mario-nt
Add unit tests to all workspace packages in the Torrust Tracker.
After the refactoring packages and the extraction of many new packages, which can be found here, we now have a better structure.
While we have good test coverage due to a robust E2E test suite, writing unit tests for individual packages is critical as we publish these new crates.
Objective
Our goal is to review and enhance the unit test coverage for all packages, focusing on critical features to ensure robustness and reliability. Given the recent overhaul of the tracker core, writing unit tests for these packages should be much easier.
This is a great opportunity for newcomers to dive into the Torrust Tracker project, learning about BitTorrent, Rust, and our core architecture.
How to Proceed
Sub-Issue Creation:
Test Existing Structures:
Expand Tests:
*-server), consider creating examples such as running a program with a single HTTP tracker.You can generate the coverage report for a package with:
Best Practices
Group Tests by Responsibilities:
Test Maintenance:
Readable Test Outputs:
Simplicity with AAA:
Share Your Innovations:
Manageable Workloads:
Tools for Assistance:
Optimized IDE Usage:
Inspiration
If you are looking for some examples. Here you have some issues related to adding tests to the tracker core package:
tracker-corepackage #1226NOTICE: not all sub-issues have been opened. Feel free to open new issues for other packages.
cc @da2ce7 @mario-nt