shell-testing-framework

Shell script testing expertise using bash test framework patterns from unix-goto, covering test structure (arrange-act-assert), 4 test categories, assertion patterns, 100% coverage requirements, and performance testing

By manutej · 394 installs

npx skills add manutej/luxor-claude-marketplace --skill shell-testing-framework

Source repository · Upstream listing

Shell Testing Framework Expert Comprehensive testing expertise for bash shell scripts using patterns and methodologies from the unix goto project, emphasizing 100% test coverage, systematic test organization, and performance validation. When to Use This Skill Use this skill when: Writing test suites for bash shell scripts Implementing 100% test coverage requirements Organizing tests into unit, integration, edge case, and performance categories Creating assertion patterns for shell script validation Setting up test infrastructure and helpers Writing performance tests for shell functions Generating test reports and summaries Debugging test failures Validating shell script behavior Do NOT use this skill for: Testing non shell applications (use language specific frameworks) Simple ad hoc script validation Production testing (use for development/CI only) General QA testing (this is developer focused unit testing) Core Testing Philosophy The 100% Coverage Rule Every core feature in unix goto has 100% test coverage. This is NON NEGOTIABLE. Coverage Requirements: Core navigation: 100% Cache system: 100% Bookmarks: 100% History: 100% Benchmarks: 100% New features: 100% What This Means: Every function has tests Every code path is exercised Every error condition is validated Every edge case is covered Every performance target is verified Test Driven Development Approach Workflow: 1. Write tests FIRST (based on feature spec) 2. Watch tests FAIL (red) 3. Implement feature 4. Watch tests PASS (green) 5. Refactor if needed 6. Validate all tests still pass Core Knowledge Standard Test File Structure Every test file follows this exact structure: The Arrange Act Assert Pattern EVERY test function MUST follow this three phase structure: 1. Arrange Set up test conditions 2. Act Execute the code under test 3. Assert Verify the results Complete Example: The Four Test Categories EVERY feature requires tests in ALL four categories: Category 1: Unit Tests Purpose: Test individual functions in isolation Characteristics: Single function under test Minimal dependencies Fast execution (<1ms per test) Clear, focused assertions Example Cache Lookup Unit Test: Unit Test Checklist: [ ] Test with valid input [ ] Test with invalid input [ ] Test with empty input [ ] Test with boundary values [ ] Test return codes [ ] Test output format Category 2: Integration Tests Purpose: Test how multiple modules work together Characteristics: Multiple functions/modules interact Test realistic workflows Validate end to end behavior Moderate execution time (<100ms per test) Example Navigation Integration Test: Integration Test Checklist: [ ] Test common user workflows [ ] Test module interactions [ ] Test data persistence [ ] Test state changes [ ] Test error propagation [ ] Test cleanup behavior Category 3: Edge Cases Purpose: Test boundary conditions and unusual scenarios Characteristics: Unusual but valid inputs Boundary conditions Error scenarios Race conditions Resource limits Example Edge Case Tests: Edge Case Test Checklist: [ ] Empty inputs [ ] Missing files [ ] Malformed data [ ] Very large inputs [ ] Special characters [ ] Concurrent access [ ] Resource exhaustion [ ] Permission errors Category 4: Performance Tests Purpose: Validate performance targets are met Characteristics: Measure execution time Compare against targets Use statistical analysis Test at scale Example Performance Tests: Performance Test Checklist: [ ] Measure critical path operations [ ] Compare against defined targets [ ] Test at realistic scale [ ] Test with maximum load [ ] Calculate statistics (min/max/mean/median) [ ] Verify no performance regressions Assertion Patterns Basic Assertions String Equality: Exit Code Assertions: Numeric Comparisons: File System Assertions File Existence: File Content Assertions: Output Assertions Contains Pattern: Empty Output: Test Helper Functions Create a reusable test helpers library: Examples Example 1: Complete Cache Test Suite Example 2: Benchmark Test Suite Best Practices Test Organization File Naming Convention: Test Function Naming: Test Independence Each test must be completely independent: Meaningful Failure Messages Test Execution Speed Keep tests FAST: Unit tests: <1ms each Integration tests: <100ms each Edge cases: <10ms each Performance tests: As needed for measurement Total test suite should run in <5 seconds. Quick Reference Test Template Checklist [ ] Shebang and set e [ ] Source required modules [ ] Initialize test counters [ ] Define pass/fail helpers [ ] Organize tests by category [ ] Use arrange act assert pattern [ ] Print summary with exit code Coverage Checklist [ ] All public functions tested [ ] All code paths exercised [ ] All return codes validated [ ] All error conditions tested [ ] All edge cases covered [ ] Performance targets verified Essential Test Commands Skill Version: 1.0 Last Updated: October 2025 Maintained By: Manu Tej + Claude Code Source: unix goto testing patterns and methodologies