diff --git a/src/Tools/AI Test Toolkit/Permissions/AITestToolKitRead.PermissionSet.al b/src/Tools/AI Test Toolkit/Permissions/AITestToolKitRead.PermissionSet.al index c0b51ab8dc..15890a1b69 100644 --- a/src/Tools/AI Test Toolkit/Permissions/AITestToolKitRead.PermissionSet.al +++ b/src/Tools/AI Test Toolkit/Permissions/AITestToolKitRead.PermissionSet.al @@ -11,7 +11,8 @@ permissionset 149033 "AI Test Toolkit - Read" IncludedPermissionSets = "AI Test Toolkit - Obj"; - Permissions = tabledata "AIT Test Suite" = R, + Permissions = tabledata "AIT Run History" = R, + tabledata "AIT Test Suite" = R, tabledata "AIT Test Method Line" = R, tabledata "AIT Log Entry" = R; } \ No newline at end of file diff --git a/src/Tools/AI Test Toolkit/Permissions/AITestToolKitView.PermissionSet.al b/src/Tools/AI Test Toolkit/Permissions/AITestToolKitView.PermissionSet.al index 88a000406a..9c9afd5403 100644 --- a/src/Tools/AI Test Toolkit/Permissions/AITestToolKitView.PermissionSet.al +++ b/src/Tools/AI Test Toolkit/Permissions/AITestToolKitView.PermissionSet.al @@ -12,7 +12,8 @@ permissionset 149034 "AI Test Toolkit - View" IncludedPermissionSets = "AI Test Toolkit - Read"; - Permissions = tabledata "AIT Test Suite" = IMD, + Permissions = tabledata "AIT Run History" = IMD, + tabledata "AIT Test Suite" = IMD, tabledata "AIT Test Method Line" = IMD, tabledata "AIT Log Entry" = IMD; } \ No newline at end of file diff --git a/src/Tools/AI Test Toolkit/Permissions/AITestToolkitObj.PermissionSet.al b/src/Tools/AI Test Toolkit/Permissions/AITestToolkitObj.PermissionSet.al index c45d2ba244..a3185b019d 100644 --- a/src/Tools/AI Test Toolkit/Permissions/AITestToolkitObj.PermissionSet.al +++ b/src/Tools/AI Test Toolkit/Permissions/AITestToolkitObj.PermissionSet.al @@ -10,20 +10,26 @@ permissionset 149031 "AI Test Toolkit - Obj" Assignable = false; Access = Public; - Permissions = table "AIT Test Suite" = X, + Permissions = table "AIT Run History" = X, + table "AIT Test Suite" = X, table "AIT Test Method Line" = X, table "AIT Log Entry" = X, - codeunit "AIT Test Suite Mgt." = X, + codeunit "AIT AL Test Suite Mgt" = X, codeunit "AIT Install" = X, + codeunit "AIT Log Entry" = X, + codeunit "AIT Test Suite Mgt." = X, codeunit "AIT Test Run Iteration" = X, codeunit "AIT Test Context" = X, codeunit "AIT Test Context Impl." = X, xmlport "AIT Test Suite Import/Export" = X, page "AIT CommandLine Card" = X, + page "AIT Test Data" = X, + page "AIT Test Data Compare" = X, page "AIT Test Method Lines" = X, - page "AIT Test Method Lines Compare" = X, + page "AIT Test Method Lines Lookup" = X, page "AIT Log Entries" = X, page "AIT Log Entry API" = X, page "AIT Test Suite" = X, - page "AIT Test Suite List" = X; + page "AIT Test Suite List" = X, + page "AIT Run History" = X; } \ No newline at end of file diff --git a/src/Tools/AI Test Toolkit/src/Logs/AITLogEntries.Page.al b/src/Tools/AI Test Toolkit/src/Logs/AITLogEntries.Page.al index 5baf975084..88020354e5 100644 --- a/src/Tools/AI Test Toolkit/src/Logs/AITLogEntries.Page.al +++ b/src/Tools/AI Test Toolkit/src/Logs/AITLogEntries.Page.al @@ -87,8 +87,11 @@ page 149033 "AIT Log Entries" ToolTip = 'Specifies the test input of the test.'; trigger OnDrillDown() + var + AITTestData: Page "AIT Test Data Compare"; begin - Message(Rec.GetInputBlob()); + AITTestData.SetRecord(Rec); + AITTestData.Run(); end; } field("Output Text"; OutputText) @@ -97,8 +100,11 @@ page 149033 "AIT Log Entries" ToolTip = 'Specifies the test output of the test.'; trigger OnDrillDown() + var + AITTestData: Page "AIT Test Data Compare"; begin - Message(Rec.GetOutputBlob()); + AITTestData.SetRecord(Rec); + AITTestData.Run(); end; } field("Tokens Consumed"; Rec."Tokens Consumed") @@ -241,7 +247,20 @@ page 149033 "AIT Log Entries" begin AITALTestSuiteMgt.DownloadTestOutputFromLogToFile(Rec); end; + } + action("View Test Data") + { + Caption = 'View Test Data'; + Image = CompareCOA; + ToolTip = 'View Test Data.'; + trigger OnAction() + var + AITTestData: Page "AIT Test Data Compare"; + begin + AITTestData.SetRecord(Rec); + AITTestData.Run(); + end; } } area(Promoted) @@ -266,6 +285,9 @@ page 149033 "AIT Log Entries" actionref("Download Test Output_Promoted"; "Download Test Output") { } + actionref("View Test Data_Promoted"; "View Test Data") + { + } } } } @@ -317,7 +339,6 @@ page 149033 "AIT Log Entries" begin InputText := ''; OutputText := ''; - if Rec.Sensitive and not ShowSensitiveData then begin Rec.CalcFields("Input Data", "Output Data"); if Rec."Input Data".Length > 0 then diff --git a/src/Tools/AI Test Toolkit/src/Logs/AITLogEntry.Codeunit.al b/src/Tools/AI Test Toolkit/src/Logs/AITLogEntry.Codeunit.al index e212bfe2b7..e28b2abe62 100644 --- a/src/Tools/AI Test Toolkit/src/Logs/AITLogEntry.Codeunit.al +++ b/src/Tools/AI Test Toolkit/src/Logs/AITLogEntry.Codeunit.al @@ -5,21 +5,163 @@ namespace System.TestTools.AITestToolkit; +using System.TestTools.TestRunner; + codeunit 149032 "AIT Log Entry" { Access = Internal; + var + LineNoFilterLbl: Label 'Codeunit %1 "%2" (Input: %3)', Locked = true; + procedure DrillDownFailedAITLogEntries(AITSuiteCode: Code[100]; LineNo: Integer; VersionNo: Integer) var AITLogEntries: Record "AIT Log Entry"; + begin + AITLogEntries.SetRange(Version, VersionNo); + DrillDownFailedAITLogEntries(AITLogEntries, AITSuiteCode, LineNo); + end; + + procedure DrillDownFailedAITLogEntries(AITSuiteCode: Code[100]; LineNo: Integer; Tag: Text[20]) + var + AITLogEntries: Record "AIT Log Entry"; + begin + AITLogEntries.SetRange(Tag, Tag); + DrillDownFailedAITLogEntries(AITLogEntries, AITSuiteCode, LineNo); + end; + + local procedure DrillDownFailedAITLogEntries(var AITLogEntries: Record "AIT Log Entry"; AITSuiteCode: Code[100]; LineNo: Integer) + var AITLogEntry: Page "AIT Log Entries"; begin AITLogEntries.SetFilterForFailedTestProcedures(); AITLogEntries.SetRange("Test Suite Code", AITSuiteCode); - AITLogEntries.SetRange(Version, VersionNo); if LineNo <> 0 then AITLogEntries.SetRange("Test Method Line No.", LineNo); AITLogEntry.SetTableView(AITLogEntries); AITLogEntry.Run(); end; + + procedure UpdateRunHistory(Code: Code[100]; LineNo: Integer; AITViewBy: Enum "AIT Run History - View By"; var TempAITRunHistory: Record "AIT Run History" temporary) + var + AITRunHistory: Record "AIT Run History"; + SeenTags: List of [Text[20]]; + begin + TempAITRunHistory.DeleteAll(); + AITRunHistory.SetRange("Test Suite Code", Code); + + if AITViewBy = AITViewBy::Version then + if AITRunHistory.FindSet() then + repeat + TempAITRunHistory.TransferFields(AITRunHistory); + TempAITRunHistory.Insert(); + until AITRunHistory.Next() = 0; + + if AITViewBy = AITViewBy::Tag then + if AITRunHistory.FindSet() then + repeat + if not SeenTags.Contains(AITRunHistory.Tag) then begin + TempAITRunHistory.TransferFields(AITRunHistory); + TempAITRunHistory.Insert(); + end; + SeenTags.Add(AITRunHistory.Tag); + until AITRunHistory.Next() = 0; + + if (LineNo <> 0) then + TempAITRunHistory.SetRange("Line No. Filter", LineNo) + end; + + procedure LookupTestMethodLine(TestSuiteCode: Code[100]; var LineNoFilter: Text; var LineNo: Integer) + var + AITTestMethodLine: Record "AIT Test Method Line"; + AITTestMethodLines: Page "AIT Test Method Lines Lookup"; + begin + AITTestMethodLine.SetRange("Test Suite Code", TestSuiteCode); + + AITTestMethodLines.SetTableView(AITTestMethodLine); + AITTestMethodLines.LookupMode(true); + + if not (AITTestMethodLines.RunModal() = Action::LookupOK) then + exit; + + AITTestMethodLines.GetRecord(AITTestMethodLine); + + AITTestMethodLine.CalcFields("Codeunit Name"); + LineNoFilter := StrSubstNo(LineNoFilterLbl, AITTestMethodLine."Codeunit ID", AITTestMethodLine."Codeunit Name", AITTestMethodLine."Input Dataset"); + LineNo := AITTestMethodLine."Line No."; + end; + + procedure UpdateTestInput(TestInput: Text; TestInputView: Enum "AIT Test Input - View"): Text + var + TestData: Codeunit "Test Input Json"; + begin + InitTestData(TestInput, TestData); + + case TestInputView of + TestInputView::"Full Input": + exit(TestInput); + TestInputView::Question: + exit(GetTestDataElement('question', TestData)); + TestInputView::Context: + exit(GetTestDataElement('context', TestData)); + TestInputView::"Test Setup": + exit(GetTestDataElement('test_setup', TestData)); + TestInputView::"Ground Truth": + exit(GetTestDataElement('ground_truth', TestData)); + TestInputView::"Expected Data": + exit(GetTestDataElement('expected_data', TestData)); + else + exit(''); + end; + end; + + procedure UpdateTestOutput(TestOutput: Text; TestOutputView: Enum "AIT Test Output - View"): Text + var + TestData: Codeunit "Test Input Json"; + begin + InitTestData(TestOutput, TestData); + + case TestOutputView of + TestOutputView::"Full Output": + exit(TestOutput); + TestOutputView::Answer: + exit(GetTestDataElement('answer', TestData)); + TestOutputView::Question: + exit(GetTestDataElement('question', TestData)); + TestOutputView::Context: + exit(GetTestDataElement('context', TestData)); + TestOutputView::"Ground Truth": + exit(GetTestDataElement('ground_truth', TestData)); + else + exit(''); + end; + end; + + local procedure InitTestData(TestDataText: Text; var TestData: Codeunit "Test Input Json") + begin + if TestDataText = '' then + TestData.Initialize() + else + TestData.Initialize(TestDataText); + end; + + local procedure GetTestDataElement(ElementName: Text; TestData: Codeunit "Test Input Json"): Text + var + ElementTestDataJson: Codeunit "Test Input Json"; + ElementExists: Boolean; + begin + ElementTestDataJson := TestData.ElementExists('turns', ElementExists); + + if ElementExists then + TestData := ElementTestDataJson; + + ElementTestDataJson := TestData.ElementExists(ElementName, ElementExists); + + if ElementExists and (ElementTestDataJson.ToText() <> '{}') then + exit(ElementTestDataJson.ToText()) + else + exit(''); + end; + + } \ No newline at end of file diff --git a/src/Tools/AI Test Toolkit/src/Logs/AITLogEntry.Table.al b/src/Tools/AI Test Toolkit/src/Logs/AITLogEntry.Table.al index 2cdb58d12b..547b2edcc4 100644 --- a/src/Tools/AI Test Toolkit/src/Logs/AITLogEntry.Table.al +++ b/src/Tools/AI Test Toolkit/src/Logs/AITLogEntry.Table.al @@ -14,6 +14,7 @@ table 149034 "AIT Log Entry" DataClassification = SystemMetadata; DrillDownPageId = "AIT Log Entries"; LookupPageId = "AIT Log Entries"; + DataCaptionFields = "Codeunit Name", "Procedure Name", "Test Input Code"; Extensible = false; Access = Internal; ReplicateData = false; diff --git a/src/Tools/AI Test Toolkit/src/Logs/AITRunHistory.Page.al b/src/Tools/AI Test Toolkit/src/Logs/AITRunHistory.Page.al new file mode 100644 index 0000000000..a0f5d3f1e2 --- /dev/null +++ b/src/Tools/AI Test Toolkit/src/Logs/AITRunHistory.Page.al @@ -0,0 +1,222 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +namespace System.TestTools.AITestToolkit; + +page 149036 "AIT Run History" +{ + Caption = 'AI Test Suite Run History'; + PageType = Worksheet; + ApplicationArea = All; + UsageCategory = None; + SourceTable = "AIT Run History"; + SourceTableTemporary = true; + InsertAllowed = false; + ModifyAllowed = false; + DeleteAllowed = false; + + layout + { + area(Content) + { + group(General) + { + Caption = 'General'; + + field("Test Suite Code"; TestSuiteCode) + { + Caption = 'Test Suite Code'; + ToolTip = 'Specifies the code of the test suite to view results for.'; + TableRelation = "AIT Test Suite".Code; + + trigger OnValidate() + begin + UpdateRunHistory(); + end; + } + + field("View By"; ViewBy) + { + Caption = 'View By'; + ToolTip = 'Specifies whether to view results by tag or version.'; + + trigger OnValidate() + begin + UpdateRunHistory(); + end; + } + + field("Apply Filter"; ApplyLineFilter) + { + Caption = 'Apply Filter'; + ToolTip = 'Specifies whether to filter results to a specific line or see results of the suite as a whole.'; + + trigger OnValidate() + begin + UpdateRunHistory(); + end; + } + } + + group("Line Filter") + { + Caption = 'Test Line Filter'; + Visible = ApplyLineFilter; + + field("Line No."; LineNoFilter) + { + Caption = 'Test Line'; + ToolTip = 'Specifies the line to filter to.'; + Editable = false; + + trigger OnAssistEdit() + begin + LookupTestMethodLine(); + end; + } + } + + group(History) + { + repeater("Run History") + { + field(Version; Rec.Version) + { + Visible = ViewBy = ViewBy::Version; + Caption = 'Version'; + ToolTip = 'Specifies the version.'; + } + field(Tag; Rec.Tag) + { + Caption = 'Tag'; + ToolTip = 'Specifies the tag of the version.'; + } + field("No. of Tests - By Version"; Rec."No. of Tests Executed") + { + Visible = ViewBy = ViewBy::Version; + Caption = 'No. of Tests'; + ToolTip = 'Specifies the number of tests in the version.'; + } + field("No. of Tests Passed - By Version"; Rec."No. of Tests Passed") + { + Visible = ViewBy = ViewBy::Version; + Caption = 'No. of Tests Passed'; + ToolTip = 'Specifies the number of tests passed in the version.'; + Style = Favorable; + } + field("No. of Tests Failed - By Version"; Rec."No. of Tests Executed" - Rec."No. of Tests Passed") + { + Visible = ViewBy = ViewBy::Version; + Editable = false; + Caption = 'No. of Tests Failed'; + ToolTip = 'Specifies the number of tests that failed in the version.'; + Style = Unfavorable; + + trigger OnDrillDown() + var + AITLogEntryCU: Codeunit "AIT Log Entry"; + begin + AITLogEntryCU.DrillDownFailedAITLogEntries(Rec."Test Suite Code", Rec."Line No. Filter", Rec.Version); + end; + } + field("Duration - By Version"; Rec."Total Duration (ms)") + { + Visible = ViewBy = ViewBy::Version; + Caption = 'Total Duration (ms)'; + ToolTip = 'Specifies Total Duration of the tests for the base version.'; + } + field("Tokens - By Version"; Rec."Tokens Consumed") + { + Visible = ViewBy = ViewBy::Version; + Caption = 'Total Tokens Consumed'; + ToolTip = 'Specifies the aggregated number of tokens consumed by the test in the current version. This is applicable only when using Microsoft AI Module.'; + } + field("No. of Tests - By Tag"; Rec."No. of Tests Executed - By Tag") + { + Visible = ViewBy = ViewBy::Tag; + Caption = 'No. of Tests'; + ToolTip = 'Specifies the number of tests for the tag.'; + } + field("No. of Tests Passed - By Tag"; Rec."No. of Tests Passed - By Tag") + { + Visible = ViewBy = ViewBy::Tag; + Caption = 'No. of Tests Passed'; + ToolTip = 'Specifies the number of tests passed for the tag.'; + Style = Favorable; + } + field("No. of Tests Failed - By Tag"; Rec."No. of Tests Executed - By Tag" - Rec."No. of Tests Passed - By Tag") + { + Visible = ViewBy = ViewBy::Tag; + Editable = false; + Caption = 'No. of Tests Failed'; + ToolTip = 'Specifies the number of tests that failed for the tag.'; + Style = Unfavorable; + + trigger OnDrillDown() + var + AITLogEntryCU: Codeunit "AIT Log Entry"; + begin + AITLogEntryCU.DrillDownFailedAITLogEntries(Rec."Test Suite Code", Rec."Line No. Filter", Rec.Tag); + end; + } + field("Duration - By Tag"; Rec."Total Duration (ms) - By Tag") + { + Visible = ViewBy = ViewBy::Tag; + Caption = 'Total Duration (ms)'; + ToolTip = 'Specifies Total Duration of the tests for the base version.'; + } + field("Tokens - By Tag"; Rec."Tokens Consumed - By Tag") + { + Visible = ViewBy = ViewBy::Tag; + Caption = 'Total Tokens Consumed'; + ToolTip = 'Specifies the aggregated number of tokens consumed by the test in the current version. This is applicable only when using Microsoft AI Module.'; + } + } + } + } + } + + var + TestSuiteCode: Code[100]; + ViewBy: Enum "AIT Run History - View By"; + LineNo: Integer; + ApplyLineFilter: Boolean; + LineNoFilter: Text; + + trigger OnOpenPage() + begin + UpdateRunHistory(); + end; + + internal procedure SetTestSuite(Code: Code[100]) + begin + TestSuiteCode := Code; + end; + + internal procedure FilterToLine(Line: Integer) + begin + ApplyLineFilter := true; + LineNo := Line; + end; + + local procedure LookupTestMethodLine() + var + AITLogEntry: Codeunit "AIT Log Entry"; + begin + AITLogEntry.LookupTestMethodLine(TestSuiteCode, LineNoFilter, LineNo); + UpdateRunHistory(); + end; + + local procedure UpdateRunHistory() + var + AITLogEntry: Codeunit "AIT Log Entry"; + begin + if not ApplyLineFilter then + LineNo := 0; + + AITLogEntry.UpdateRunHistory(TestSuiteCode, LineNo, ViewBy, Rec); + CurrPage.Update(); + end; +} \ No newline at end of file diff --git a/src/Tools/AI Test Toolkit/src/Logs/AITRunHistory.Table.al b/src/Tools/AI Test Toolkit/src/Logs/AITRunHistory.Table.al new file mode 100644 index 0000000000..41756ff946 --- /dev/null +++ b/src/Tools/AI Test Toolkit/src/Logs/AITRunHistory.Table.al @@ -0,0 +1,125 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +namespace System.TestTools.AITestToolkit; + +table 149036 "AIT Run History" +{ + Caption = 'AI Run History'; + DataClassification = SystemMetadata; + Extensible = false; + Access = Internal; + ReplicateData = false; + + fields + { + field(1; "Test Suite Code"; Code[100]) + { + Caption = 'Code'; + NotBlank = true; + ToolTip = 'Specifies the Code for the test suite.'; + } + field(2; Version; Integer) + { + Caption = 'Version'; + NotBlank = true; + ToolTip = 'Specifies the version for the test suite.'; + } + field(3; Tag; Text[20]) + { + Caption = 'Tag'; + NotBlank = true; + ToolTip = 'Specifies the tag for the test suite.'; + } + field(5; "Line No. Filter"; Integer) + { + + Caption = 'Line No. Filter'; + ToolTip = 'Specifies the line to filter results to.'; + FieldClass = FlowFilter; + } + field(10; "No. of Tests Executed"; Integer) + { + Caption = 'No. of Tests Executed'; + ToolTip = 'Specifies the number of tests executed for the test suite.'; + Editable = false; + FieldClass = FlowField; + CalcFormula = count("AIT Log Entry" where("Test Suite Code" = field("Test Suite Code"), "Version" = field("Version"), "Test Method Line No." = field("Line No. Filter"), Operation = const('Run Procedure'), "Procedure Name" = filter(<> ''))); + } + field(11; "No. of Tests Passed"; Integer) + { + Caption = 'No. of Tests Passed'; + ToolTip = 'Specifies the number of tests passed for the test suite.'; + Editable = false; + FieldClass = FlowField; + CalcFormula = count("AIT Log Entry" where("Test Suite Code" = field("Test Suite Code"), "Version" = field("Version"), "Test Method Line No." = field("Line No. Filter"), Operation = const('Run Procedure'), "Procedure Name" = filter(<> ''), Status = const(0))); + } +#pragma warning disable AA0232 + field(12; "Total Duration (ms)"; Integer) +#pragma warning restore AA0232 + { + Caption = 'Total Duration (ms)'; + ToolTip = 'Specifies the time taken for executing the tests in the test suite.'; + Editable = false; + FieldClass = FlowField; + CalcFormula = sum("AIT Log Entry"."Duration (ms)" where("Test Suite Code" = field("Test Suite Code"), "Version" = field("Version"), "Test Method Line No." = field("Line No. Filter"), Operation = const('Run Procedure'), "Procedure Name" = filter(<> ''))); + } + field(13; "Tokens Consumed"; Integer) + { + Caption = 'Total Tokens Consumed'; + ToolTip = 'Specifies the aggregated number of tokens consumed by the test in the current version. This is applicable only when using Microsoft AI Module.'; + Editable = false; + FieldClass = FlowField; + CalcFormula = sum("AIT Log Entry"."Tokens Consumed" where("Test Suite Code" = field("Test Suite Code"), Version = field("Version"), "Test Method Line No." = field("Line No. Filter"), Operation = const('Run Procedure'), "Procedure Name" = filter(<> ''))); + } + field(20; "No. of Tests Executed - By Tag"; Integer) + { + Caption = 'No. of Tests Executed'; + ToolTip = 'Specifies the number of tests executed for the test suite.'; + Editable = false; + FieldClass = FlowField; + CalcFormula = count("AIT Log Entry" where("Test Suite Code" = field("Test Suite Code"), Tag = field(Tag), "Test Method Line No." = field("Line No. Filter"), Operation = const('Run Procedure'), "Procedure Name" = filter(<> ''))); + } + field(21; "No. of Tests Passed - By Tag"; Integer) + { + Caption = 'No. of Tests Passed'; + ToolTip = 'Specifies the number of tests passed for the test suite.'; + Editable = false; + FieldClass = FlowField; + CalcFormula = count("AIT Log Entry" where("Test Suite Code" = field("Test Suite Code"), Tag = field(Tag), "Test Method Line No." = field("Line No. Filter"), Operation = const('Run Procedure'), "Procedure Name" = filter(<> ''), Status = const(0))); + } + field(22; "Total Duration (ms) - By Tag"; Integer) + { + Caption = 'Total Duration (ms)'; + ToolTip = 'Specifies the time taken for executing the tests in the test suite.'; + Editable = false; + FieldClass = FlowField; + CalcFormula = sum("AIT Log Entry"."Duration (ms)" where("Test Suite Code" = field("Test Suite Code"), "Test Method Line No." = field("Line No. Filter"), Tag = field(Tag), Operation = const('Run Procedure'), "Procedure Name" = filter(<> ''))); + } + field(23; "Tokens Consumed - By Tag"; Integer) + { + Caption = 'Total Tokens Consumed'; + ToolTip = 'Specifies the aggregated number of tokens consumed by the test in the current version. This is applicable only when using Microsoft AI Module.'; + Editable = false; + FieldClass = FlowField; + CalcFormula = sum("AIT Log Entry"."Tokens Consumed" where("Test Suite Code" = field("Test Suite Code"), "Test Method Line No." = field("Line No. Filter"), Tag = field(Tag), Operation = const('Run Procedure'), "Procedure Name" = filter(<> ''))); + } + } + + keys + { + key(Key1; "Test Suite Code", Version, Tag) + { + Clustered = true; + } + } + + fieldgroups + { + fieldgroup(DropDown; Version, Tag) + { + } + } +} \ No newline at end of file diff --git a/src/Tools/AI Test Toolkit/src/Logs/AITRunHistoryViewBy.Enum.al b/src/Tools/AI Test Toolkit/src/Logs/AITRunHistoryViewBy.Enum.al new file mode 100644 index 0000000000..010893b24e --- /dev/null +++ b/src/Tools/AI Test Toolkit/src/Logs/AITRunHistoryViewBy.Enum.al @@ -0,0 +1,21 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +namespace System.TestTools.AITestToolkit; + +enum 149032 "AIT Run History - View By" +{ + Extensible = false; + + value(0; Version) + { + Caption = 'Version'; + } + + value(1; Tag) + { + Caption = 'Tag'; + } +} \ No newline at end of file diff --git a/src/Tools/AI Test Toolkit/src/Logs/AITTestData.Page.al b/src/Tools/AI Test Toolkit/src/Logs/AITTestData.Page.al new file mode 100644 index 0000000000..85c226181d --- /dev/null +++ b/src/Tools/AI Test Toolkit/src/Logs/AITTestData.Page.al @@ -0,0 +1,43 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +page 149041 "AIT Test Data" +{ + Caption = 'AI Test Data'; + PageType = CardPart; + ApplicationArea = All; + Editable = false; + Extensible = false; + UsageCategory = None; + + layout + { + area(Content) + { + group(Data) + { + ShowCaption = false; + + field("Test Data"; TestDataText) + { + ShowCaption = false; + Editable = false; + MultiLine = true; + ExtendedDatatype = RichContent; + } + } + } + } + + + internal procedure SetTestData(Text: Text) + begin + TestDataText := Text; + CurrPage.Update(false); + end; + + var + TestDataText: Text; +} \ No newline at end of file diff --git a/src/Tools/AI Test Toolkit/src/Logs/AITTestDataCompare.Page.al b/src/Tools/AI Test Toolkit/src/Logs/AITTestDataCompare.Page.al new file mode 100644 index 0000000000..65b23bb82e --- /dev/null +++ b/src/Tools/AI Test Toolkit/src/Logs/AITTestDataCompare.Page.al @@ -0,0 +1,94 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +page 149035 "AIT Test Data Compare" +{ + Caption = 'AI Test Data'; + PageType = Card; + ApplicationArea = All; + SourceTable = "AIT Log Entry"; + Extensible = false; + UsageCategory = None; + + layout + { + area(Content) + { + group("Test Data") + { + ShowCaption = false; + + grid(Data) + { + ShowCaption = false; + + group(Input) + { + Caption = 'Input'; + + field("View"; TestInputView) + { + Caption = 'Input View'; + ToolTip = 'Specifies what is shown from the input.'; + + trigger OnValidate() + begin + UpdateTestData(); + end; + } + + part("Data Input"; "AIT Test Data") + { + } + } + + group(Output) + { + Caption = 'Output'; + + field("Output View"; TestOutputView) + { + Caption = 'Output View'; + ToolTip = 'Specifies what is shown from the output.'; + + trigger OnValidate() + begin + UpdateTestData(); + end; + } + + part("Data Output"; "AIT Test Data") + { + } + } + + + } + } + } + } + + trigger OnAfterGetRecord() + begin + UpdateTestData(); + end; + + local procedure UpdateTestData() + var + AITLogEntry: Codeunit "AIT Log Entry"; + TestInput: Text; + TestOutput: Text; + begin + TestInput := AITLogEntry.UpdateTestInput(Rec.GetInputBlob(), TestInputView); + TestOutput := AITLogEntry.UpdateTestOutput(Rec.GetOutputBlob(), TestOutputView); + + CurrPage."Data Input".Page.SetTestData(TestInput); + CurrPage."Data Output".Page.SetTestData(TestOutput); + end; + + var + TestInputView: Enum "AIT Test Input - View"; + TestOutputView: Enum "AIT Test Output - View"; +} \ No newline at end of file diff --git a/src/Tools/AI Test Toolkit/src/Logs/AITTestInputView.Enum.al b/src/Tools/AI Test Toolkit/src/Logs/AITTestInputView.Enum.al new file mode 100644 index 0000000000..63f54d21b2 --- /dev/null +++ b/src/Tools/AI Test Toolkit/src/Logs/AITTestInputView.Enum.al @@ -0,0 +1,41 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +namespace System.TestTools.AITestToolkit; + +enum 149033 "AIT Test Input - View" +{ + Extensible = false; + + value(0; "Full Input") + { + Caption = 'Full Input'; + } + + value(1; Question) + { + Caption = 'Question'; + } + + value(2; Context) + { + Caption = 'Context'; + } + + value(3; "Test Setup") + { + Caption = 'Test Setup'; + } + + value(4; "Ground Truth") + { + Caption = 'Ground Truth'; + } + + value(5; "Expected Data") + { + Caption = 'Expected Data'; + } +} \ No newline at end of file diff --git a/src/Tools/AI Test Toolkit/src/Logs/AITTestMethodLinesCompare.Page.al b/src/Tools/AI Test Toolkit/src/Logs/AITTestMethodLinesCompare.Page.al deleted file mode 100644 index 696eee149a..0000000000 --- a/src/Tools/AI Test Toolkit/src/Logs/AITTestMethodLinesCompare.Page.al +++ /dev/null @@ -1,189 +0,0 @@ -// ------------------------------------------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// ------------------------------------------------------------------------------------------------ - -namespace System.TestTools.AITestToolkit; - -page 149035 "AIT Test Method Lines Compare" -{ - Caption = 'AI Test Method Lines Compare'; - PageType = Card; - ApplicationArea = All; - SourceTable = "AIT Test Method Line"; - ModifyAllowed = false; - InsertAllowed = false; - DeleteAllowed = false; - UsageCategory = None; - - layout - { - area(Content) - { - group("Version Configuration") - { - Caption = 'Version Configuration'; - - field(Version; Version) - { - Caption = 'Version'; - ToolTip = 'Specifies the base version to compare with.'; - - trigger OnValidate() - begin - UpdateVersionFilter(); - end; - } - field(BaseVersion; BaseVersion) - { - Caption = 'Base Version'; - ToolTip = 'Specifies the base version to compare to.'; - - trigger OnValidate() - begin - UpdateVersionFilter(); - end; - } - } - - group("Version Comparison") - { - Caption = 'Version Comparison'; - grid(Summary) - { - group("Summary Captions") - { - ShowCaption = false; - label(NoOfTests) - { - Caption = 'Number of Tests'; - ToolTip = 'Specifies the number of tests in this Line'; - } - label(NoOfTestsPassed) - { - Caption = 'Number of Tests Passed'; - ToolTip = 'Specifies the number of tests passed in the version.'; - } - label(NoOfTestsFailed) - { - Caption = 'Number of Tests Failed'; - ToolTip = 'Specifies the number of tests that failed in the version.'; - } - label(TotalDuration) - { - Caption = 'Total Duration (ms)'; - ToolTip = 'Specifies Total Duration of the test for given version.'; - } - label(TokensConsumed) - { - Caption = 'Total Tokens Consumed'; - ToolTip = 'Specifies the aggregated number of tokens consumed by the test. This is applicable only when using Microsoft AI Module.'; - } - } - group("Latest Version") - { - Caption = 'Latest Version'; - field("No. of Tests Executed"; Rec."No. of Tests Executed") - { - ShowCaption = false; - } - field("No. of Tests Passed"; Rec."No. of Tests Passed") - { - Style = Favorable; - ShowCaption = false; - } - field("No. of Tests Failed"; Rec."No. of Tests Executed" - Rec."No. of Tests Passed") - { - Editable = false; - Caption = 'Number of Tests Failed'; - ToolTip = 'Specifies the number of tests that failed in the current version.'; - ShowCaption = false; - Style = Unfavorable; - - trigger OnDrillDown() - var - AITLogEntry: Codeunit "AIT Log Entry"; - begin - AITLogEntry.DrillDownFailedAITLogEntries(Rec."Test Suite Code", Rec."Line No.", Version); - end; - } - field(Duration; Rec."Total Duration (ms)") - { - ToolTip = 'Specifies Total Duration of the tests for this version.'; - ShowCaption = false; - } - field("Tokens Consumed"; Rec."Tokens Consumed") - { - ShowCaption = false; - } - } - group("Base Version") - { - Caption = 'Base Version'; - field("No. of Tests Executed - Base"; Rec."No. of Tests Executed - Base") - { - ToolTip = 'Specifies the number of tests in this Line for the base version.'; - ShowCaption = false; - } - field("No. of Tests Passed - Base"; Rec."No. of Tests Passed - Base") - { - Style = Favorable; - ShowCaption = false; - } - field("No. of Tests Failed - Base"; Rec."No. of Tests Executed - Base" - Rec."No. of Tests Passed - Base") - { - Editable = false; - Caption = 'No. of Tests Failed - Base'; - ToolTip = 'Specifies the number of tests that failed in the base version.'; - Style = Unfavorable; - ShowCaption = false; - - trigger OnDrillDown() - var - AITLogEntry: Codeunit "AIT Log Entry"; - begin - AITLogEntry.DrillDownFailedAITLogEntries(Rec."Test Suite Code", Rec."Line No.", BaseVersion); - end; - } - field(DurationBase; Rec."Total Duration - Base (ms)") - { - ToolTip = 'Specifies Total Duration of the tests for the base version.'; - Caption = 'Total Duration Base (ms)'; - ShowCaption = false; - } - field("Tokens Consumed - Base"; Rec."Tokens Consumed - Base") - { - ShowCaption = false; - } - } - } - } - } - } - - var - Version: Integer; - BaseVersion: Integer; - - trigger OnOpenPage() - begin - UpdateVersionFilter(); - end; - - internal procedure SetVersion(VersionNo: Integer) - begin - Version := VersionNo; - end; - - internal procedure SetBaseVersion(VersionNo: Integer) - begin - BaseVersion := VersionNo; - end; - - local procedure UpdateVersionFilter() - begin - Rec.SetRange("Version Filter", Version); - Rec.SetRange("Base Version Filter", BaseVersion); - CurrPage.Update(false); - end; -} \ No newline at end of file diff --git a/src/Tools/AI Test Toolkit/src/Logs/AITTestOutputView.Enum.al b/src/Tools/AI Test Toolkit/src/Logs/AITTestOutputView.Enum.al new file mode 100644 index 0000000000..a732c94b7b --- /dev/null +++ b/src/Tools/AI Test Toolkit/src/Logs/AITTestOutputView.Enum.al @@ -0,0 +1,36 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +namespace System.TestTools.AITestToolkit; + +enum 149034 "AIT Test Output - View" +{ + Extensible = false; + + value(0; "Full Output") + { + Caption = 'Full Output'; + } + + value(1; Answer) + { + Caption = 'Answer'; + } + + value(2; Question) + { + Caption = 'Question'; + } + + value(3; Context) + { + Caption = 'Context'; + } + + value(4; "Ground Truth") + { + Caption = 'Ground Truth'; + } +} \ No newline at end of file diff --git a/src/Tools/AI Test Toolkit/src/Logs/AITTestSuiteCompare.Page.al b/src/Tools/AI Test Toolkit/src/Logs/AITTestSuiteCompare.Page.al deleted file mode 100644 index 94322a0460..0000000000 --- a/src/Tools/AI Test Toolkit/src/Logs/AITTestSuiteCompare.Page.al +++ /dev/null @@ -1,192 +0,0 @@ -// ------------------------------------------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// ------------------------------------------------------------------------------------------------ - -namespace System.TestTools.AITestToolkit; - -page 149036 "AIT Test Suite Compare" -{ - Caption = 'AI Test Suite Compare'; - PageType = Card; - ApplicationArea = All; - SourceTable = "AIT Test Suite"; - SourceTableTemporary = true; - ModifyAllowed = false; - InsertAllowed = false; - DeleteAllowed = false; - UsageCategory = None; - - layout - { - area(Content) - { - group("Version Configuration") - { - Caption = 'Version Configuration'; - - field(Version; Rec.Version) - { - Caption = 'Version'; - ToolTip = 'Specifies the base version to compare with.'; - - trigger OnValidate() - begin - UpdateVersionFilter(); - end; - } - field(BaseVersion; BaseVersion) - { - Caption = 'Base Version'; - ToolTip = 'Specifies the Base version to compare to.'; - - trigger OnValidate() - begin - UpdateVersionFilter(); - end; - } - } - - group("Version Comparison") - { - Caption = 'Version Comparison'; - grid(Summary) - { - group("Summary Captions") - { - ShowCaption = false; - label(NoOfTests) - { - Caption = 'Number of Tests'; - ToolTip = 'Specifies the number of tests in this Line'; - } - label(NoOfTestsPassed) - { - Caption = 'Number of Tests Passed'; - ToolTip = 'Specifies the number of tests passed in the version.'; - } - label(NoOfTestsFailed) - { - Caption = 'Number of Tests Failed'; - ToolTip = 'Specifies the number of tests that failed in the version.'; - } - label(TotalDuration) - { - Caption = 'Total Duration (ms)'; - ToolTip = 'Specifies Total Duration of the tests for the version.'; - } - label(TokensConsumed) - { - Caption = 'Total Tokens Consumed'; - ToolTip = 'Specifies the aggregated number of tokens consumed by the test. This is applicable only when using Microsoft AI Module.'; - } - } - group("Latest Version") - { - Caption = 'Latest Version'; - field("No. of Tests"; Rec."No. of Tests Executed") - { - ToolTip = 'Specifies the number of tests in this line.'; - ShowCaption = false; - } - field("No. of Tests Passed"; Rec."No. of Tests Passed") - { - Style = Favorable; - ToolTip = 'Specifies the number of tests passed in the current version.'; - ShowCaption = false; - } - field("No. of Tests Failed"; Rec."No. of Tests Executed" - Rec."No. of Tests Passed") - { - Editable = false; - Caption = 'Number of Tests Failed'; - ToolTip = 'Specifies the number of tests that failed in the current version.'; - ShowCaption = false; - Style = Unfavorable; - - trigger OnDrillDown() - var - AITLogEntryCU: Codeunit "AIT Log Entry"; - begin - AITLogEntryCU.DrillDownFailedAITLogEntries(Rec.Code, 0, Rec.Version); - end; - } - field(Duration; Rec."Total Duration (ms)") - { - ToolTip = 'Specifies Total Duration of the tests for this version.'; - ShowCaption = false; - } - field("Tokens Consumed"; Rec."Tokens Consumed") - { - ShowCaption = false; - } - } - group("Base Version") - { - Caption = 'Base Version'; - field("No. of Tests - Base"; Rec."No. of Tests Executed - Base") - { - ToolTip = 'Specifies the number of tests in this Line for the base version.'; - ShowCaption = false; - } - field("No. of Tests Passed - Base"; Rec."No. of Tests Passed - Base") - { - ToolTip = 'Specifies the number of tests passed in the base Version.'; - Style = Favorable; - ShowCaption = false; - } - field("No. of Tests Failed - Base"; Rec."No. of Tests Executed - Base" - Rec."No. of Tests Passed - Base") - { - Editable = false; - Caption = 'Number of Tests Failed - Base'; - ToolTip = 'Specifies the number of tests that failed in the base Version.'; - Style = Unfavorable; - ShowCaption = false; - - trigger OnDrillDown() - var - AITLogEntryCU: Codeunit "AIT Log Entry"; - begin - AITLogEntryCU.DrillDownFailedAITLogEntries(Rec.Code, 0, BaseVersion); - end; - } - field(DurationBase; Rec."Total Duration (ms) - Base") - { - ToolTip = 'Specifies Total Duration of the tests for the version.'; - Caption = 'Total Duration Base (ms)'; - ShowCaption = false; - } - field("Tokens Consumed - Base"; Rec."Tokens Consumed - Base") - { - ShowCaption = false; - } - } - } - } - } - } - - var - BaseVersion: Integer; - - trigger OnOpenPage() - begin - UpdateVersionFilter(); - end; - - internal procedure SetVersion(VersionNo: Integer) - begin - Rec.Version := VersionNo; - end; - - internal procedure SetBaseVersion(VersionNo: Integer) - begin - BaseVersion := VersionNo; - end; - - local procedure UpdateVersionFilter() - begin - Rec.Version := Rec.Version; - Rec."Base Version" := BaseVersion; - CurrPage.Update(); - end; -} \ No newline at end of file diff --git a/src/Tools/AI Test Toolkit/src/TestSuite/AITTestMethodLine.Table.al b/src/Tools/AI Test Toolkit/src/TestSuite/AITTestMethodLine.Table.al index da4ea0598d..f8b40ebe8d 100644 --- a/src/Tools/AI Test Toolkit/src/TestSuite/AITTestMethodLine.Table.al +++ b/src/Tools/AI Test Toolkit/src/TestSuite/AITTestMethodLine.Table.al @@ -202,6 +202,13 @@ table 149032 "AIT Test Method Line" } } + fieldgroups + { + fieldgroup(DropDown; "Line No.", "Codeunit ID", "Codeunit Name", "Input Dataset", Description) + { + } + } + internal procedure GetTestInputCode(): Code[100] var AITTestSuite: Record "AIT Test Suite"; diff --git a/src/Tools/AI Test Toolkit/src/TestSuite/AITTestMethodLines.Page.al b/src/Tools/AI Test Toolkit/src/TestSuite/AITTestMethodLines.Page.al index 02c7a1d261..7af836cbed 100644 --- a/src/Tools/AI Test Toolkit/src/TestSuite/AITTestMethodLines.Page.al +++ b/src/Tools/AI Test Toolkit/src/TestSuite/AITTestMethodLines.Page.al @@ -169,29 +169,24 @@ page 149034 "AIT Test Method Lines" } action(Compare) { - Caption = 'Compare Versions'; - Image = CompareCOA; - ToolTip = 'Compare results of the line to a base version.'; + Caption = 'View Runs'; + Image = History; + ToolTip = 'View the run history of the suite, for the selected line.'; Scope = Repeater; trigger OnAction() var AITTestMethodLine: Record "AIT Test Method Line"; - AITTestSuiteRec: Record "AIT Test Suite"; - AITTestMethodLineComparePage: Page "AIT Test Method Lines Compare"; + AITRunHistory: Page "AIT Run History"; begin CurrPage.SetSelectionFilter(AITTestMethodLine); if not AITTestMethodLine.FindFirst() then Error(NoLineSelectedErr); - AITTestSuiteRec.SetLoadFields(Version); - AITTestSuiteRec.Get(Rec."Test Suite Code"); - - AITTestMethodLineComparePage.SetBaseVersion(AITTestSuiteRec.Version - 1); - AITTestMethodLineComparePage.SetVersion(AITTestSuiteRec.Version); - AITTestMethodLineComparePage.SetRecord(AITTestMethodLine); - AITTestMethodLineComparePage.Run(); + AITRunHistory.SetTestSuite(AITTestMethodLine."Test Suite Code"); + AITRunHistory.FilterToLine(AITTestMethodLine."Line No."); + AITRunHistory.Run(); end; } } diff --git a/src/Tools/AI Test Toolkit/src/TestSuite/AITTestMethodLinesLookup.Page.al b/src/Tools/AI Test Toolkit/src/TestSuite/AITTestMethodLinesLookup.Page.al new file mode 100644 index 0000000000..bb2bf70f97 --- /dev/null +++ b/src/Tools/AI Test Toolkit/src/TestSuite/AITTestMethodLinesLookup.Page.al @@ -0,0 +1,41 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +namespace System.TestTools.AITestToolkit; + +page 149037 "AIT Test Method Lines Lookup" +{ + Caption = 'Test Method Lines'; + PageType = List; + ApplicationArea = All; + SourceTable = "AIT Test Method Line"; + Extensible = false; + UsageCategory = None; + InsertAllowed = false; + ModifyAllowed = false; + DeleteAllowed = false; + + layout + { + area(Content) + { + repeater(Control1) + { + field(CodeunitID; Rec."Codeunit ID") + { + } + field(CodeunitName; Rec."Codeunit Name") + { + } + field(InputDataset; Rec."Input Dataset") + { + } + field(Description; Rec.Description) + { + } + } + } + } +} \ No newline at end of file diff --git a/src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuite.Page.al b/src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuite.Page.al index 85d3d8f36d..e4a2599e74 100644 --- a/src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuite.Page.al +++ b/src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuite.Page.al @@ -183,25 +183,17 @@ page 149031 "AIT Test Suite" action(Compare) { - Caption = 'Compare Versions'; - Image = CompareCOA; - ToolTip = 'Compare results of the suite to a base version.'; + Caption = 'View Runs'; + Image = History; + ToolTip = 'View the run history of the suite.'; Scope = Repeater; trigger OnAction() var - TemporaryAITTestSuiteRec: Record "AIT Test Suite" temporary; - AITTestSuiteComparePage: Page "AIT Test Suite Compare"; + AITRunHistory: Page "AIT Run History"; begin - TemporaryAITTestSuiteRec.Code := Rec.Code; - TemporaryAITTestSuiteRec.Version := Rec.Version; - TemporaryAITTestSuiteRec."Base Version" := Rec."Version" - 1; - TemporaryAITTestSuiteRec.Insert(); - - AITTestSuiteComparePage.SetBaseVersion(Rec."Version" - 1); - AITTestSuiteComparePage.SetVersion(Rec.Version); - AITTestSuiteComparePage.SetRecord(TemporaryAITTestSuiteRec); - AITTestSuiteComparePage.Run(); + AITRunHistory.SetTestSuite(Rec.Code); + AITRunHistory.Run(); end; } action(ExportAIT) diff --git a/src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuite.Table.al b/src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuite.Table.al index da05050dcc..0ec8c411ae 100644 --- a/src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuite.Table.al +++ b/src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuite.Table.al @@ -103,7 +103,7 @@ table 149030 "AIT Test Suite" ToolTip = 'Specifies the time taken for executing the tests in the test suite.'; Editable = false; FieldClass = FlowField; - CalcFormula = sum("AIT Log Entry"."Duration (ms)" where("Test Suite Code" = field("Code"), Version = field("Version"), Operation = const('Run Procedure'), "Procedure Name" = filter(<> ''))); + CalcFormula = sum("AIT Log Entry"."Duration (ms)" where("Test Suite Code" = field("Code"), "Version" = field("Version"), Operation = const('Run Procedure'), "Procedure Name" = filter(<> ''))); } field(13; Version; Integer) { @@ -159,46 +159,6 @@ table 149030 "AIT Test Suite" FieldClass = FlowField; CalcFormula = sum("AIT Log Entry"."Tokens Consumed" where("Test Suite Code" = field("Code"), Version = field("Version"), Operation = const('Run Procedure'), "Procedure Name" = filter(<> ''))); } - field(31; "No. of Tests Executed - Base"; Integer) - { - Caption = 'No. of Tests Executed'; - ToolTip = 'Specifies the number of tests executed for the base version of the test suite.'; - Editable = false; - FieldClass = FlowField; - CalcFormula = count("AIT Log Entry" where("Test Suite Code" = field("Code"), "Version" = field("Base Version"), Operation = const('Run Procedure'), "Procedure Name" = filter(<> ''))); - } - field(32; "No. of Tests Passed - Base"; Integer) - { - Caption = 'No. of Tests Passed'; - ToolTip = 'Specifies the number of tests passed for the base version of the test suite.'; - Editable = false; - FieldClass = FlowField; - CalcFormula = count("AIT Log Entry" where("Test Suite Code" = field("Code"), "Version" = field("Base Version"), Operation = const('Run Procedure'), "Procedure Name" = filter(<> ''), Status = const(0))); - } - field(33; "No. of Operations - Base"; Integer) - { - Caption = 'No. of Operations'; - ToolTip = 'Specifies the number of operations executed including "Run Procedure" operation for the base version of the test suite.'; - Editable = false; - FieldClass = FlowField; - CalcFormula = count("AIT Log Entry" where("Test Suite Code" = field("Code"), "Version" = field("Base Version"))); - } - field(34; "Total Duration (ms) - Base"; Integer) - { - Caption = 'Total Duration (ms) - Base'; - ToolTip = 'Specifies the time taken for executing the tests for the base version of the test suite.'; - Editable = false; - FieldClass = FlowField; - CalcFormula = sum("AIT Log Entry"."Duration (ms)" where("Test Suite Code" = field("Code"), Version = field("Base Version"), Operation = const('Run Procedure'), "Procedure Name" = filter(<> ''))); - } - field(35; "Tokens Consumed - Base"; Integer) - { - Caption = 'Total Tokens Consumed - Base'; - ToolTip = 'Specifies the aggregated number of tokens consumed by the test in the base version. This is applicable only when using Microsoft AI Module.'; - Editable = false; - FieldClass = FlowField; - CalcFormula = sum("AIT Log Entry"."Tokens Consumed" where("Test Suite Code" = field("Code"), Version = field("Base Version"), Operation = const('Run Procedure'), "Procedure Name" = filter(<> ''))); - } field(50; "Test Runner Id"; Integer) { Caption = 'Test Runner Id'; diff --git a/src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuiteMgt.Codeunit.al b/src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuiteMgt.Codeunit.al index 2fa30d2af4..a55b5d1d22 100644 --- a/src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuiteMgt.Codeunit.al +++ b/src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuiteMgt.Codeunit.al @@ -45,6 +45,7 @@ codeunit 149034 "AIT Test Suite Mgt." local procedure RunAITests(AITTestSuite: Record "AIT Test Suite") var AITTestMethodLine: Record "AIT Test Method Line"; + AITRunHistory: Record "AIT Run History"; AITTestSuiteMgt: Codeunit "AIT Test Suite Mgt."; FeatureTelemetry: Codeunit "Feature Telemetry"; FeatureTelemetryCD: Dictionary of [Text, Text]; @@ -77,6 +78,11 @@ codeunit 149034 "AIT Test Suite Mgt." repeat RunAITestLine(AITTestMethodLine, true); until AITTestMethodLine.Next() = 0; + + AITRunHistory."Test Suite Code" := AITTestSuite.Code; + AITRunHistory.Version := AITTestSuite.Version; + AITRunHistory.Tag := AITTestSuite.Tag; + AITRunHistory.Insert(); end; internal procedure RunAITestLine(AITTestMethodLine: Record "AIT Test Method Line"; IsExecutedFromTestSuiteHeader: Boolean) @@ -410,6 +416,7 @@ codeunit 149034 "AIT Test Suite Mgt." var AITTestMethodLine: Record "AIT Test Method Line"; AITLogEntry: Record "AIT Log Entry"; + AITRunHistory: Record "AIT Run History"; begin if Rec.IsTemporary() then exit; @@ -419,6 +426,9 @@ codeunit 149034 "AIT Test Suite Mgt." AITLogEntry.SetRange("Test Suite Code", Rec."Code"); AITLogEntry.DeleteAll(true); + + AITRunHistory.SetRange("Test Suite Code", Rec."Code"); + AITRunHistory.DeleteAll(true); end; [EventSubscriber(ObjectType::Table, Database::"AIT Test Method Line", OnBeforeInsertEvent, '', false, false)]