Testing
Anvil supports several testing layers.
Unit Tests
Section titled “Unit Tests”Test domain code directly. Pure business logic tests can run without Anvil.
Generated Wiring Tests
Section titled “Generated Wiring Tests”Use app.Wire(anvilgen.Wiring()) in tests when you want explicit generated
wiring.
transport := httpstd.New()app := anvil.New( httpstd.DriverFrom(transport), anvil.WithProviders(anvil.As[project.Store](fakeStore)),)
if err := app.Wire(anvilgen.Wiring()); err != nil { t.Fatal(err)}Testbeds
Section titled “Testbeds”Use testbeds for route-level protocol assertions generated or scripted from the manifest.
Performance Tests
Section titled “Performance Tests”Use benchmarks when you need latency, allocation, throughput, or profiling data. The performance guide explains the core engine benchmarks, golden backend benchmarks, live HTTP/2 concurrency runs, and profiling commands.
Compiler Tests
Section titled “Compiler Tests”If you write custom Starlark rules, test them with fixtures. A rule that blocks generation needs clear diagnostics and stable output.