पाठ 21 / 25

Automated testing

विकास में accessibility मुद्दों को जल्दी find करने के लिए tools का उपयोग करें।

लोकप्रिय उपकरण

axe DevTools: browser extension। Wave: visual feedback। Lighthouse: Chrome built-in। pa11y: CLI tool। jest-axe: React testing। Accessibility Insights: Microsoft का comprehensive tool।

jest-axe उदाहरण

अपने test suite में accessibility checks को automate करें।

import { axe, toHaveNoViolations } from 'jest-axe';
expect.extend(toHaveNoViolations);

test('Button is accessible', async () => {
  const { container } = render(
    <button aria-label="Submit">Submit</button>
  );
  const results = await axe(container);
  expect(results).toHaveNoViolations();
});

Automated testing की limitations

Tools ~30% मुद्दों को find करते हैं। Manual testing और real user testing बाकी को catch करते हैं। Automated tests को पहले pass के रूप में use करें, final verification नहीं।