Expand description
Intelligent test case generation from parsed Perl code. Test-driven development helpers and generators. Test generator for TDD workflow support
This module provides automatic test generation for Perl code, supporting the red-green-refactor cycle of Test-Driven Development.
§LSP Workflow Integration
Test generation operates within the LSP workflow: Parse → Index → Navigate → Complete → Analyze
- Parse Stage: Analyzes Perl functions/methods to determine test requirements
- Index Stage: Standardizes test patterns and identifies edge cases
- Navigate Stage: Links related test cases and maintains test dependency relationships
- Complete Stage: Generates test code using appropriate test frameworks (Test::More, Test2::V0)
- Analyze Stage: Updates test coverage metrics and integrates with workspace symbols
Essential for maintaining high-quality test coverage in enterprise Perl development systems where reliability and correctness are critical business requirements.
§Usage Examples
ⓘ
use perl_parser::test_generator::{TestGenerator, TestFramework};
use perl_parser::{Parser, ast::Node};
let mut parser = Parser::new("sub add { my ($a, $b) = @_; return $a + $b; }");
let ast = parser.parse()?;
let generator = TestGenerator::new(TestFramework::TestMore);
let test_cases = generator.generate_tests(&ast, "sub add { my ($a, $b) = @_; return $a + $b; }");
println!("Generated {} test cases", test_cases.len());Structs§
- Coverage
Report - Code coverage metrics from test execution
- Refactoring
Suggester - Refactoring suggestions for the green-to-refactor phase
- Refactoring
Suggestion - A specific refactoring suggestion with context and actions
- Test
Case - Generated test case
- Test
Generator - Test generator for creating unit tests from code
- Test
Generator Options - Configuration options for test generation
- Test
Results - Results from executing a test suite
- Test
Runner - Test runner integration for executing Perl tests
Enums§
- Priority
- Priority level for refactoring suggestions
- Refactoring
Category - Categories of refactoring suggestions
- Test
Framework - Supported Perl test frameworks