feat: add enhanced test reporter with tiered analysis
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
const { TestReporter } = require('./src/utils/test-reporter');
|
||||
|
||||
const mockResults = [
|
||||
{
|
||||
testId: 'test-1',
|
||||
file: 'smoke/navigation.smoke.spec.ts',
|
||||
title: '应该成功加载首页',
|
||||
status: 'passed',
|
||||
duration: 15000,
|
||||
tier: 'fast',
|
||||
tags: ['@smoke', '@critical'],
|
||||
},
|
||||
{
|
||||
testId: 'test-2',
|
||||
file: 'admin/news-management.spec.ts',
|
||||
title: '应该能够创建新闻',
|
||||
status: 'passed',
|
||||
duration: 45000,
|
||||
tier: 'standard',
|
||||
tags: ['@admin', '@regression'],
|
||||
},
|
||||
{
|
||||
testId: 'test-3',
|
||||
file: 'api/admin.api.spec.ts',
|
||||
title: '应该能够获取内容列表',
|
||||
status: 'failed',
|
||||
duration: 5000,
|
||||
tier: 'fast',
|
||||
tags: ['@api', '@critical'],
|
||||
},
|
||||
{
|
||||
testId: 'test-4',
|
||||
file: 'visual/homepage-visual.spec.ts',
|
||||
title: '首页视觉回归测试',
|
||||
status: 'passed',
|
||||
duration: 150000,
|
||||
tier: 'deep',
|
||||
tags: ['@visual', '@regression'],
|
||||
},
|
||||
];
|
||||
|
||||
console.log('📊 Testing test reporter...');
|
||||
const reporter = new TestReporter();
|
||||
const report = reporter.generateReport(mockResults);
|
||||
|
||||
console.log('✅ Report generated:');
|
||||
console.log(` Total tests: ${report.total.total}`);
|
||||
console.log(` Passed: ${report.total.passed}`);
|
||||
console.log(` Failed: ${report.total.failed}`);
|
||||
console.log(` Duration: ${(report.total.duration / 1000).toFixed(2)}s`);
|
||||
|
||||
reporter.saveReport(report, 'json');
|
||||
reporter.saveReport(report, 'html');
|
||||
|
||||
console.log('✅ Test reporter completed');
|
||||
Reference in New Issue
Block a user