SourceTrait Common Testing
Structured testing with setup, teardown, and standardized fixture and temp directories
Features
- Structure tests into inheritable heirarchies: Module -> Test
- Bundle common assets outside of heirarchies using Group
- Setup and teardown callbacks for each Module, Test, and Group
- Module and Group setup occurs before Test
- Categorize based on use-case: Unit and Integration
- Standardized paths for fixture and temp directories
- Miscellaneous helper functions for common tasks
Restrictions
- One Module per Rust test module
- One Test per Rust test function
- Module and Group are static to a Rust module
- Test is instantiated non-static inside of the Rust test function
- Unit tests live in
src - Integration tests live in
testsorexample - Fixture asset files live in
testing
Standard paths
use-case / module_path / function_name
Example
// Just something to test against
const FIBONACCI_MAX_N_U128: u8 = 185;
// Testing namepaths will strip '::tests' out.
Documentation
Refer to docs.rs/sourcetrait_testing
Repository
Contributors, please review SOURCETRAIT.md.
Found a bug? Search for an existing issue on GitHub.
If an issue exists, chime in to add weight to it.
If not, create one and let us know.
License (AGPL3)
SourceTrait Common Testing: Structured testing in sequence with fixture and temp directories
Developed by SourceTrait
Copyright (C) 2025 Asmov LLC
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.
Linking Exception (Section 7)
An additional linking permission is granted under GNU Affero GPL version 3, section 7.
If you modify this Program, or any covered work, by linking or combining it with this Library (or a modified version of that library), containing parts covered by the terms of the AGPL3 license, the licensors of this Library grant you additional permission to convey the resulting work.
Corresponding Source for a non-source form of such a combination shall include the source code for the parts of this Library used as well as that of the covered work.
Third-Party Licenses
crate: function_name
Our library publically exports the named macro from Daniel Henry-Mantilla's crate: function_name. It is available for use from our crate as
sourcetrait_testing::named.
License (MIT):
Copyright (c) 2019 Daniel Henry-Mantilla