EthicsComputerCourses
Join training +91 90532 10052

HTML Testing & Quality Assurance

HTML · Lesson 116 of 234 Advanced 11 min read Updated

By the end of this lesson you will be able to check an HTML page the way a quality assurance (QA) engineer does. You will know the six areas to test, run a manual checklist, build two small automated checks in the browser, choose the right tool for each job, and write a short test plan and a clear bug report that a developer can act on.

What you should know first: HTML Validation Using W3C, HTML Accessibility Fundamentals and SEO-Friendly HTML Structure. This lesson is an overview; Level 8 goes deep, starting with HTML Testing Fundamentals.

Testing and QA are not the same thing

Testing means checking something and recording what you find. Quality assurance is the wider habit of building quality into the whole process: agreeing what "done" means, testing at the right moments, and making sure bugs are fixed and stay fixed.

Think of a train leaving Jaipur Junction. Before departure, staff walk along the coaches and check the brakes, doors, lights and coupling. That walk is testing. The rule that no train leaves without the walk, with a signed sheet, is quality assurance.

For a web page, the "train" is the HTML your team is about to publish. A broken link or an unlabelled form field is cheap to fix before launch and expensive after real visitors have met it.

Six areas to test on any page

AreaWhat you checkQuick way to check
ValidityCorrect nesting, no duplicate id, required attributes presentNu Html Checker, html-validate
LinksEvery link and image loads; no 404 errors; links go where their text saysA link checker, then click the main paths
AccessibilityLabels, alt text, headings, keyboard use, focus, contrastaxe, Lighthouse, then keyboard and screen reader by hand
SEO tagsUnique <title>, meta description, one <h1>, canonical, langView Source, Lighthouse SEO
ResponsiveReadable at 320 px wide and at 200% zoom; no sideways scrollingDevTools device mode, a real phone
FormsRequired fields, wrong input, error messages, what is sentFill it in with good, bad and edge-case data

Automated tools are fast and never get bored, but they only find what can be measured. A tool can see that an image has alt text; only a human can judge whether "image123" describes a photo of the Pune campus. You always need both.

Step 1: a manual QA checklist

A checklist turns "looks fine to me" into a repeatable process. Here is one for a single page. Do it in a fresh browser window, not the one you develop in, so old cached files do not hide problems.

  1. Read the tab title and View Source: is the <title> unique and useful, and is there a meta description?
  2. Press Tab from the top of the page to the bottom. Can you reach every link, button and field, and can you always see where focus is?
  3. Use the form with correct data, then with empty fields, then with wrong data such as a 5-digit pincode.
  4. Click every link in the header, footer and main content once.
  5. Narrow the window to about 320 px, then zoom to 200%. Nothing should be cut off or need sideways scrolling.
  6. Turn images off (or block them in DevTools) and check the page still makes sense with the alt text.
  7. Repeat the key steps in a second browser engine, for example Chrome and Firefox, as in Cross-Browser Compatibility.

After each step, note the result as pass, fail (with a bug report) or blocked (you could not test it).

Step 2: a quick automated audit in the browser

Some checklist items are easy to automate with a few lines of JavaScript. The page below has deliberate mistakes. Its script runs simple checks on the page itself and prints a report. Fix the HTML until every line says PASS.

HTMLOpen in editor
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Page</title>
  <style>
    body { font-family: system-ui, sans-serif; margin: 16px; }
    #report li.fail { color: #b00020; }
    #report li.pass { color: #1b5e20; }
  </style>
</head>
<body>
  <h1>Kochi Book Fair 2027</h1>
  <img src="https://course.ethicscomputer.in/assets/samples/landscape-400.svg" width="400" height="250">
  <form>
    <input id="email" type="email" placeholder="Email">
    <button type="submit">Get tickets</button>
  </form>
  <a href="/stalls"></a>
  <h1>Visit us</h1>

  <h2>QA report</h2>
  <ul id="report"></ul>

  <script>
    const checks = [
      ["<html> has a lang attribute", () => document.documentElement.lang !== ""],
      ["Title is longer than 10 characters", () => document.title.trim().length > 10],
      ["Meta viewport exists", () => !!document.querySelector('meta[name="viewport"]')],
      ["Meta description exists", () => !!document.querySelector('meta[name="description"]')],
      ["Exactly one <h1>", () => document.querySelectorAll("h1").length === 1],
      ["Every <img> has alt", () => !document.querySelector("img:not([alt])")],
      ["Every link has text", () => [...document.links].every((a) => a.textContent.trim() !== "" || a.getAttribute("aria-label"))],
      ["Every input has a label", () => [...document.querySelectorAll("input")].every((i) => i.labels.length > 0 || i.getAttribute("aria-label"))]
    ];
    const report = document.querySelector("#report");
    for (const [name, test] of checks) {
      const ok = test();
      const li = document.createElement("li");
      li.className = ok ? "pass" : "fail";
      li.textContent = (ok ? "PASS " : "FAIL ") + name;
      report.append(li);
    }
  </script>
