Expand description
§AutoTest
A Rust library and CLI tool for automatically generating test stubs for Rust projects.
This crate provides both a command-line interface and a programmatic API for analyzing Rust source code and generating meaningful test templates. It uses AST-based analysis to understand function signatures, parameters, and return types, then generates integration tests with appropriate assertions.
§Quick Start
use auto_test::generate_tests_for_project;
// Generate tests for the current directory
generate_tests_for_project(".")?;§Architecture
The library is organized into several modules:
core: Core analysis and generation logic (seecoremodule)utils: Utility functions for file I/O and filesystem operationsconfig: Configuration management (seeconfigmodule)error: Error types and handling (seeerrormodule)
§Features
- AST-based Analysis: Uses
synto parse Rust source code accurately - Type-aware Generation: Different parameter generation and assertions based on types
- Integration Tests: Generates tests that call your public API
- Modular Organization: Creates separate test files per module
- CLI Tool: Includes a command-line interface for easy usage
- Configuration System: User-configurable behavior via config files
- Error Handling: Comprehensive error propagation with helpful messages
- Progress Indicators: Provides feedback during long operations
- Parallel Processing: Fast generation on large codebases
- Git Integration: Respects .gitignore and skips irrelevant files
§Limitations
- Currently only analyzes public functions (by design)
- TypeScript support is planned but not yet implemented
- Complex custom types fall back to
Default::default()
See the README for more information.
Modules§
Functions§
- generate_
tests_ for_ project - Generate test files for a Rust project with default configuration.
- generate_
tests_ for_ project_ with_ config - Generate test files for a Rust project with custom configuration.