Testing
Testing best practices for Business Central extensions: a Customer Rewards sample extension built and then tested with the Application Test Toolkit, plus the testing steps required before Marketplace validation. It answers questions about writing test codeunits and about pre-submission checks.
Path: Development > Rules, guidelines, and best practices > Best practices > Testing · tier official · system development · narrative reviewed (checked by Opus)
Overview
This section covers testing extensions from two angles. Two pages follow one sample, a Customer Rewards extension. The first builds it with tables, table extensions, pages, page extensions, codeunits and events, and adds assisted setup, activation codes and reward levels. The second tests that sample with the Application Test Toolkit.
The third page is about submission. It lists what developers must test before sending an extension to Marketplace validation, including online environment testing, code signing, installation, user permissions, demo data and republishing.
Start with “Building an Advanced Sample Extension” to get the sample in place, then read “Test the advanced sample extension” for the test patterns. Use “Testing your extension” as a checklist before submitting.
Key points
- The Customer Rewards sample adds reward level tracking to customers and shows how to develop, test and publish an extension.
- The sample uses tables, table extensions, pages, page extensions, codeunits, events, assisted setup and activation codes.
- Tests use the Application Test Toolkit with test codeunits and test methods.
- The testing walkthrough covers UI handlers, test pages, the asserterror statement and mock event subscribers.
- It also shows how to validate business logic in the sample.
- Before Marketplace validation, test in an online environment and verify code signing and installation.
- Pre-submission checks also include user permission testing, demo data import and republish testing.
Learn pages
- Building an Advanced Sample Extension: Includes code for an advanced example extension using Business Central and AL in Visual Studio Code.
- 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.
- #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”
- #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”
Source: Microsoft Learn (CC BY 4.0). Descriptions are Learn’s own.