DEV Community

Cover image for Making the Web More Inclusive: Accessibility Testing with open source testing agents
robin gupta
robin gupta

Posted on

Making the Web More Inclusive: Accessibility Testing with open source testing agents

Hey dev community! With the holidays right around the corner, it feels like the perfect time to talk about one of the best gifts we can give our users: an accessible web. Here at TestZeus, we’ve been hard at work adding Accessibility Testing to our open-source Hercules Agent—and I’m super excited to share the details with you!


Why Accessibility Matters

Accessibility is about making sure everyone can use your website or app, regardless of ability. That includes users who rely on screen readers, have motor difficulties, or experience color blindness, among many other scenarios. It’s not just a moral responsibility or a legal checkmark—it’s about crafting better user experiences for everyone.


Meet Hercules

If you haven’t heard of it yet, Hercules is our open-source testing agent that automates various aspects of software testing. By adding Accessibility Testing, we aim to reduce the friction developers often face when trying to meet WCAG (Web Content Accessibility Guidelines). Some highlights:

  • Covers WCAG 2.0, 2.1, and 2.2
  • Costs less than $1 per scan (so, super accessible for smaller teams too!)
  • Open-source and easy to integrate into your CI/CD pipeline

In other words, we’re focusing on practicality and affordability, so you don’t need a huge budget or specialized skillset to make your site more inclusive.


Quick Setup

  1. Clone the Repo

  2. Install Dependencies

    • A quick 'pip install testzeus-hercules'
  3. Write Your Test in Gherkin

    • Hercules uses Gherkin-like .feature files. It’s straightforward and keeps the logic clear.
  4. Run Hercules

    • A single command to scan for accessibility issues. Reports are automatically generated, so you can jump right into fixing any violations.

Sample Test Scenario

We’ve included a snippet below to show how a typical .feature file might look, using the Zerodha brokerage calculator page as an example:

Feature: Check accessibility for brokerage calculator on Zerodha website
  # This feature tests the brokerage calculator, and contract notes on Zerodha website

  Scenario Outline: Check calculations on brokerage and SEBI charges
    Given the user is on "https://zerodha.com/brokerage-calculator#tab-equities"
    Then validate the page for accessibility.
    Then there should not be any issues.
Enter fullscreen mode Exit fullscreen mode

Here’s the breakdown:

  • Feature: Provides context—testing Zerodha’s brokerage calculator.
  • Scenario Outline: Explains the specific scenario.
  • Steps:
    • Given: Navigate to a specific URL.
    • Then: Validate accessibility.
    • Then: Ensure zero issues remain (fingers crossed!).

Hercules interprets this scenario, visits the page, scans it, and flags any WCAG non-compliances.


Viewing Your Results

Once your tests complete, Hercules shows you a report detailing any accessibility issues found:

  • Issue Description: A quick summary of the violation.
  • WCAG Reference: Which guideline is being broken.
  • Severity: Ranges from minor to critical.
  • Location: Points you to the exact DOM element or area in the UI.

This immediate feedback loop makes it easy for devs to fix issues before they reach production.


Integrating with CI/CD

Because Hercules is open-source and script-friendly, you can plug it into your CI pipeline. For example, in GitHub Actions, you can create a workflow that runs Hercules every time you push new code. That way, you’ll catch accessibility regressions early in the development process.


Going Beyond Automated Checks

While Hercules does a fantastic job with automated scans, keep in mind that accessibility is a multifaceted area. You might still want to:

  • Test with screen readers like NVDA or VoiceOver.
  • Check color contrasts in real-world scenarios.
  • Solicit feedback from users with disabilities for real-life insights.

Automated testing is a huge help, but manual testing still plays a key role in thorough accessibility coverage.


Wrapping Up

This holiday season, consider giving the gift of an accessible experience to your users. With Hercules, you can weave accessibility checks right into your development cycle—reducing barriers and making the web a more inclusive place.

Here are some helpful links:

If you have any questions, feedback, or ideas for improvement, we’d love to hear from you! Let’s work together to make the internet more welcoming for all.

Happy Holidays and Happy Testing!

Top comments (0)