Testing
Testing in Business Central covers writing AL tests (test codeunits, methods, test pages, handlers, test runners), running them in Visual Studio Code, mocking HttpClient calls, performance testing, and UI acceptance testing with page scripting. It answers how-to and setup questions for testing apps.
- 11Learn pages
- 1videos
Path: Development > Development environment > Testing · tier official · system administration · narrative reviewed (checked by Opus)
Overview
The section describes how to build and run automated tests for Business Central apps. It starts with an overview of application testing, then goes into the building blocks: test codeunits and test methods, test pages that simulate user interaction, handler methods that intercept messages, confirmations, pages, reports and notifications, and test runner codeunits that control execution and logging.
Further pages cover running tests. Test Explorer in Visual Studio Code discovers and runs AL tests with run profiles and code coverage. The page scripting tool records and replays web client interactions for acceptance testing, and the Performance Toolkit extension simulates workloads to find performance regressions. A separate page explains how to mock outbound HttpClient calls during tests, which is available on-premises only. A worked example for purchase invoice discounts shows the pieces together, and an FAQ lists what testing an app needs.
Start with the testing overview, then the test codeunits and test pages articles, and use the purchase invoice discount example as a template. Go to the FAQ for testing expectations such as country and upgrade testing.
Key points
- Test codeunits and test methods use attributes such as TransactionModel and TestDataSource, plus the TestIsolation and TestHandlers properties.
- Handler methods (MessageHandler, ConfirmHandler, StrMenuHandler, PageHandler, ModalPageHandler, ReportHandler) replace user interaction in automated tests.
- Test runner codeunits use the TestRunner subtype with OnRun, OnBeforeTestRun and OnAfterTestRun triggers for unattended runs and result logging.
- Test pages simulate user actions: reading and changing fields, filtering, invoking actions, and navigating records.
- Mocking outbound HttpClient calls uses HttpClientHandler and HandlerFunctions attributes and request policies; it is available on-premises only.
- Test Explorer in Visual Studio Code supports test discovery, run profiles, code coverage and debugger use; the page is tagged with 2026 release wave 1 (version 28.0).
- The page scripting tool records and replays web client interactions, supports validation, conditional and wait steps and parameters, and runs in pipelines with bc-replay.
- The Performance Toolkit lets ISVs and VARs simulate concurrent sessions, compare to baselines, and report through telemetry and Power BI.
Learn pages
- Application Testing Example to Test Purchase Invoice Discounts: Example to demonstrate the application testing scenario.
- Create Handler Methods for Automated Tests: Create test codeunits, test methods, and test pages to test your application. To automate tests, create special handler methods for UI interactions.
- Create Test Runner Codeunits in AL: Learn how to create test runner codeunits in AL to manage the execution of test codeunits and integrate with test management or test reporting frameworks.
- FAQ about Testing your Business Central App: Get answers to some of your questions about testing when you build an app for Dynamics 365 Business Central
- Mock outbound HttpClient web service calls during testing: Learn about how to test HttpClient web calls to external services without invoking the live/actual/remote service.
- Performance Toolkit extension: Test your extensions for performance regressions during the development process for Business Central apps.
- Run AL Tests in Visual Studio Code: Learn how to use the Test Explorer in Visual Studio Code to discover and run AL tests for Business Central directly from the IDE.
- Test Codeunits and Test Methods in AL: Learn how to create test codeunits and test methods in AL, set the SubType property to Test, and use the different test method attributes in Business Central.
- Test pages: This article explains the Test pages, their purpose and use.
- Testing the application overview: Learn about how to use automated tests in Business Central
- Use the page scripting tool for acceptance testing: Learn how to record, edit, replay, and automate page scripts in Business Central to validate business processes and user acceptance tests.
Videos and posts
Linked by a Haiku matcher with a grounding quote from the item’s summary (link/topics.ts); machine-generated.
- In Preview: User Acceptance Testing with the Page Scripting Tool (2024 release wave 1) (video): “user acceptance testing; page scripting tool; script recording and playback”
Business Central pages and reports
The pages, reports and queries this hub’s Learn pages name (ms.search.form, API reference), joined to the code by exact object id (data/index/docs-objects.json); a page shows the table it runs on.
Learn also names 9 objects with no object page: page/149000, page/149001, page/149003, page/149004, page/149005, page/149006, page/149007, page/149008, page/149009.
Source: Microsoft Learn (CC BY 4.0). Descriptions are Learn’s own.
What Learn documents here 8 of 11 Learn pages
- learnApplication Testing Example to Test Purchase Invoice Discounts2026-08-24
- learnCreate Handler Methods for Automated Tests2026-08-24
- learnCreate Test Runner Codeunits in AL2026-08-24
- learnFAQ about Testing your Business Central App2022-08-15
- learnMock outbound HttpClient web service calls during testing2025-03-17
- learnPerformance Toolkit extension2024-02-21
- learnRun AL Tests in Visual Studio Code2026-03-05
- learnTest Codeunits and Test Methods in AL2026-08-24