LethAL
Mutation testing for Microsoft Dynamics 365 Business Central AL code. It tells you which of your AL tests actually catch bugs.

Alpha. The tool is honest about its limits rather than complete. See Limits before
quoting a score. Read CHANGELOG.md for what shipped and what did not.
What it does
LethAL makes small, deliberate breakages in your AL code (flips a < to <=, empties a block, drops a TestField, changes a return value), then runs your tests against each one. A test suite that stays green while the code is broken is not protecting you.
The technique is called mutation testing, and it is long established outside the BC world; what
is new here is the AL implementation, not the idea. It answers a question a coverage report cannot:
coverage tells you a line ran, mutation tells you a line is checked. If the line's behaviour
can change and every test still passes, running it proved less than the coverage number suggested.
LethAL calls each deliberate change a mutant. A mutant is killed when one of your tests
fails. Your suite caught it, which is the good outcome. It survives when every test still
passes, which means nothing you have written notices that behaviour. It is no-coverage when no
test runs that code at all. The share your tests killed is the mutation score.
Your source tree is never modified. LethAL copies your project into a scratch directory under
the OS temp dir, changes the copy there, compiles that, and publishes it. There is nothing to
revert. A clean run removes that directory at the end; a run that fails or is quarantined keeps it
and prints its path, since its files name the cause. What does persist is on the server: the modified build stays published until you
republish your own app (see Restoring your app after a run),
which is why LethAL is for a sandbox or dev container, never a production tenant. lethal run never modifies or publishes your test project. lethal verify compiles and publishes it once per call that runs a survivor, and leaves it installed; to put your own test app back, republish it the way you normally do (for the target app, see Restoring your app after a run).
Prerequisites
The lethal binary itself needs no Bun, Node or npm to run. (The sample mcpCommand below,
["bun", "x", "bc-dev-mcp"], does start Bun when the bcdev backend runs, so Bun must be on your
PATH for that one. A different mcpCommand removes the need.) For the bcdev backend you need:
- A Business Central container, dev server, or hosted sandbox, which must be single-tenant (see Limits)
- The AL Language VS Code extension, which supplies
alc and altool (LethAL picks the bin/
build matching your host: Windows, Linux or macOS)
- or
bcdev.alcPath / bcdev.altoolPath in your config pointing at any alc / altool, if
your server needs specific tool builds. The two are independent: they may name different
builds, and together they replace the extension install entirely
- For the
bcdev backend: bc-dev-mcp. You do not host or start anything. LethAL runs it for you.
You name the command in your config (bcdev.mcpCommand, e.g. ["bun", "x", "bc-dev-mcp"]) and
each run spawns its own
- The
LethAL Control extension published on your server. It is a small AL app that lives in this
repo; step 2 of Quick start builds and publishes it
The offline al-runner-v3 backend needs no BC server at all; see
Running without a BC server.
Building from source needs:
- Bun 1.x
- Rust 1.96 or newer (install it with rustup), and a C linker (
cc; on Debian
and Ubuntu, apt install build-essential)
- clang/LLVM 23.1.2. If you do not have it,
bash scripts/install-llvm.sh <platform-key> installs it
(for example linux-x64) under ${TMPDIR:-/tmp}/llvm-23.1.2, which some reboots clear (set TMPDIR
to a folder you keep first). Its last line is the export LLVM_BIN=... to run next
Installation
There is no published release yet, so build it yourself. This produces a standalone lethal
executable in build/ that needs no Bun, Node or npm to run. The parser LethAL uses is a native
add-on that you build first; bun run build:binary refuses to run without it: