A comprehensive, automated quality assurance testing tool for the tree CLI application. This Rust-based tool replaces the previous bash-based QA system with better reliability, debugging capabilities, and cross-platform support.
The QA tool performs comprehensive testing of the tree CLI across multiple platforms using Docker containers. It validates all major features including directory traversal, file filtering, display options, sorting, and error handling.
cd tools/qa
cargo build --release
# Run tests on all platforms (Linux and Alpine)
./target/release/qa test
# Run tests on specific platforms
./target/release/qa test --platforms linux
./target/release/qa test --platforms linux,alpine
# Run with verbose output
./target/release/qa test --platforms linux --verbose
# Run all platforms explicitly
./target/release/qa test --all
# Clean up Docker resources
./target/release/qa clean
# Force cleanup without confirmation
./target/release/qa clean --force
qa test [OPTIONS]
Options:
--platforms <PLATFORMS>
: Comma-separated list of platforms (linux, alpine, windows)--all
: Run tests on all supported platforms--verbose
: Show detailed test output and container logsExamples:
# Test single platform
qa test --platforms linux
# Test multiple platforms
qa test --platforms linux,alpine
# Test all platforms with verbose output
qa test --all --verbose
qa clean [OPTIONS]
Options:
--force
: Skip confirmation promptExamples:
# Interactive cleanup
qa clean
# Force cleanup
qa clean --force
The QA tool executes tests organized into 9 main categories:
--help
)--version
)-L
, --level
)-i
)-f
)-A
)-a
)-d
)-P
)-I
)--filelimit
)-s
, -H
)-C
, -n
)-F
)-p
)-D
)-t
)-r
)--dirsfirst
)--noreport
)-o
)--fromfile
)Each test runs in an isolated Docker container with a standardized directory structure:
/tmp/qa_test/ (Linux/Alpine)
├── dir1/
│ ├── subdir1/
│ │ └── deep_file.txt
│ ├── subdir2/
│ └── file_in_dir1.txt
├── dir2/
├── .hidden_dir/
│ └── hidden_file.txt
├── file1.txt
├── file2.log
├── file3.py
├── .hidden_file
├── small.txt
├── large.bin (10KB)
├── old_file.txt (2023-01-01)
├── new_file.txt (current time)
├── script.sh
├── config.ini
├── README.md
└── symlink.txt -> file1.txt
🔬 Tree CLI QA Testing
🐳 Testing platform: linux
🔨 Building Docker image: tree-qa:linux
✅ Image built successfully
🐳 Creating container: tree-qa-linux-1642857600
🧪 Running tests in container
📁 Basic Functionality
✅ Basic tree display
✅ Help flag
✅ Version flag
✅ Non-existent directory exit code
📁 File Filtering
✅ All files (including hidden)
✅ Directories only
✅ Pattern include .log files
...
==================================================
📊 linux Test Summary
==================================================
Total tests: 33
Passed: 32
Failed: 1
Success rate: 97.0%
Execution time: 45823ms
📁 Category Breakdown:
Basic Functionality: 4/4 (100.0%)
Depth and Structure: 5/5 (100.0%)
File Filtering: 4/5 (80.0%)
Display Options: 7/7 (100.0%)
Sorting Options: 4/4 (100.0%)
Output Options: 1/1 (100.0%)
Fromfile Functionality: 2/2 (100.0%)
Combined Options: 3/3 (100.0%)
Error Conditions: 3/3 (100.0%)
==================================================
qa/
├── src/
│ ├── main.rs # CLI interface and orchestration
│ ├── docker.rs # Docker API integration
│ ├── tests.rs # Test definitions and data
│ ├── environment.rs # Test environment setup
│ ├── executor.rs # Test execution and reporting
│ └── lib.rs # Module declarations
├── Cargo.toml # Dependencies and configuration
└── README.md # This file
RUST_LOG
: Controls logging level (default: qa=info
)DOCKER_HOST
: Docker daemon connection (uses Docker defaults)Tests are defined in src/tests.rs
and can be modified to:
Docker Connection Failed
# Check Docker daemon status
sudo systemctl status docker
# Verify Docker access
docker ps
Image Build Failures
# Check Dockerfile syntax
docker build -f ../../tests/qa/Dockerfile.linux ../../
# Clean Docker cache
docker system prune -f
Test Failures
# Run with verbose output
qa test --platforms linux --verbose
# Check individual test logs
qa test --platforms linux 2>&1 | grep "FAIL"
--verbose
for debugging test failurestests/qa/
for manual validationsrc/tests.rs
:
TestCase {
name: "New feature test".to_string(),
command: "/app/target/release/tree --new-flag .".to_string(),
expected_pattern: Some("expected_output".to_string()),
should_fail: false,
category: TestCategory::DisplayOptions,
}
src/environment.rs
cargo run -- test --platforms linux
../../tests/qa/Dockerfile.newplatform
src/docker.rs
src/environment.rs
cargo run -- test --platforms newplatform
This tool follows the same license as the main tree project (MIT).