Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#437 Expose an event to skip suite errors #495

Merged
merged 12 commits into from
Feb 26, 2024
12 changes: 12 additions & 0 deletions src/Tools/Performance Toolkit/App/src/BCPTLine.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,12 @@ codeunit 149005 "BCPT Line"
var
BCPTLogEntry: Record "BCPT Log Entry";
BCPTRoleWrapperImpl: Codeunit "BCPT Role Wrapper"; // single instance
Handled: Boolean;
begin
OnBeforeAddLogEntry(BCPTLine, Operation, ExecutionSuccess, Message, handled);
NAVFreak marked this conversation as resolved.
Show resolved Hide resolved

if Handled then
exit;
NAVFreak marked this conversation as resolved.
Show resolved Hide resolved
BCPTLine.Testfield("BCPT Code");
BCPTRoleWrapperImpl.GetBCPTHeader(BCPTHeader);
Clear(BCPTLogEntry);
Expand Down Expand Up @@ -346,4 +351,11 @@ codeunit 149005 "BCPT Line"
Parm := format(FldRef.Value, 0, 9);
exit(true);
end;

local procedure OnBeforeAddLogEntry(var BCPTLine: Record "BCPT Line"; var Operation: Text; var ExecutionSuccess: Boolean; var Message: Text; var Handled: Boolean)
NAVFreak marked this conversation as resolved.
Show resolved Hide resolved
var
BCPTTestSuite: Codeunit "BCPT Test Suite";
begin
BCPTTestSuite.OnBeforeBCPTLineAddLogEntryWrapper(BCPTLine, Operation, ExecutionSuccess, Message, Handled);
NAVFreak marked this conversation as resolved.
Show resolved Hide resolved
end;
}
32 changes: 32 additions & 0 deletions src/Tools/Performance Toolkit/App/src/BCPTTestSuite.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -411,4 +411,36 @@ codeunit 149006 "BCPT Test Suite"
BCPTLine.SetRange("BCPT Code", SuiteCode);
BCPTLine.SetRange("Codeunit ID", CodeunitID);
end;

#region BCPTLineCodunitFacade
/// <summary>
/// Wrapper for OnBeforeBCPTLineAddLogEntry since it is not possible subscribe to an event in a object with scope internal
/// This one converts BCPTLine to variables instead of a record.
/// </summary>
/// <param name="BCPTLine"></param>
/// <param name="Operation"></param>
/// <param name="ExecutionSuccess"></param>
/// <param name="Message"></param>
/// <param name="Handled"></param>
internal procedure OnBeforeBCPTLineAddLogEntryWrapper(var BCPTLine: Record "BCPT Line"; var Operation: Text; var ExecutionSuccess: Boolean; var Message: Text; var Handled: Boolean)
NAVFreak marked this conversation as resolved.
Show resolved Hide resolved
begin
OnBeforeBCPTLineAddLogEntry(BCPTLine."BCPT Code", BCPTLine."Codeunit ID", BCPTLine.Description, Operation, ExecutionSuccess, Message, Handled);
end;

/// <summary>
/// This event is raised before a log entry is added to the BCPT Line table.
/// It can be used to skip errors which are not relevant for the test suite. Like unused handler functions.
/// </summary>
/// <param name="SuiteCode"></param>
/// <param name="CodeunitId"></param>
NAVFreak marked this conversation as resolved.
Show resolved Hide resolved
/// <param name="Description"></param>
/// <param name="Operation"></param>
/// <param name="ExecutionSuccess"></param>
/// <param name="Message"></param>
NAVFreak marked this conversation as resolved.
Show resolved Hide resolved
/// <param name="Handled"></param>
[IntegrationEvent(false, false)]
local procedure OnBeforeBCPTLineAddLogEntry(SuiteCode: Code[10]; CodeunitId: Integer; Description: Text; var Operation: Text; var ExecutionSuccess: Boolean; var Message: Text; var Handled: Boolean)
begin
end;
#endregion BCPTLineCodunitFacade
}
Loading