Running AL tests in Business Central previously required either the Test Tool page in the web client or the third-party AL Test Runner extension for VS Code. Starting with 2026 release wave 1 (version 28.0), the AL Language extension includes built-in support for the VS Code Test Explorer.
The Test Explorer auto-detects test codeunits and test methods in your workspace, lets you run or debug individual tests, and shows results directly in the IDE.
Prerequisites
- Business Central version 28.0 or newer.
- The AL Language extension for Visual Studio Code (publisher: Microsoft).
- A sandbox environment or local on-premises server for running tests. Production environments are not supported.
No additional extensions are required. The Test Explorer is part of the AL Language extension itself.
Discover Tests
The Test Explorer automatically detects test codeunits and test methods in your active workspace.
- Open the Test Explorer view in VS Code. You can find it in the sidebar under the flask icon, or search for it via the Command Palette (
Ctrl + Shift + P> Test: Focus on Test Explorer View). - Your test codeunits appear in the test list, organized by app, then by codeunit, then by individual test method.
Only tests in the active workspace are shown. If you have a multi-root workspace, tests from all AL projects with test codeunits will appear.
Run Tests
Select a test codeunit or individual test method and choose the Run button.
The Test Explorer supports four run profiles:
| Profile | What it does |
|---|---|
| Publish & Run | Publishes the test project and its dependencies (if changed) before running the selected tests. This is the default profile. |
| Run | Runs the selected tests without publishing first. Use this when your extension is already deployed. |
| Run & Debug | Publishes the project and runs with the debugger attached. Breakpoints in your test code will be hit. |
| Coverage (Procedure) | Runs tests and collects procedure-level code coverage. |
Select the run profile from the dropdown next to the run button, or right-click a test for more options.
View Results
Test results appear in the Test Results panel at the bottom of VS Code. Passed tests show a green check, failed tests show a red X with the error message.
You can also see results inline in the Test Explorer tree view, where each test shows its pass/fail status.
Code Coverage
When you select the Coverage (Procedure) run profile, the test run tracks which procedures and triggers are invoked by each test.
After the run completes, a new CodeLens appears on procedures and triggers that were covered. Clicking this CodeLens re-runs the tests that covered that specific procedure. This is helpful when you change a procedure and want to quickly run the most relevant tests.
Differences from the Test Tool Page
Tests run from VS Code do not execute under an AL test runner codeunit. This has a few implications:
- AI tests are not supported from the Test Explorer.
- Test runner events: If your tests rely on events published in a test runner codeunit for setup or teardown, those events will not fire.
- Isolation level: Determined by the
RequiredTestIsolationproperty set on the test codeunit. If this property is not set, the default is codeunit-level isolation.
If you need test runner codeunit behavior, continue using the Test Tool page in the Business Central web client.
Supported Environments
| Environment type | Supported |
|---|---|
| Online sandbox | Yes |
| Local (on-premises) server | Yes |
| Production | No |
Running tests on production environments is blocked because test execution can affect business operations.
Example: Running a Test
Assuming you have a test codeunit in your project:
codeunit 50100 "My Feature Tests"
{
Subtype = Test;
[Test]
procedure TestCustomerCreation()
var
Customer: Record Customer;
LibrarySales: Codeunit "Library - Sales";
begin
// GIVEN a new customer
LibrarySales.CreateCustomer(Customer);
// THEN the customer exists
Assert.IsTrue(Customer.Find(), 'Customer should exist after creation.');
end;
var
Assert: Codeunit Assert;
}
- Open the Test Explorer in VS Code.
- Expand your app > My Feature Tests > TestCustomerCreation.
- Click the Run button next to the test.
- Check the Test Results panel for the outcome.
For more on writing test codeunits and structuring tests with the GIVEN/WHEN/THEN pattern, see How to Write and Run AL Unit Tests.
For a broader overview of all new features in this release, see What’s New in Business Central 2026 Release Wave 1.