- Raise use-swipe-gesture mutation score to 66.13% (target 65%+) - Maintain use-reduced-motion mutation score at 76.32% (target 50%+) - Fix use-reduced-motion.ts ESLint set-state-in-effect warning - Add UJ-10 deep searcher journey (category browse → article read → content discovery) - Add 40 new test files (analytics, detail, sections, ui, lib components) - Update test-strategy-plan.md to v2.0 (sync test count to 1591) - Sync README.md with final release metrics Quality gates: TS 0 errors, ESLint 0 errors, 121 suites / 1591 tests passed
62 lines
1.6 KiB
JavaScript
62 lines
1.6 KiB
JavaScript
// @ts-nocheck
|
|
import http from 'k6/http';
|
|
import { check, sleep } from 'k6';
|
|
import { Rate, Trend } from 'k6/metrics';
|
|
|
|
const errorRate = new Rate('errors');
|
|
const responseTime = new Trend('response_time');
|
|
|
|
export const options = {
|
|
stages: [
|
|
{ duration: '5m', target: 50 }, // 5分钟逐步增加到50用户
|
|
{ duration: '60m', target: 50 }, // 保持50用户60分钟(稳定性测试)
|
|
{ duration: '5m', target: 0 }, // 5分钟逐步减少到0
|
|
],
|
|
thresholds: {
|
|
http_req_duration: ['p(95)<1000', 'p(99)<2000'], // 长时间运行允许稍高延迟
|
|
http_req_failed: ['rate<0.01'],
|
|
errors: ['rate<0.01'],
|
|
},
|
|
};
|
|
|
|
const BASE_URL = __ENV.BASE_URL || 'http://localhost:3000';
|
|
|
|
// 页面列表用于循环测试
|
|
const pages = [
|
|
'/',
|
|
'/about',
|
|
'/products',
|
|
'/products/erp',
|
|
'/solutions',
|
|
'/solutions/industry-001',
|
|
'/services',
|
|
'/services/consulting',
|
|
'/cases',
|
|
'/news',
|
|
'/contact',
|
|
'/team',
|
|
];
|
|
|
|
export default function () {
|
|
// 按迭代次数轮询页面,确保所有页面都被覆盖
|
|
const page = pages[__ITER % pages.length];
|
|
const res = http.get(`${BASE_URL}${page}`, {
|
|
tags: { name: `page-${page.replace(/\//g, '_')}` },
|
|
});
|
|
|
|
const success = check(res, {
|
|
'status is 200': (r) => r.status === 200,
|
|
'response time < 1000ms': (r) => r.timings.duration < 1000,
|
|
});
|
|
|
|
errorRate.add(!success);
|
|
responseTime.add(res.timings.duration);
|
|
|
|
sleep(3); // 较长的等待时间,模拟真实用户浏览行为
|
|
}
|
|
|
|
export function handleSummary(data) {
|
|
return {
|
|
'performance/soak-test-summary.json': JSON.stringify(data, null, 2),
|
|
};
|
|
} |