mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-08-08 02:16:52 +01:00
- Introduced `al-test-writer` to generate AL test codeunits for production objects based on TDD principles. - Added `al-userguide-test-writer` to create test codeunits from user guide steps, mapping actions and assertions. - Implemented `bc-extension-test-guide` to generate a comprehensive TEST_GUIDE.md for Business Central extensions, covering various categories. - Created `bc-webclient-runner` to automate UI testing of the Business Central web client, capturing screenshots and asserting UI states. - Developed `page-scripting-e2e` to produce a recording plan for Page Scripting, ensuring a structured approach to browser-level testing.
32 lines
1.5 KiB
AL
32 lines
1.5 KiB
AL
// Anti-pattern: a new id minted at a downstream hop, and an outbound call with no correlation
|
|
// header. Nothing ties the inbound message, this processing step, and the external system's
|
|
// logs together. Tracing a failure becomes correlation-by-timestamp guesswork.
|
|
|
|
codeunit 50192 "Outbound Step Bad"
|
|
{
|
|
procedure Send(var IntegrationMessage: Record "Integration Message")
|
|
var
|
|
Client: HttpClient;
|
|
Request: HttpRequestMessage;
|
|
Headers: HttpHeaders;
|
|
Response: HttpResponseMessage;
|
|
LocalTrace: Guid;
|
|
begin
|
|
// BAD: a brand-new id, unrelated to IntegrationMessage."Correlation ID". The entry point
|
|
// already minted the flow's trace id; minting another one here breaks the chain just as
|
|
// thoroughly as having none, because the two halves now log different identifiers.
|
|
LocalTrace := CreateGuid();
|
|
|
|
// This trace value appears in no other component's logs, so it joins to nothing.
|
|
LogStep('sending', Format(LocalTrace));
|
|
|
|
Request.SetRequestUri('https://svc.contoso.com/api/orders');
|
|
Request.Method := 'POST';
|
|
Request.GetHeaders(Headers);
|
|
|
|
// BAD: no Correlation-Id header at all. The receiver logs the call under its own ids, and
|
|
// there is no shared value to join the external system's logs back to this flow. When this
|
|
// POST fails three hops into a busy system, reconstructing what happened is archaeology.
|
|
Client.Send(Request, Response);
|
|
end;
|
|
}
|