Bwf/ GuideFrançais
Bwf Guide

Testing a Bwf application

Before starting a server, we can already check the Journal’s routes, queries and views. Then we’ll make an HTTP request to check what a reader actually receives.

Check the application before making a request

Run the application check first. A mismatch in a generated route, query or view can show up here before the server starts. Once that passes, run the HTTP tests against the native server or the Bun server.

Django test client

Check one entry

From the checkout, try checking just the account view with the command below. The --entry option selects the module to check. scripts/bwf check stages its BSX and OpenAPI inputs and any TypedSQL reachable from that entry, then typechecks the generated Bend code.

Run this from the checkout to check the account view.

scripts/bwf check --entry examples/canonical/View/Account.bsx

Run the focused OpenAPI tests

For a route edit, start with the focused URL and handler checks. For SQL integration, run tests/run-bend TypedSqlChecks. To check the translation catalogs on both targets, run tests/run-bend I18n. The full scripts/bwf test suite requires a dedicated test database.

Run these commands from the repository root.

tests/run-bend OpenApiTests urls
tests/run-bend OpenApiTests handlers

Check what changes after the response

Assert a normal request and a rejected one. For a write, read back the stored result. Use two accounts when access depends on ownership. For HTMX and Auto Refresh, try direct navigation, a partial update and a reload.

On a running Journal, this checks the body of the health response.

test "$(curl -fsS http://127.0.0.1:18088/healthz)" = ok

Try it in the Journal

Update the Journal in place