2 Commits

Author SHA1 Message Date
Misaka
2cb22df60c feat: VBA Call Chain Tracking and Full Project Testing System
## Phase 1: Core Call Chain Tracking

### New Features
- CallStack class module: Manually maintain VBA call stack
- Enhanced TestLogger: Integrated call stack management
  - LogEntry: Record on procedure entry
  - LogExit: Pop on procedure exit
  - LogError: Capture complete call chain
- Weave all procedures in module to support call chain tracking

### Data Model Updates
- TestResult new fields: error_module, call_chain
- Result format: ERROR|Module.Proc|Line|Number|Desc|CallChain

### Key Fixes
- Fixed LogSuccess overwriting error state
  LogSuccess now only sets success when no error exists
- Fixed incomplete call chain due to weaving only single procedure
  Now weaves all procedures in the entire module

## Phase 2: Full Project Testing

### New Methods
- CodeWeaver.parse_modules: Parse all VBA modules
- CodeWeaver.weave_module_all_procedures: Weave all procedures in single module
- CodeWeaver.weave_all_modules: Weave all procedures in multiple modules
- TestRunner.discover_all_tests: Auto-discover all entry points
- TestRunner.run_all_tests: Batch execute all tests
- TestRunner._weave_all_modules_inplace: In-place weave all modules

### CLI Interface
- Mode 1: python vba_test_runner.py <file> --all (full project testing)
- Mode 2: python vba_test_runner.py <file> <module> <proc>... (specific testing)

## Test Verification

### Call Chain Tracking Example
TestSuccessfulProcedure -> TestErrorProcedure -> TestTypeMismatch
Output:
  Call Chain: Module1.TestSuccessfulProcedure -> Module1.TestErrorProcedure -> Module1.TestTypeMismatch
  Location: Module1.TestTypeMismatch:20
  Source: y = 20

### Statistics
- New code: ~500 lines
- New methods: 8
- Test scenarios: Multi-level nested call chain verification passed

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-04 22:44:49 +08:00
Misaka_Company
7a86a88fc4 feat: VBA Automated Testing and Precise Error Reporting System
Implement a comprehensive VBA testing framework that provides precise
line-by-line error reporting through code weaving technology.

Core Features:
- CodeWeaver: Injects line number labels and error handling into VBA code
- LoggerInjector: Manages TestLogger module for capturing test results
- TestRunner: Orchestrates Excel lifecycle and test execution
- Command-line interface supporting single and batch testing

Key Capabilities:
- Captures exact line numbers where errors occur
- Displays source code context for error locations
- Non-invasive testing (original files unchanged)
- Batch testing support with detailed summaries

Components:
- vba_test_runner.py: Main framework implementation
- demo.xlsm: Demo Excel file with test procedures
- create_demo.py: Script to generate demo files
- check_vba_access.py: VBA access permission checker

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-04 16:28:17 +08:00