</body>
</html>

At first every check fails. Add lang="en-IN", a better title, the viewport and description meta tags, an alt, link text, a <label for="email">, and change the second <h1> to <h2>. Real tools run hundreds of checks like these; the idea is the same.

Step 3: testing a form with test cases

A test case is one input with its expected result. For a 6-digit Indian pincode, good test cases cover a normal value, the edges and the obviously wrong. This technique is called boundary value testing: bugs love the edges. The script below feeds each case into a real input and compares the browser's verdict with what we expected.

HTMLOpen in editor
<!DOCTYPE html>
<html lang="en-IN">
<head>
  <meta charset="utf-8">
  <title>Pincode test cases</title>
  <style>
    body { font-family: system-ui, sans-serif; margin: 16px; }
    table { border-collapse: collapse; }
    th, td { border: 1px solid #999; padding: 4px 8px; text-align: left; }
    .fail { background: #ffebee; }
  </style>
</head>
<body>
  <label for="pin">Pincode</label>
  <input id="pin" name="pin" inputmode="numeric" required pattern="[1-9][0-9]{5}">

  <table>
    <caption>Test results</caption>
    <thead><tr><th scope="col">Input</th><th scope="col">Expected</th><th scope="col">Actual</th><th scope="col">Result</th></tr></thead>
    <tbody id="results"></tbody>
  </table>

  <script>
    const cases = [
      ["302001", true],   // Jaipur, normal value
      ["110001", true],   // Delhi
      ["", false],        // empty, required
      ["30200", false],   // 5 digits
      ["3020011", false], // 7 digits
      ["012345", false],  // pincodes never start with 0
      ["30 2001", false]  // space inside
    ];
    const input = document.querySelector("#pin");
    const tbody = document.querySelector("#results");
    for (const [value, expected] of cases) {
      input.value = value;
      const actual = input.checkValidity();
      const row = tbody.insertRow();
      row.className = actual === expected ? "" : "fail";
      for (const text of [JSON.stringify(value), expected ? "valid" : "invalid",
                          actual ? "valid" : "invalid", actual === expected ? "PASS" : "FAIL"]) {
        row.insertCell().textContent = text;
      }
    }
    input.value = "";
  </script>
</body>
</html>

All seven rows pass. Now remove required and run it again: the empty case fails, because an optional field with no value is valid. Your test caught a real change in behaviour. The validation attributes are explained in Pattern, Required & Min/Max Attributes. Remember that browser checks only help honest visitors; the server must check again.

Tools overview

ToolWhat it findsHow you run it
Nu Html CheckerMarkup that breaks the HTML standardvalidator.w3.org/nu, or vnu.jar locally
html-validateStandard errors plus best-practice rules you configurenpx html-validate in a Node.js project
axeAccessibility rule failures (WCAG based)Browser extension, or axe-core in test scripts
LighthousePerformance, accessibility, best practices and SEO scoresChrome DevTools, or the lighthouse command
Link checkersBroken links and missing files across a whole siteFor example linkinator or the W3C Link Checker
DevTools device modeLayout at phone and tablet sizesF12, then the device toolbar

Here is html-validate (version 10.9 in this run) checking an admissions page for a Pune coaching institute:

Terminal
npx html-validate admission.html
Output
  10:4  error  <img> is missing required "alt" attribute         wcag/h37
  12:6  error  <input> is missing recommended "type" attribute   no-implicit-input-type
  15:6  error  <button> is missing recommended "type" attribute  no-implicit-button-type

✖ 3 problems (3 errors, 0 warnings)

(The real output also prints the file path first and documentation links at the end.) Line 12 was <input id="student" name="student" placeholder="Student name">. The tool asked for a type, but it did not complain that the field has no <label>, only a placeholder that vanishes as soon as you type. A two-second manual check catches that. Setting these tools up to run on every change is the subject of Automated HTML Validation, and Lighthouse has its own lesson next: Lighthouse & HTML Auditing.

Writing a test plan

A test plan is a short document that says what will be tested, how, by whom and when testing is finished. For one page it fits on one screen:

Text
Test plan: Admissions page, Pune Science Academy
Scope:        /admissions (HTML, form, links). Payment page not in scope.
Browsers:     Chrome and Firefox (latest), Safari on iPhone, Chrome on Android
Widths:       320, 768, 1280 px; 200% zoom
Tools:        Nu Html Checker, axe extension, Lighthouse, linkinator
Manual:       keyboard-only pass, form test cases (valid, empty, wrong, edge)
Entry:        page deployed to the staging server
Exit:         no open Critical or Major bugs; validator shows 0 errors
Tester:       Ananya, 3 March to 4 March

Entry criteria say when testing can start; exit criteria say when it can stop. Without exit criteria, "testing" never ends or ends whenever someone gets impatient. The Test Plans & Strategy lesson goes further.

Writing a bug report

A good bug report lets a developer see the problem in under a minute, without asking you anything:

Text
Title:       Student name field has no label; screen readers announce "edit text"
Page:        https://staging.example.com/admissions
Environment: Chrome (latest) on Windows 11 with NVDA; also Firefox
Steps:       1. Open the page  2. Press Tab until the first form field  3. Listen
Expected:    NVDA announces "Student name, edit text"
Actual:      NVDA announces "edit text"; the placeholder disappears when typing
Severity:    Major (blocks blind users from applying)
Evidence:    screenshot-label.png, line 12 of the HTML
Suggested:   add <label for="student">Student name</label>

Write one bug per report, give exact steps, and separate expected from actual. Severity describes the impact on users; priority (decided by the team) describes how soon to fix it. See Bug Life Cycle & Bug Reports for the full process.

Common mistakes

  • Trusting a 100 score. Automated tools miss meaning, such as useless alt text or a confusing tab order.
  • Testing only on your own fast laptop. Check a phone, a narrow window and a slow connection.
  • Testing only the happy path. Most form bugs live in empty, too long and wrong-format input.
  • Vague bug reports. "Form broken" wastes everyone's time; steps, expected and actual results fix that.
  • Testing the template instead of the output. Check the HTML the browser really receives.

Interview questions

1. What would you check first when asked to QA a new HTML page?

I would validate the markup, then do a keyboard-only pass and check the form with valid, empty and invalid data. I would check the title, meta description and heading structure in View Source, test at a narrow width and 200% zoom, and run a link checker and axe or Lighthouse. Anything the tools cannot judge, such as the quality of alt text, I check by hand.

2. Why is automated testing not enough for accessibility?

Tools can only test rules that a machine can measure, such as whether an attribute exists or a contrast ratio is high enough. They cannot tell if alternative text is meaningful, if the reading and focus order make sense, or if instructions are clear. A manual keyboard and screen reader check is still needed.

3. What is the difference between severity and priority?

Severity is how badly a bug affects users or the system, for example a crash versus a spelling error. Priority is how soon the team decides to fix it. A typo in the company name on the home page is low severity but high priority.

4. What should a good bug report contain?

A short, specific title, the page or URL, the environment (browser, device, assistive technology), numbered steps to reproduce, the expected result and the actual result. Add severity and evidence such as a screenshot or the HTML line. It should cover one bug only.

5. What are entry and exit criteria in a test plan?

Entry criteria define when testing can begin, such as "the build is on staging". Exit criteria define when testing is complete, such as "no open critical bugs and zero validator errors". They make the start and end of testing objective rather than a matter of opinion.

Key points

  • Testing finds problems; QA is the process that makes testing happen at the right time and keeps quality high.
  • Test six areas: validity, links, accessibility, SEO tags, responsive layout and forms.
  • Use a repeatable manual checklist, including a keyboard-only pass and narrow-width and zoom checks.
  • Tools such as Nu Html Checker, html-validate, axe, Lighthouse and link checkers are fast but miss meaning.
  • Design form test cases around normal values, empty input and boundaries.
  • A test plan states scope, environments, tools and exit criteria; a bug report gives steps, expected and actual results.

Exercise

Pick any page you built earlier in this course, such as your portfolio. Write a one-screen test plan for it (scope, browsers, widths, tools, exit criteria). Then run the manual checklist from Step 1 and at least two tools from the table. Write a proper bug report for the most serious problem you find, fix it, and retest to confirm the fix.

Show solution

A sample plan for a portfolio page:

Text
Test plan: Portfolio home page (index.html)
Scope:     index.html and its links; contact form front end only
Browsers:  Chrome and Firefox on desktop, Chrome on an Android phone
Widths:    320, 768, 1280 px; 200% zoom
Tools:     Nu Html Checker, axe extension, Lighthouse
Exit:      0 validator errors, no Critical or Major bugs open

Bug report
Title:     Projects section images have no alt text
Steps:     1. Open index.html in Chrome  2. Run axe  3. Inspect the project images
Expected:  each image describes the project, e.g. alt="Weather app for Lucknow"
Actual:    <img src="p1.png"> has no alt; axe reports "Images must have alternate text"
Severity:  Major
Fix:       added descriptive alt text to all three images; axe now reports 0 issues

The key is that the plan has clear exit criteria and that the bug report has exact steps and separate expected and actual results. Retesting after the fix closes the loop.

Quick Quiz

1. Which problem can an automated tool NOT reliably detect?

2. For a 6-digit pincode field, which set of test cases is best?

3. What belongs in the "exit criteria" of a test plan?

4. A bug report says "Form broken, please fix". What is mainly missing?

Learn HTML with a mentor

Free lessons get you started. Our Full Stack Web Development training adds real projects and code reviews from working developers.

  • Project-based learning
  • Mentor code reviews
  • Free counselling call