Files
张翔 4c8714c12d feat: complete system test fixes - 100% pass rate (85/85)
- Fixed all form tests (20/20 passing)
- Fixed all performance tests (35/35 passing)
- Fixed all SEO and accessibility tests (30/30 passing)
- Enhanced test framework with custom reporting
- Added performance baseline tracking
- Improved test reliability and error handling
2026-03-06 19:37:02 +08:00

36 lines
1.0 KiB
TypeScript

import { TestResult, TrendReport, Trend } from '../../types/reporting';
export class TrendAnalyzer {
analyze(results: TestResult[]): TrendReport {
return {
totalTests: results.length,
passRate: this.calculatePassRate(results),
averageDuration: this.calculateAverageDuration(results),
trends: this.calculateTrends(results)
};
}
private calculatePassRate(results: TestResult[]): number {
const passed = results.filter(r => r.status === 'passed').length;
return (passed / results.length) * 100;
}
private calculateAverageDuration(results: TestResult[]): number {
const totalDuration = results.reduce((sum, r) => sum + r.duration, 0);
return totalDuration / results.length;
}
private calculateTrends(results: TestResult[]): Trend[] {
const trends: Trend[] = [];
const now = new Date();
trends.push({
date: now.toISOString(),
passRate: this.calculatePassRate(results),
duration: this.calculateAverageDuration(results)
});
return trends;
}
}