Operating
Testing
Unit, integration and browser tests, and the commands that run them.
Commands
make test # everything: unit, integration and browser tests
make check # generate, format, vet and test
make e2e-install # once: the Chromium that the browser tests driveLayers
- Unit tests sit next to their packages: services, validators, helpers, the CSRF middleware.
- Integration tests call the real routes and middleware through httptest on a throwaway database: a temporary SQLite file, or a fresh database on your Postgres or MySQL server.
- Browser tests (build tag e2e) drive Chromium with Playwright-Go, one browser for the run and a fresh context per test. They check focus rings, the toast region, that no third-party request is made, that nothing scrolls sideways, that the page loads without JavaScript, and an axe accessibility scan when axe-core is available.
A plain go test ./... runs only the unit and integration tests and needs no browser. Projects created with --e2e=false have no browser tests at all. Point the generic checks in e2e_generic_test.go at your own pages as the app grows: they only load the home page at first.
Was this page helpful?
Be the first to answer.