mcpField
T
testing-strategy

testing-strategy

github.com/community-access测试与质量431215 次安装1 天前更新
代码仓库

关于 testing-strategy

用于制定无障碍测试策略的 Skill,帮助判断自动化与人工测试的适用场景、选择屏幕阅读器和浏览器组合,并编写验收标准。还介绍回归测试模式和常用测试工具。

主要功能

  1. 01自动化与人工测试覆盖指导
  2. 02屏幕阅读器和浏览器组合表
  3. 03测试决策流程
  4. 04CI 无障碍检查门禁
  5. 05验收标准模板
  6. 06测试工具参考

适用场景

  1. 01规划新组件的测试
  2. 02选择辅助技术测试组合
  3. 03在 CI 中加入无障碍检查
  4. 04编写无障碍验收标准

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/community-access/accessibility-agents --skill testing-strategy

安装后在 Claude Code 中输入/testing-strategy确认已加载。

详细介绍

测试策略技能

无障碍测试的决策框架——何时使用自动化工具与手动测试、应测试哪些屏幕阅读器 + 浏览器组合,以及如何编写无障碍验收标准。


自动化测试与手动测试的覆盖范围

自动化工具可发现的问题(约 30-40%)需要手动测试的问题(约 60-70%)
图片缺少替代文本替代文本的质量和准确性
表单缺少标签标签是否清晰且有帮助
色彩对比度比率(计算值)上下文中的色彩对比度(渐变、图片)
缺少 lang 属性语言识别是否正确
ID 重复阅读顺序是否合理
自定义控件缺少 ARIA 角色交互模式对应的 ARIA 角色是否正确
标题层级违规标题文本是否有意义
链接和按钮为空链接 / 按钮文本是否能清楚描述其用途
表格缺少表头表格标题和表头关联质量
ARIA 语法错误屏幕阅读器播报是否正确

浏览器 + 屏幕阅读器兼容性矩阵

首要测试组合(必测)
屏幕阅读器浏览器操作系统优先级
NVDAFirefoxWindows必须测试
NVDAChromeWindows必须测试
JAWSChromeWindows必须测试
VoiceOverSafarimacOS必须测试
VoiceOverSafariiOS必须测试
TalkBackChromeAndroid建议测试
次要组合(有则更好)
屏幕阅读器浏览器操作系统
NarratorEdgeWindows
JAWSEdgeWindows

测试决策树

Is it a new component or page?
├── Yes → Full test coverage (automated + manual)
│   ├── Run axe-core / Lighthouse scan
│   ├── Keyboard-only navigation test
│   ├── Screen reader announcement test (NVDA + VoiceOver minimum)
│   └── Visual check at 200% zoom
└── No → What changed?
    ├── Colors/styling → Contrast check + visual review
    ├── Interactive behavior → Keyboard + screen reader test
    ├── Content/text → Screen reader announcement check
    ├── Layout/order → Reading order + focus order test
    └── Dependencies updated → Regression scan (axe-core)

回归测试模式

CI 流水线无障碍门禁
  1. axe-core 扫描:在每个 PR 上运行。发现新的严重 / 高严重性违规时失败。
  2. 基线管理:在 .a11y-baseline.json 中存储已知问题。仅对新问题失败。
  3. Lighthouse 分数阈值:设置最低无障碍分数(例如,90)。分数回退时失败。
  4. 视觉回归:在 200% 缩放下截取屏幕截图。对比焦点指示器和布局变化。
防止回归
  • 在现有组件测试中添加无障碍断言(参见 testing-accessibility.instructions.md)
  • 在 E2E 测试套件中加入键盘导航
  • 长期跟踪无障碍分数趋势(而不仅仅是通过 / 失败)

验收标准模板

用户故事
Given [context],
When [action by keyboard/mouse/screen reader],
Then [accessible outcome]:

- [ ] Component has an accessible name (via label, aria-label, or aria-labelledby)
- [ ] Component has the correct ARIA role
- [ ] Component is reachable and operable by keyboard (Tab, Enter, Space, Escape, Arrows as appropriate)
- [ ] Focus is visible when the component receives focus
- [ ] State changes are announced to screen readers (aria-expanded, aria-selected, aria-checked, etc.)
- [ ] Error messages are associated with their inputs (aria-describedby or aria-errormessage)
- [ ] Content is readable at 200% zoom without horizontal scrolling
- [ ] Color is not the only means of conveying information

常用测试工具

工具类型最适合
axe-core / @axe-core/cli自动化CI/CD 集成、广泛扫描违规
Lighthouse自动化性能 + 无障碍综合评分
WAVE半自动化无障碍功能 / 问题的可视化叠加层
Accessibility Insights半自动化FastPass(自动化)+ Assessment(引导式手动测试)
pa11y自动化CI/CD、HTML CodeSniffer 规则
jest-axe单元测试在 jest 中进行组件级 axe 扫描
cypress-axeE2E 测试在 Cypress 中进行页面级 axe 扫描
playwright + @axe-core/playwrightE2E 测试在 Playwright 中进行页面级 axe 扫描

屏幕阅读器测试速查表

NVDA(Windows)
按键操作
Insert + Space切换焦点 / 浏览模式
Tab移至下一个可聚焦元素
H下一个标题
D下一个地标
F下一个表单字段
T下一个表格
Insert + F7元素列表(链接、标题、地标)
VoiceOver(macOS)
按键操作
VO (Ctrl+Option) + Right移至下一个元素
VO + Space激活当前元素
VO + U打开转子(按类型导航)
VO + Cmd + H下一个标题

评论

支持 Markdown