完成自动化测试套件实施(W1-W11)
W1-W3: 基线修复与测试基础设施搭建 - 修复 Jenkins JDK 21 兼容性,统一 E2E 目录,修复 storageState 冲突 - 搭建后端测试基类 BaseContractTest + Testcontainers PostgreSQL - 创建 TestDataFactory 链式构造,完善 Vitest 基座与 Playwright fixtures - 建立 docker-compose.test.yml 与测试数据隔离方案 W4-W5: 单元测试补齐(阶段 2) - 补齐 gym-member/gym-groupCourse/gym-checkIn/gym-payment 核心模块单元测试 - 补齐 gym-coach/manage-sys 模块单元测试 - 前端 utils/composables/stores 单元测试,37 文件 502 项测试 - JaCoCo 覆盖率门禁从 30% 调整至 55%,21 模块全部通过 W6-W7: 集成与契约测试(阶段 3) - Repository 集成测试:会员/团课/签到/支付关键表,Testcontainers 100% 通过 - Handler 集成测试:WebTestClient 覆盖正向/异常/权限路径 - 网关集成测试:JWT/RBAC/签名/限流/重试 - Flyway 迁移测试:验证迁移脚本可重复执行 - OpenAPI 契约测试:覆盖 ≥80% P0 接口,202 项契约测试 0 失败 - 跨模块契约测试:会员-支付-团课数据一致性 W8-W9: E2E 与用户旅程测试(阶段 4) - 管理员 Web 核心流程 E2E:用户/角色/菜单/字典/配置 - 小程序会员端核心页面 E2E:购卡/预约/签到 - 5 条 P0 用户旅程全链路自动化,60 条 journey 测试 0 失败 W10: 变异测试与质量门禁(阶段 5) - 后端 PIT 配置:pitest-maven 1.19.1 + JUnit 5,覆盖率阈值 55%/变异阈值 45% - P0 模块基线:manage-sys 48%,gym-member 30%,gym-payment 36% - 前端 StrykerJS 配置:utils/stores 变异测试,dateFormat.ts 70.83% - Jenkins 质量门禁:JaCoCo/PIT/E2E 统一检查,不达标阻断构建 W11: 持续运行与改进(阶段 6) - 测试指标收集脚本 scripts/collect-test-metrics.py + HTML 看板生成器 - Flaky Test 治理 SOP:检测→隔离→根因分析→修复→验证闭环 - 测试资产定期评审流程:月度/季度/事件驱动三级机制 - 快速参考指南 docs/testing/quick-reference.md - 累计 10 份测试文档,7 个里程碑全部达成
This commit was merged in pull request #54.
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
import { test as dataTest, TestData } from './fixtures/test-data';
|
||||
import { LoginPage } from './pages/LoginPage';
|
||||
import { DashboardPage } from './pages/DashboardPage';
|
||||
import { MemberManagementPage } from './pages/MemberManagementPage';
|
||||
import { GroupCourseManagementPage } from './pages/GroupCourseManagementPage';
|
||||
import { CoachManagementPage } from './pages/CoachManagementPage';
|
||||
import { StatisticsDashboardPage } from './pages/StatisticsDashboardPage';
|
||||
import { UserManagementPage } from './pages/UserManagementPage';
|
||||
import { RoleManagementPage } from './pages/RoleManagementPage';
|
||||
import { MenuManagementPage } from './pages/MenuManagementPage';
|
||||
import { DictionaryManagementPage } from './pages/DictionaryManagementPage';
|
||||
import { SystemConfigPage } from './pages/SystemConfigPage';
|
||||
import { FileManagementPage } from './pages/FileManagementPage';
|
||||
import { NotificationPage } from './pages/NotificationPage';
|
||||
import { OperationLogPage } from './pages/OperationLogPage';
|
||||
import { LoginLogPage } from './pages/LoginLogPage';
|
||||
import { ExceptionLogPage } from './pages/ExceptionLogPage';
|
||||
|
||||
/**
|
||||
* 统一 Playwright fixtures。
|
||||
*
|
||||
* <p>在 {@link TestData} 的基础上注入所有 Page Object,使新 E2E 用例不再直接写选择器。
|
||||
* 测试文件统一通过 {@code import { test, expect } from '../fixtures'} 引入。</p>
|
||||
*/
|
||||
type PageFixtures = {
|
||||
loginPage: LoginPage;
|
||||
dashboardPage: DashboardPage;
|
||||
memberManagementPage: MemberManagementPage;
|
||||
groupCourseManagementPage: GroupCourseManagementPage;
|
||||
coachManagementPage: CoachManagementPage;
|
||||
statisticsDashboardPage: StatisticsDashboardPage;
|
||||
userManagementPage: UserManagementPage;
|
||||
roleManagementPage: RoleManagementPage;
|
||||
menuManagementPage: MenuManagementPage;
|
||||
dictionaryManagementPage: DictionaryManagementPage;
|
||||
systemConfigPage: SystemConfigPage;
|
||||
fileManagementPage: FileManagementPage;
|
||||
notificationPage: NotificationPage;
|
||||
operationLogPage: OperationLogPage;
|
||||
loginLogPage: LoginLogPage;
|
||||
exceptionLogPage: ExceptionLogPage;
|
||||
};
|
||||
|
||||
export const test = dataTest.extend<PageFixtures>({
|
||||
loginPage: async ({ page }, use) => {
|
||||
await use(new LoginPage(page));
|
||||
},
|
||||
dashboardPage: async ({ page }, use) => {
|
||||
await use(new DashboardPage(page));
|
||||
},
|
||||
memberManagementPage: async ({ page }, use) => {
|
||||
await use(new MemberManagementPage(page));
|
||||
},
|
||||
groupCourseManagementPage: async ({ page }, use) => {
|
||||
await use(new GroupCourseManagementPage(page));
|
||||
},
|
||||
coachManagementPage: async ({ page }, use) => {
|
||||
await use(new CoachManagementPage(page));
|
||||
},
|
||||
statisticsDashboardPage: async ({ page }, use) => {
|
||||
await use(new StatisticsDashboardPage(page));
|
||||
},
|
||||
userManagementPage: async ({ page }, use) => {
|
||||
await use(new UserManagementPage(page));
|
||||
},
|
||||
roleManagementPage: async ({ page }, use) => {
|
||||
await use(new RoleManagementPage(page));
|
||||
},
|
||||
menuManagementPage: async ({ page }, use) => {
|
||||
await use(new MenuManagementPage(page));
|
||||
},
|
||||
dictionaryManagementPage: async ({ page }, use) => {
|
||||
await use(new DictionaryManagementPage(page));
|
||||
},
|
||||
systemConfigPage: async ({ page }, use) => {
|
||||
await use(new SystemConfigPage(page));
|
||||
},
|
||||
fileManagementPage: async ({ page }, use) => {
|
||||
await use(new FileManagementPage(page));
|
||||
},
|
||||
notificationPage: async ({ page }, use) => {
|
||||
await use(new NotificationPage(page));
|
||||
},
|
||||
operationLogPage: async ({ page }, use) => {
|
||||
await use(new OperationLogPage(page));
|
||||
},
|
||||
loginLogPage: async ({ page }, use) => {
|
||||
await use(new LoginLogPage(page));
|
||||
},
|
||||
exceptionLogPage: async ({ page }, use) => {
|
||||
await use(new ExceptionLogPage(page));
|
||||
},
|
||||
});
|
||||
|
||||
export { expect } from '@playwright/test';
|
||||
export type { TestUser, TestRole, TestMenu } from './fixtures/test-data';
|
||||
Reference in New Issue
Block a user