Skip to content
beskid The Beskid Book

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

08.3 Arrange, act, assert

Structure Beskid tests without importing a ceremony framework from another ecosystem.

Arrange, act, assert

You do not need a Beskid port of xUnit’s 47 base classes. You need readable failure messages when the compiler disagrees with your story.

flowchart LR
  accTitle: Arrange, act, assert
  accDescr: A test arranges inputs, acts by calling the unit under test, then asserts with corelib helpers or explicit checks.
  arrange["Arrange: inputs, fixtures, temp files"]
  act["Act: call the unit under test"]
  assert["Assert: corelib helpers or explicit checks"]
  arrange --> act --> assert
  1. Arrange: build data, configure paths, materialize projects if the test is integration-weight.
  2. Act: one logical operation (parse, resolve, lower, run entrypoint).
  3. Assert: use corelib testing helpers (see corelib Testing docs) or explicit comparisons; failed assertions become test failures, not undefined behavior (Testing spec).
GoodAvoid
One reason to fail per testMega-tests that assert 40 unrelated diagnostics
Descriptive test namestest Foo copy-pasted fourteen times
meta.tags for speed tiersRunning the full compiler graph for “string literal parses”

Test bodies can carry /// docs like other statements when you need to explain why a regression exists. Future you is also a developer.

Integration tests that need multi-file fixtures belong in dedicated Test projects with explicit group prefixes. Push heavy assets to beskid_tests-style layouts in the compiler repo when you are locking platform behavior (Conformance vs unit).

Conformance vs unit