diff --git a/src/Tools/Performance Toolkit/App/src/BCPTLine.Codeunit.al b/src/Tools/Performance Toolkit/App/src/BCPTLine.Codeunit.al index ee7e5c7a3d..f89a9c884e 100644 --- a/src/Tools/Performance Toolkit/App/src/BCPTLine.Codeunit.al +++ b/src/Tools/Performance Toolkit/App/src/BCPTLine.Codeunit.al @@ -164,7 +164,19 @@ codeunit 149005 "BCPT Line" var BCPTLogEntry: Record "BCPT Log Entry"; BCPTRoleWrapperImpl: Codeunit "BCPT Role Wrapper"; // single instance + BCPTTestSuite: Codeunit "BCPT Test Suite"; + ModifiedOperation: Text; + ModifiedExecutionSuccess: Boolean; + ModifiedMessage: Text; + EntryWasModified: Boolean; begin + ModifiedOperation := Operation; + ModifiedExecutionSuccess := ExecutionSuccess; + ModifiedMessage := Message; + BCPTTestSuite.OnBeforeBCPTLineAddLogEntry(BCPTLine."BCPT Code", BCPTLine."Codeunit ID", BCPTLine.Description, Operation, ExecutionSuccess, Message, ModifiedOperation, ModifiedExecutionSuccess, ModifiedMessage); + if (Operation <> ModifiedOperation) or (ExecutionSuccess <> ModifiedExecutionSuccess) or (Message <> ModifiedMessage) then + EntryWasModified := true; + BCPTLine.Testfield("BCPT Code"); BCPTRoleWrapperImpl.GetBCPTHeader(BCPTHeader); Clear(BCPTLogEntry); @@ -173,18 +185,25 @@ codeunit 149005 "BCPT Line" BCPTLogEntry."BCPT Line No." := BCPTLine."Line No."; BCPTLogEntry.Version := BCPTHeader.Version; BCPTLogEntry."Codeunit ID" := BCPTLine."Codeunit ID"; - BCPTLogEntry.Operation := copystr(Operation, 1, MaxStrLen(BCPTLogEntry.Operation)); + BCPTLogEntry.Operation := CopyStr(ModifiedOperation, 1, MaxStrLen(BCPTLogEntry.Operation)); + BCPTLogEntry."Orig. Operation" := CopyStr(Operation, 1, MaxStrLen(BCPTLogEntry."Orig. Operation")); BCPTLogEntry.Tag := BCPTRoleWrapperImpl.GetBCPTHeaderTag(); BCPTLogEntry."Entry No." := 0; BCPTLogEntry."Test Company Name" := BCPTHeader."Test Company Name"; - if ExecutionSuccess then + if ModifiedExecutionSuccess then BCPTLogEntry.Status := BCPTLogEntry.Status::Success else begin BCPTLogEntry.Status := BCPTLogEntry.Status::Error; BCPTLogEntry."Error Call Stack" := CopyStr(GetLastErrorCallStack, 1, MaxStrLen(BCPTLogEntry."Error Call Stack")); end; + if ExecutionSuccess then + BCPTLogEntry."Orig. Status" := BCPTLogEntry.Status::Success + else + BCPTLogEntry."Orig. Status" := BCPTLogEntry.Status::Error; + BCPTLogEntry.Message := CopyStr(ModifiedMessage, 1, MaxStrLen(BCPTLogEntry.Message)); + BCPTLogEntry."Orig. Message" := CopyStr(Message, 1, MaxStrLen(BCPTLogEntry."Orig. Message")); + BCPTLogEntry."Log was Modified" := EntryWasModified; BCPTLogEntry."No. of SQL Statements" := NumSQLStatements; - BCPTLogEntry.Message := copystr(Message, 1, MaxStrLen(BCPTLogEntry.Message)); BCPTLogEntry."End Time" := EndTime; BCPTLogEntry."Start Time" := StartTime; BCPTLogEntry."Duration (ms)" := BCPTLogEntry."End Time" - BCPTLogEntry."Start Time"; diff --git a/src/Tools/Performance Toolkit/App/src/BCPTLogEntries.Page.al b/src/Tools/Performance Toolkit/App/src/BCPTLogEntries.Page.al index 07ab8aa8f2..d269530993 100644 --- a/src/Tools/Performance Toolkit/App/src/BCPTLogEntries.Page.al +++ b/src/Tools/Performance Toolkit/App/src/BCPTLogEntries.Page.al @@ -86,12 +86,25 @@ page 149003 "BCPT Log Entries" ToolTip = 'Specifies the single operation of the BCPT.'; ApplicationArea = All; } + field("Orig. Operation"; Rec."Orig. Operation") + { + ToolTip = 'Specifies the original operation of the BCPT.'; + Visible = false; + ApplicationArea = All; + } field(Message; Rec.Message) { Caption = 'Message'; ToolTip = 'Specifies when the message from the test.'; ApplicationArea = All; } + field("Orig. Message"; Rec."Orig. Message") + { + Caption = 'Orig. Message'; + Visible = false; + ToolTip = 'Specifies the original message from the test.'; + ApplicationArea = All; + } field(DurationMin; Rec."Duration (ms)") { Caption = 'Duration (ms)'; @@ -110,6 +123,13 @@ page 149003 "BCPT Log Entries" ToolTip = 'Specifies the status of the iteration.'; ApplicationArea = All; } + field("Orig. Status"; Rec."Orig. Status") + { + Caption = 'Orig. Status'; + Visible = false; + ToolTip = 'Specifies the original status of the iteration.'; + ApplicationArea = All; + } field("Error Call Stack"; Rec."Error Call Stack") { Caption = 'Call stack'; @@ -121,7 +141,13 @@ page 149003 "BCPT Log Entries" Message(Rec."Error Call Stack"); end; } - + field("Log was Modified"; Rec."Log was Modified") + { + Caption = 'Log was Modified'; + ToolTip = 'Specifies if the log was modified by any event subscribers.'; + Visible = false; + ApplicationArea = All; + } } } } diff --git a/src/Tools/Performance Toolkit/App/src/BCPTLogEntry.Table.al b/src/Tools/Performance Toolkit/App/src/BCPTLogEntry.Table.al index 2d1aa4e948..642ad10dff 100644 --- a/src/Tools/Performance Toolkit/App/src/BCPTLogEntry.Table.al +++ b/src/Tools/Performance Toolkit/App/src/BCPTLogEntry.Table.al @@ -103,6 +103,32 @@ table 149002 "BCPT Log Entry" DataClassification = SystemMetadata; Caption = 'RunID'; } + field(20; "Orig. Operation"; Text[100]) + { + Caption = 'Orig. Operation'; + } + /// + /// Contains the original status of the test if any event subscribers modifies the status of the test + /// + field(21; "Orig. Status"; Option) + { + Caption = 'Orig. Status'; + OptionMembers = Success,Error; + } + /// + /// Contains the original message of the test if any event subscribers modifies the message of the test + /// + field(22; "Orig. Message"; Text[250]) + { + Caption = 'Orig. Message'; + } + /// + /// Is true if any event subscribers has modified the log entry + /// + field(23; "Log was Modified"; Boolean) + { + Caption = 'Log was Modified'; + } } keys diff --git a/src/Tools/Performance Toolkit/App/src/BCPTTestSuite.Codeunit.al b/src/Tools/Performance Toolkit/App/src/BCPTTestSuite.Codeunit.al index 72a3bc54bf..3ea4051762 100644 --- a/src/Tools/Performance Toolkit/App/src/BCPTTestSuite.Codeunit.al +++ b/src/Tools/Performance Toolkit/App/src/BCPTTestSuite.Codeunit.al @@ -411,4 +411,22 @@ codeunit 149006 "BCPT Test Suite" BCPTLine.SetRange("BCPT Code", SuiteCode); BCPTLine.SetRange("Codeunit ID", CodeunitID); end; + + /// + /// 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. + /// + /// The test suite code + /// The id of the test codunit that is being run + /// Description of the test on the "BCPT Line" + /// Original operation that is currently executed + /// The original ExecutionSuccess + /// The original message + /// Replacement operation that is currently executed + /// Replacement ExcecutionSuccess + /// Replacement Message + [IntegrationEvent(false, false)] + 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; } \ No newline at end of file