cli_testing_specialist/generator/
mod.rs

1//! # Generator Module
2//!
3//! Generates comprehensive BATS (Bash Automated Testing System) test suites from CLI analysis.
4//!
5//! ## Test Categories
6//!
7//! The generator produces tests across 9 categories:
8//!
9//! - **Basic**: Help, version, exit codes
10//! - **Help**: Help text validation and formatting
11//! - **Security**: Injection attacks, path traversal, command injection
12//! - **Path**: File/directory handling, special characters
13//! - **InputValidation**: Invalid inputs, boundary conditions
14//! - **DestructiveOps**: Operations requiring confirmation
15//! - **DirectoryTraversal**: Path traversal prevention
16//! - **Performance**: Response time validation
17//! - **MultiShell**: Cross-shell compatibility (bash, zsh, fish)
18//!
19//! ## Example Usage
20//!
21//! ```no_run
22//! use cli_testing_specialist::analyzer::CliParser;
23//! use cli_testing_specialist::generator::TestGenerator;
24//! use cli_testing_specialist::types::TestCategory;
25//! use std::path::Path;
26//!
27//! let parser = CliParser::new();
28//! let analysis = parser.analyze(Path::new("/usr/bin/curl"))?;
29//!
30//! let generator = TestGenerator::new(
31//!     analysis,
32//!     vec![TestCategory::Basic, TestCategory::Security]
33//! );
34//! let tests = generator.generate()?;
35//!
36//! println!("Generated {} tests", tests.len());
37//! # Ok::<(), cli_testing_specialist::error::CliTestError>(())
38//! ```
39//!
40//! ## Performance
41//!
42//! - **Sequential**: 50-100ms for 50 tests
43//! - **Parallel**: 20-40ms for 50 tests (2-3x faster)
44//!
45//! ## Template System
46//!
47//! Uses embedded templates with variable substitution:
48//! - `{{binary_name}}`: Target CLI tool name
49//! - `{{command}}`: Test command to execute
50//! - `{{expected_output}}`: Expected output pattern
51//!
52//! Templates are validated at compile time for correctness.
53
54pub mod assert_cmd_generator;
55pub mod bats_writer;
56pub mod templates;
57pub mod test_generator;
58pub mod test_generator_trait;
59mod test_level_parallel;
60
61// Re-export commonly used types
62pub use assert_cmd_generator::AssertCmdGenerator;
63pub use bats_writer::BatsWriter;
64pub use templates::TemplateEngine;
65pub use test_generator::TestGenerator;
66pub use test_generator_trait::TestGenerator as TestGeneratorTrait;
67// test_level_parallel module contains helper functions for future use
68// Currently used directly in test_generator.rs via rayon::par_iter()