Design a repeatable testing strategy
The review-policy scenario needs more than a collection of test scripts. A testing strategy connects each release risk to a repeatable check and determines where standard tests, custom automated tests, and guided human actions provide the strongest evidence.
Choose the right level of automation
Automated testing runs without decisions or input from a person. An AL test codeunit creates its data, invokes application logic, handles expected dialogs, and verifies the result. Automated tests fit stable rules that must run often, such as blocking a review when a comment is empty.
Semiautomated testing combines automation with deliberate human actions. A developer or tester selects relevant suites, prepares an environment, starts a run, and investigates failures. The individual tests remain automated, but suite selection and failure triage depend on knowledge of the change. This approach works well for extension validation because a complete Business Central test library can be broader than the affected area.
Use three complementary test scopes:
Run standard application tests for the Business Central areas that the extension touches.
Run extension tests for rules and event subscribers introduced by the customization.
Perform exploratory checks for usability, visual behavior, and unexpected interactions that aren't economical to automate.
For the review policy, standard customer tests help detect unintended effects on customer behavior. Focused tests prove the new comment requirement. A brief page-level check confirms that messages and controls make sense to a user.
Convert risks into observable cases
Start with a requirement, a corrected defect, or an affected integration point. Express each risk as an observable behavior rather than an implementation detail. The review policy produces at least these cases:
A review with a nonblank comment succeeds and sets the reviewed state.
A review with a blank comment fails with the expected error.
A declined confirmation leaves the record unreviewed.
A second run starts from known data and produces the same result.
Structure every case as arrange, act, and assert:
Arrange only the data and configuration that the behavior needs.
Act through the same public procedure or event path that production code uses.
Assert the business outcome, persisted state, or expected error.
An assertion should identify the failed expectation. Reviewed must be true after confirmation gives more useful evidence than Test failed. Avoid checking internal variables when a record state or return value represents the requirement more directly.
Make test data deterministic
A deterministic test produces the same result when its inputs and product version don't change. It doesn't depend on records that a previous test created, a particular work date, the next value in a number series, or the order in which tests run.
Apply these practices:
Create the smallest required data set inside each test or its initialization procedure.
Generate unique keys under test control instead of assuming that a key is unused.
Set dates, dimensions, and setup values explicitly when they affect the result.
Use library codeunits for common Business Central data creation when the test app references the appropriate test libraries.
Keep one behavioral reason for failure in each test procedure.
Avoid broad cleanup routines as the primary isolation mechanism. Transaction rollback and test isolation provide stronger boundaries, while explicit setup keeps intent visible. Cleanup remains useful for operations outside the database transaction, but a test shouldn't silently depend on cleanup from another test.
Plan isolation and diagnostics
Business Central test execution provides two related controls. A test method's TransactionModel attribute defines its transaction behavior. A test runner's TestIsolation property controls the boundary used when that runner executes tests. Select the narrowest model that supports the behavior, and treat commits as an exception that needs a documented reason.
Plan interactive handling before implementation. If production code opens a confirmation, message, page, report, or request page, the test needs the matching handler function. A handler supplies the response and can verify prompt text. Unhandled UI makes an automated test fail instead of waiting for input.
For negative tests, identify both the operation that must fail and the diagnostic that proves it failed for the intended reason. AssertError marks an error as expected. GetLastErrorText retrieves the captured message, which you compare with the intended error. Clear the previous error before the action so stale state doesn't mask a problem.
The resulting strategy is a compact release record: affected areas, selected standard suites, custom cases, environment version, results, and investigated failures. This record makes a semiautomated run reproducible without pretending that suite selection and triage require no judgment.
For more background, see Testing the application and Create test runner codeunits.