Files
attune/docs/examples/pack-test-demo.sh
2026-02-04 17:46:30 -06:00

87 lines
3.3 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Pack Testing Framework Demo
#
# This script demonstrates the pack testing capabilities in Attune
set -e
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo " Attune Pack Testing Framework Demo"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
# Navigate to project root
cd "$(dirname "$0")/../.."
# Build the CLI if needed
if [ ! -f "./target/debug/attune" ]; then
echo "🔨 Building Attune CLI..."
cargo build --package attune-cli
echo ""
fi
ATTUNE_CLI="./target/debug/attune"
echo "📦 Testing Core Pack"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
# Basic test execution
echo "1⃣ Basic Test Execution"
echo " Command: attune pack test packs/core"
echo ""
$ATTUNE_CLI pack test packs/core
echo ""
# JSON output
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "2⃣ JSON Output (for scripting)"
echo " Command: attune pack test packs/core --output json"
echo ""
RUST_LOG=error $ATTUNE_CLI pack test packs/core --output json | jq '{
pack: .packRef,
version: .packVersion,
totalTests: .totalTests,
passed: .passed,
failed: .failed,
passRate: (.passRate * 100 | tostring + "%"),
duration: (.durationMs / 1000 | tostring + "s"),
suites: .testSuites | map({
name: .name,
type: .runnerType,
passed: .passed,
total: .total
})
}'
echo ""
# Verbose output
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "3⃣ Verbose Output (shows test cases)"
echo " Command: attune pack test packs/core --verbose"
echo ""
$ATTUNE_CLI pack test packs/core --verbose
echo ""
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "✅ Demo Complete!"
echo ""
echo "Available Commands:"
echo " attune pack test <pack> # Test a pack"
echo " attune pack test <pack> --verbose # Show test case details"
echo " attune pack test <pack> --detailed # Show stdout/stderr"
echo " attune pack test <pack> --output json # JSON output"
echo " attune pack test <pack> --output yaml # YAML output"
echo ""
echo "Test Configuration:"
echo " Pack tests are configured in pack.yaml under the 'testing' section"
echo " See packs/core/pack.yaml for an example"
echo ""
echo "Documentation:"
echo " docs/pack-testing-framework.md - Full design document"
echo " packs/core/tests/README.md - Core pack test documentation"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"