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
26 changes: 22 additions & 4 deletions src/Tools/Performance Toolkit/App/src/BCPTLine.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,14 @@ codeunit 149005 "BCPT Line"
var
BCPTLogEntry: Record "BCPT Log Entry";
BCPTRoleWrapperImpl: Codeunit "BCPT Role Wrapper"; // single instance
IsHandled: Boolean;
ValuesAreChanged: Boolean;
BCPTTestSuite: Codeunit "BCPT Test Suite";
ModifiedMessage, ModifiedOperation : Text;
NAVFreak marked this conversation as resolved.
Show resolved Hide resolved
ModifiedExecutionSuccess: Boolean;
begin
BCPTTestSuite.OnBeforeBCPTLineAddLogEntry(BCPTLine."BCPT Code", BCPTLine."Codeunit ID", BCPTLine.Description, Operation, ExecutionSuccess, Message, IsHandled, ValuesAreChanged);
if IsHandled then
exit;
InitValuesSubscriberCanModify(Operation, ExecutionSuccess, Message, ModifiedExecutionSuccess, ModifiedMessage, ModifiedOperation);
BCPTTestSuite.OnBeforeBCPTLineAddLogEntry(BCPTLine."BCPT Code", BCPTLine."Codeunit ID", BCPTLine.Description, Operation, ExecutionSuccess, Message, ModifiedOperation, ModifiedExecutionSuccess, ModifiedMessage);
UpdateValuesFromSubscribers(Operation, ExecutionSuccess, Message, ModifiedExecutionSuccess, ModifiedMessage, ModifiedOperation);
NAVFreak marked this conversation as resolved.
Show resolved Hide resolved

BCPTLine.Testfield("BCPT Code");
BCPTRoleWrapperImpl.GetBCPTHeader(BCPTHeader);
Expand Down Expand Up @@ -238,6 +239,23 @@ codeunit 149005 "BCPT Line"
Dimensions)
end;

local procedure UpdateValuesFromSubscribers(var Operation: Text; var ExecutionSuccess: Boolean; var Message: Text; var ModifiedExecutionSuccess: Boolean; var ModifiedMessage: Text; var ModifiedOperation: Text)
begin
if ModifiedExecutionSuccess <> ExecutionSuccess then
ExecutionSuccess := ModifiedExecutionSuccess;
if ModifiedMessage <> Message then
Message := ModifiedMessage;
if ModifiedOperation <> Operation then
Operation := ModifiedOperation;
end;

local procedure InitValuesSubscriberCanModify(var Operation: Text; var ExecutionSuccess: Boolean; var Message: Text; var ModifiedExecutionSuccess: Boolean; var ModifiedMessage: Text; var ModifiedOperation: Text)
NAVFreak marked this conversation as resolved.
Show resolved Hide resolved
NAVFreak marked this conversation as resolved.
Show resolved Hide resolved
begin
ModifiedMessage := Message;
ModifiedOperation := Operation;
ModifiedExecutionSuccess := ExecutionSuccess;
end;

procedure UserWait(var BCPTLine: Record "BCPT Line")
var
BCPTRoleWrapperImpl: Codeunit "BCPT Role Wrapper"; // single instance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,13 +419,14 @@ codeunit 149006 "BCPT Test Suite"
/// <param name="SuiteCode">The test suite code</param>
/// <param name="CodeunitId">The id of the test codunit that is being run</param>
/// <param name="Description">Description of the test on the "BCPT Line"</param>
/// <param name="Operation">Which operation that is currently executed</param>
/// <param name="ExecutionSuccess">If the test succedded or not</param>
/// <param name="Message">Message in the log entry</param>
/// <param name="IsHandled">Handled pattern parameter</param>
/// <param name="ValuesAreChanged">Specifies if the values has been modified</param>
/// <param name="Orig. Operation">Original operation that is currently executed</param>
/// <param name="Orig. ExecutionSuccess">The original ExecutionSuccess</param>
/// <param name="Orig. Message">The original message</param>
/// <param name="Operation">Replacement operation that is currently executed</param>
/// <param name="ExecutionSuccess">Replacement ExcecutionSuccess</param>
/// <param name="Message">Replacement Message</param>
[IntegrationEvent(false, false)]
procedure OnBeforeBCPTLineAddLogEntry(SuiteCode: Code[10]; CodeunitId: Integer; Description: Text; var Operation: Text; var ExecutionSuccess: Boolean; var Message: Text; var IsHandled: Boolean; var ValuesAreChanged: Boolean)
procedure OnBeforeBCPTLineAddLogEntry(SuiteCode: Code[10]; CodeunitId: Integer; Description: Text; "Orig. Operation": Text; "Orig. ExecutionSuccess": Boolean; "Orig. Message": Text; var Operation: Text; var ExecutionSuccess: Boolean; var Message: Text)
begin
end;
}
Loading