bcquality/microsoft/knowledge/testing/bcpt-scenarios-must-be-app-specific.md
Michael Dieringer a4d85c3e9e Add 18 more community AL/BC patterns across appsource, data-modeling, error-handling, security, style, testing, ui, upgrade, and web-services
Second contribution from CURABIS ApS, generalized from patterns observed across real AppSource/PTE development. Cross-checked against the current microsoft/knowledge corpus before opening; several originally-drafted candidates were dropped as duplicates of existing files.
2026-09-21 22:42:49 +02:00

1.7 KiB

bc-version domain keywords technologies countries application-area
all
testing
bcpt
performance-test
scenarios
app-specific
regression
al
w1
all

Include app-specific scenarios in a PerformanceTest app's BCPT suite

Description

A PerformanceTest app that ships with only the generic Microsoft BCPT samples (creating sales orders, purchase orders, posting item journals) measures Business Central's own baseline performance, not the extension it was built to test. Those samples are starting points, not coverage. Without a scenario that exercises the extension's own business flow — its own codeunits, its own FlowFields, its own page rendering — a performance regression introduced by the extension has no test that would ever detect it.

Best Practice

For every major business flow the extension adds, create a matching BCPT* scenario codeunit: SingleInstance = true, implementing "BCPT Test Param. Provider", wrapping the operation under test in BCPTTestContext.StartScenario() / EndScenario(), and building its own test data in a local InitTest() procedure rather than depending on hardcoded records. Give each distinct step its own named scenario so a regression in one step doesn't hide inside a coarser measurement.

See sample: bcpt-scenarios-must-be-app-specific.good.al.

Anti Pattern

A PerformanceTest app whose only scenario codeunits are copies of Microsoft's shipped samples (creating a standard sales order, opening the standard customer list) tests the platform, not the extension. Any regression in the extension's own posting logic, calculations, or pages goes unmeasured and unnoticed.

See sample: bcpt-scenarios-must-be-app-specific.bad.al.