Testing
Testing best practices for Business Central extensions: how to build and test a sample Customer Rewards extension with the Application Test Toolkit, and what testing is required before submitting an extension to Marketplace validation. It answers questions about test codeunits, UI handlers, mocking, and pre-submission checks.
Path: Development > Rules, guidelines, and best practices > Best practices > Testing · tier official · system development · narrative unreviewed (model text not yet checked)
Overview
This section covers testing for Business Central extensions from two angles. Two pages walk through a worked example: one builds an advanced sample extension called Customer Rewards, and the other tests it. The third page lists the testing requirements and procedures developers must follow before they submit an extension to Marketplace validation.
The build walkthrough uses codeunits, tables, pages, events and an Assisted Setup wizard. It includes testing hooks exposed through event publishers. The test page then uses the Application Test Toolkit. It covers test codeunits, test pages, UI handlers, and mocking of external service calls.
Start with “Building an Advanced Sample Extension” and “Test the advanced sample extension” if you want to learn the patterns. Go to “Testing your extension” if you are preparing a submission and need the checklist.
Key points
- Building an Advanced Sample Extension creates a Customer Rewards extension with codeunits, tables, pages, events and an Assisted Setup wizard.
- The sample uses event publishers and subscribers, table extensions, page extensions and installation logic.
- Event publishers in the sample provide testing hooks.
- Testing the sample uses the Application Test Toolkit with test codeunits and test pages.
- UI interactions in tests are handled with MessageHandler, ConfirmHandler and StrMenuHandler.
- External service calls are mocked in the sample’s tests.
- Testing your extension lists the requirements before Marketplace validation: testing in an online environment, code signing, installation verification, user permission testing, demo data import and republish testing.
Learn pages
- Building an Advanced Sample Extension: Build an advanced Customer Rewards extension in AL for Business Central, using tables, pages, events, and installation code to prepare for tests.
- In the observatory: Codeunit 414 “Release Sales Document”, Page 21 “Customer Card”, Page 22 “Customer List”, Table 18 “Customer”
- Test the advanced sample extension: Includes test code for the advanced example extension.
- Testing your extension: Describing the steps you must go through to successfully submit your app to Marketplace.
Videos, posts and code changes
Linked by a Haiku matcher with a grounding quote from the item’s summary (link/topics.ts); machine-generated.
- #13326 [Fabric] Clean up test events, app naming, authentication and telemetry (code change): “Five test-only IsHandled events in Fabric Platform Mgt are now internal”
- #132 Refine self-improvement review guidance (code change): “UI handler tests allowed to use semantic capture/reset/assert patterns”
- #158 3 AL/BC patterns from CURABIS’s internal automated-testing training material (code change): “Use TestPage field .Visible()/.Enabled() to verify UI rendering state”
- #159 3 AL/BC testing patterns from an external BC testing expert’s blog (Luc van Vugt, fluxxus.nl) (code change): “Table Relation Test hook was checked against BCApps source”
- #202 Restore deterministic review fixture coverage (code change): “Registers 23 paired knowledge articles across data modeling, error handling, performance, security, style, testing, UI, upgrade and web services”
- #279 knowledge(testing): a changed permission set needs a test that runs an allowed operation under it (code change): “a test must lower the context to it, run an allowed operation and assert the result”
- #96 Add missing AL review leaf skills (code change): “Four new AL code review leaf skills were added to cover testing, data modeling, AppSource, and telemetry”
- Weekly Review: Business Central AL Development – May 24–30, 2026 (community post): “AL unit tests can run independently of the base app by structuring logic as a sub-extension”
- Your Tests All Pass. I Have Bad News. (community post): “mutation testing shows whether a test would notice that line breaking”
- AL Runner: Run AL Unit Tests Without a BC Service Tier (community post): “Test execution runs in seconds compared to 15-30 minute container-based pipelines”
Source: Microsoft Learn (CC BY 4.0). Descriptions are Learn’s own.