Testing reference

Testing Library

Test UI behavior through roles, labels and interactions that resemble real use.

Web DevelopmentFree accessFoundations first

Where This Fits

Use Testing Library to ask questions a visitor would ask: where is the search field, which button saves the form, and what feedback appeared? Prefer accessible names and roles over fragile selectors that describe incidental markup.

Keep the behavior under test visible. Fill a control, perform an action and assert the result a person can perceive. If changing an internal variable breaks a test while the interface still behaves correctly, reconsider what the test is coupled to.

Before You Start

  • Basic DOM or component development
  • A test runner and matching library package

What to Focus On

  • Queries based on roles and labels
  • User-centered interaction tests
  • Observable success and error states

Put It into Practice

Test a bookmark form with a visible label. Submit valid and missing input, check the displayed feedback and verify that the saved-item count reflects the result.

Check Your Understanding

  • Locate controls by meaningful names
  • Test an invalid path
  • Explain what the test cannot establish

Access and Limits

The libraries and documentation are free. Simulated DOM tests cannot prove every layout, rendering or browser-specific behavior; use browser checks where needed.

Using It Offline

Prepared libraries and local fixtures run offline; installing packages or reading hosted documentation needs internet.

Check the official source

Follow the learning path
HACKTRONIAN_CLI // COMMAND PALETTE
QUICK_EXEC: