How to Test Error Handling on Web (Complete Guide)

Error handling testing is crucial to ensure that Web applications can handle unexpected situations and provide a good user experience even when things go wrong. Poor error handling can lead to frustra

March 16, 2026 · 3 min read · How-To Guides

Why Error Handling Testing Matters

Error handling testing is crucial to ensure that Web applications can handle unexpected situations and provide a good user experience even when things go wrong. Poor error handling can lead to frustrated users, lost business, and damage to a company's reputation. Common failures in error handling include:

What to Test

To ensure that error handling is properly tested, the following test cases should be considered:

+ Successful login and registration

+ Successful payment processing

+ Successful search queries

+ Invalid login credentials

+ Invalid payment information

+ Search queries with no results

+ Empty or null input fields

+ Extremely large input fields

+ Special characters in input fields

+ Error messages should be readable by screen readers

+ Error messages should have a clear and consistent format

+ Error messages should provide alternative actions for users with disabilities

Some specific test cases to consider:

  1. Invalid username or password: Test that the application handles invalid login credentials correctly and provides a clear error message.
  2. Network connectivity issues: Test that the application handles network connectivity issues, such as a lost connection or a timeout.
  3. Invalid payment information: Test that the application handles invalid payment information, such as an expired credit card or an invalid address.
  4. Search queries with no results: Test that the application handles search queries with no results and provides a clear error message or alternative actions.
  5. Empty or null input fields: Test that the application handles empty or null input fields correctly and provides a clear error message.
  6. Extremely large input fields: Test that the application handles extremely large input fields correctly and provides a clear error message or alternative actions.
  7. Special characters in input fields: Test that the application handles special characters in input fields correctly and provides a clear error message or alternative actions.
  8. Error messages for screen readers: Test that error messages are readable by screen readers and provide a clear and consistent format.

Manual Testing Approach

To manually test error handling, follow these steps:

  1. Identify test cases: Identify the test cases to be tested, such as invalid login credentials or invalid payment information.
  2. Reproduce the error: Reproduce the error by entering invalid data or simulating a network connectivity issue.
  3. Verify the error message: Verify that the error message is clear and consistent and provides alternative actions for the user.
  4. Verify logging and monitoring: Verify that the error is logged and monitored correctly, making it easy to diagnose and fix the issue.

Automated Testing Approach

To automate error handling testing, tools such as Playwright or Cypress can be used. These tools provide a framework for writing automated tests and can simulate user interactions, such as entering invalid data or simulating network connectivity issues.


// Example of an automated test using Playwright
const { test, expect } = require('@playwright/test');

test('invalid login credentials', async ({ page }) => {
  // Go to the login page
  await page.goto('https://example.com/login');

  // Enter invalid login credentials
  await page.fill('input[name="username"]', 'invalidusername');
  await page.fill('input[name="password"]', 'invalidpassword');

  // Click the login button
  await page.click('button[type="submit"]');

  // Verify the error message
  await expect(page.locator('text=Invalid username or password')).toBeVisible();
});

How SUSA Tests Error Handling Autonomously

SUSA tests error handling autonomously using its 10 user personas, including the curious, impatient, elderly, adversarial, novice, student, teenager, business, accessibility, and power user personas. These personas catch different types of issues, such as:

SUSA also provides auto-generated Appium (Android) + Playwright (Web) regression test scripts and WCAG 2.1 AA accessibility testing with persona-based dynamic testing. Additionally, SUSA provides security testing, including OWASP Top 10, API security, and cross-session tracking. SUSA can be integrated with CI/CD pipelines using tools such as GitHub Actions, JUnit XML, and CLI tool (pip install susatest-agent). SUSA also provides cross-session learning, which allows it to get smarter about the application every run, and flow tracking, which provides PASS/FAIL verdicts for login, registration, checkout, and search flows. Finally, SUSA provides coverage analytics, including per-screen element coverage and untapped element lists. For more information, visit susatest.com.

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free