You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

118 lines
3.4 KiB

#!/bin/bash
# Test Stability Runner for TimeSafari (Simple Version)
# Executes the full test suite 10 times and analyzes failure patterns
# Author: Matthew Raymer
# Source common functions
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/test-stability-common.sh"
# Override summary file to use text format instead of JSON
SUMMARY_FILE="${RESULTS_DIR}/stability-summary-${TIMESTAMP}.txt"
# Function to generate simple text summary
generate_simple_summary() {
log_info "Generating simple text summary..."
local total_tests=0
local always_passing=0
local always_failing=0
local intermittent=0
# Count test statistics
for test_name in "${!test_names[@]}"; do
total_tests=$((total_tests + 1))
local passes=${test_successes[$test_name]:-0}
local fails=${test_failures[$test_name]:-0}
local total=$((passes + fails))
if [ "$fails" -eq 0 ]; then
always_passing=$((always_passing + 1))
elif [ "$passes" -eq 0 ]; then
always_failing=$((always_failing + 1))
else
intermittent=$((intermittent + 1))
fi
done
# Calculate overall success rate
local total_runs=$((TOTAL_RUNS * total_tests))
local total_successes=0
for passes in "${test_successes[@]}"; do
total_successes=$((total_successes + passes))
done
local overall_success_rate=0
if [ "$total_runs" -gt 0 ]; then
overall_success_rate=$((total_successes * 100 / total_runs))
fi
# Generate simple text summary
cat > "$SUMMARY_FILE" << EOF
TimeSafari Test Stability Summary
================================
Generated: $(date)
Total Runs: $TOTAL_RUNS
Total Tests: $total_tests
Summary Statistics:
- Always Passing: $always_passing tests
- Always Failing: $always_failing tests
- Intermittent: $intermittent tests
- Overall Success Rate: $overall_success_rate%
Individual Test Results:
EOF
# Add individual test results
for test_name in "${!test_names[@]}"; do
local passes=${test_successes[$test_name]:-0}
local fails=${test_failures[$test_name]:-0}
local total=$((passes + fails))
local success_rate=$(calculate_percentage "$passes" "$total")
cat >> "$SUMMARY_FILE" << EOF
$test_name:
Passes: $passes
Failures: $fails
Total: $total
Success Rate: $success_rate%
Status: ${test_results[$test_name]:-unknown}
EOF
done
log_success "Simple summary generated: $SUMMARY_FILE"
}
# Main execution function
main() {
log_info "Starting simple test stability analysis with $TOTAL_RUNS runs"
log_info "Results will be saved to: $RESULTS_DIR"
echo
# Run all test executions
for run_number in $(seq 1 $TOTAL_RUNS); do
track_test_progress "$run_number" "test suite"
if run_single_test "$run_number"; then
log_success "Run $run_number completed successfully"
else
log_warning "Run $run_number failed, continuing with remaining runs"
fi
# Small delay between runs to avoid overwhelming the system
if [ "$run_number" -lt $TOTAL_RUNS ]; then
sleep 2
fi
done
# Generate and display results
generate_simple_summary
display_final_results
log_success "Simple test stability analysis complete!"
}
# Run main function
main "$@"