From 2e82858adc4471e52ae20a286cbcef88a3326c2a Mon Sep 17 00:00:00 2001 From: Stig Killendahl Date: Mon, 27 Jan 2025 16:01:35 +0100 Subject: [PATCH] Code review comments --- .../src/AITTestContextImpl.Codeunit.al | 20 +++++++++---------- .../src/AITTestRunIteration.Codeunit.al | 2 +- .../src/Logs/AITLogEntries.Page.al | 6 +++--- .../src/Logs/AITLogEntry.Table.al | 10 +++++----- .../src/Logs/AITRunHistory.Page.al | 2 +- .../src/Logs/AITRunHistory.Table.al | 6 +++--- .../src/Logs/AITTestSummary.Report.al | 4 ++-- .../src/TestSuite/AITTestMethodLine.Table.al | 8 ++++---- .../src/TestSuite/AITTestMethodLines.Page.al | 6 +++--- .../src/TestSuite/AITTestSuite.Table.al | 2 +- .../src/TestSuite/AITTestSuiteMgt.Codeunit.al | 10 +++++----- 11 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/Tools/AI Test Toolkit/src/AITTestContextImpl.Codeunit.al b/src/Tools/AI Test Toolkit/src/AITTestContextImpl.Codeunit.al index d9f49b6979..ce0f1dc83c 100644 --- a/src/Tools/AI Test Toolkit/src/AITTestContextImpl.Codeunit.al +++ b/src/Tools/AI Test Toolkit/src/AITTestContextImpl.Codeunit.al @@ -18,12 +18,12 @@ codeunit 149043 "AIT Test Context Impl." var AITTestSuiteMgt: Codeunit "AIT Test Suite Mgt."; GlobalTestOutputJson: Codeunit "Test Output Json"; - Accuracy: Decimal; + GlobalAccuracy: Decimal; CurrentTurn: Integer; NumberOfTurns: Integer; IsMultiTurn: Boolean; AccuracySetManually: Boolean; - AccuracyErr: Label 'Accuracy must be between 0.0 and 1.0.'; + AccuracyErr: Label 'Accuracy must be between 0 and 1.'; AnswerTok: Label 'answer', Locked = true; ContextTok: Label 'context', Locked = true; GroundTruthTok: Label 'ground_truth', Locked = true; @@ -152,25 +152,25 @@ codeunit 149043 "AIT Test Context Impl." /// /// Sets the accuracy of the test. /// - /// The accuracy as a decimal between 0 and 1. - procedure SetAccuracy(AccuracyPct: Decimal) + /// The accuracy as a decimal between 0 and 1. + procedure SetAccuracy(Accuracy: Decimal) begin - if (AccuracyPct < 0) or (AccuracyPct > 1.0) then + if (Accuracy < 0) or (Accuracy > 1) then Error(AccuracyErr); AccuracySetManually := true; - Accuracy := AccuracyPct; + GlobalAccuracy := Accuracy; end; /// /// Gets the accuracy of the test. Can only be retrieved if the accuracy of the test was already set manually. /// - /// The accuracy as a decimal between 0 and 1. + /// The accuracy as a decimal between 0 and 1. /// True if it was possible to get the accuracy, false otherwise. - procedure GetAccuracy(var AccuracyPct: Decimal): Boolean + procedure GetAccuracy(var Accuracy: Decimal): Boolean begin if AccuracySetManually then begin - AccuracyPct := Accuracy; + Accuracy := GlobalAccuracy; exit(true); end; @@ -246,7 +246,7 @@ codeunit 149043 "AIT Test Context Impl." TurnsInputJson: Codeunit "Test Input Json"; begin AccuracySetManually := false; - Accuracy := 0; + GlobalAccuracy := 0; CurrentTurn := 1; GlobalTestOutputJson.Initialize(); TurnsInputJson := TestInput.GetTestInput().ElementExists(TurnsTok, IsMultiTurn); diff --git a/src/Tools/AI Test Toolkit/src/AITTestRunIteration.Codeunit.al b/src/Tools/AI Test Toolkit/src/AITTestRunIteration.Codeunit.al index a5cfe45c7f..6ff6678936 100644 --- a/src/Tools/AI Test Toolkit/src/AITTestRunIteration.Codeunit.al +++ b/src/Tools/AI Test Toolkit/src/AITTestRunIteration.Codeunit.al @@ -168,7 +168,7 @@ codeunit 149042 "AIT Test Run Iteration" GlobalNumberOfTurnsForLastTestMethodLine := 1; // Update Test Accuracy - GlobalTestAccuracy := 0.0; + GlobalTestAccuracy := 0; GlobalSessionAITokenUsed := AOAIToken.GetTotalServerSessionTokensConsumed(); 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 5c0e79362a..d385fafb3e 100644 --- a/src/Tools/AI Test Toolkit/src/Logs/AITLogEntries.Page.al +++ b/src/Tools/AI Test Toolkit/src/Logs/AITLogEntries.Page.al @@ -68,14 +68,14 @@ page 149033 "AIT Log Entries" { StyleExpr = StatusStyleExpr; } - field(Accuracy; Rec.Accuracy) + field(Accuracy; Rec."Test Method Line Accuracy") { } field("No. of Turns Passed"; Rec."No. of Turns Passed") { Visible = false; } - field("No. of Turns Executed"; Rec."No. of Turns Executed") + field("No. of Turns"; Rec."No. of Turns") { Visible = false; } @@ -357,7 +357,7 @@ page 149033 "AIT Log Entries" local procedure SetTurnsStyleExpr() begin case Rec."No. of Turns Passed" of - Rec."No. of Turns Executed": + Rec."No. of Turns": TurnsStyleExpr := 'Favorable'; 0: TurnsStyleExpr := 'Unfavorable'; 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 e024c8533d..679b9cb89a 100644 --- a/src/Tools/AI Test Toolkit/src/Logs/AITLogEntry.Table.al +++ b/src/Tools/AI Test Toolkit/src/Logs/AITLogEntry.Table.al @@ -159,20 +159,20 @@ table 149034 "AIT Log Entry" { Caption = 'Output Data'; } - field(40; "No. of Turns Executed"; Integer) + field(40; "No. of Turns"; Integer) { Caption = 'Total number of turns'; - ToolTip = 'Specifies the total number of turns executed.'; + ToolTip = 'Specifies the total number of turns.'; } field(41; "No. of Turns Passed"; Integer) { Caption = 'Number of turns passed'; ToolTip = 'Specifies the number of turns passed.'; } - field(45; Accuracy; Decimal) + field(45; "Test Method Line Accuracy"; Decimal) { - Caption = 'Accuracy'; - ToolTip = 'Specifies the accuracy of the test line. The accuracy is calculated as the percentage of turns that passed or can be set manually by the test.'; + Caption = 'Test Method Line Accuracy'; + ToolTip = 'Specifies the accuracy of the test line. The accuracy is calculated as the percentage of turns that passed or can be set manually in the test.'; } field(50; "Tokens Consumed"; Integer) { diff --git a/src/Tools/AI Test Toolkit/src/Logs/AITRunHistory.Page.al b/src/Tools/AI Test Toolkit/src/Logs/AITRunHistory.Page.al index d5fa13ed6a..071e3c5b15 100644 --- a/src/Tools/AI Test Toolkit/src/Logs/AITRunHistory.Page.al +++ b/src/Tools/AI Test Toolkit/src/Logs/AITRunHistory.Page.al @@ -121,7 +121,7 @@ page 149032 "AIT Run History" AITLogEntryCodeunit.DrillDownFailedAITLogEntries(Rec."Test Suite Code", Rec."Line No. Filter", Rec.Version); end; } - field("Accuracy - By Version"; Rec.Accuracy) + field("Accuracy - By Version"; Rec."Accuracy Per Version") { Visible = ViewBy = ViewBy::Version; Caption = 'Accuracy'; diff --git a/src/Tools/AI Test Toolkit/src/Logs/AITRunHistory.Table.al b/src/Tools/AI Test Toolkit/src/Logs/AITRunHistory.Table.al index 3a114eddfb..dfeb99366f 100644 --- a/src/Tools/AI Test Toolkit/src/Logs/AITRunHistory.Table.al +++ b/src/Tools/AI Test Toolkit/src/Logs/AITRunHistory.Table.al @@ -73,13 +73,13 @@ table 149036 "AIT Run History" 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(14; "Accuracy"; Decimal) + field(14; "Accuracy Per Version"; Decimal) { Caption = 'Accuracy'; ToolTip = 'Specifies the average accuracy of the version.'; Editable = false; FieldClass = FlowField; - CalcFormula = average("AIT Log Entry"."Accuracy" where("Test Suite Code" = field("Test Suite Code"), "Test Method Line No." = field("Line No. Filter"), Version = field("Version"), Operation = const('Run Procedure'), "Procedure Name" = filter(<> ''))); + CalcFormula = average("AIT Log Entry"."Test Method Line Accuracy" where("Test Suite Code" = field("Test Suite Code"), "Test Method Line No." = field("Line No. Filter"), Version = field("Version"), Operation = const('Run Procedure'), "Procedure Name" = filter(<> ''))); } field(20; "No. of Tests Executed - By Tag"; Integer) { @@ -119,7 +119,7 @@ table 149036 "AIT Run History" ToolTip = 'Specifies the average accuracy of the tag.'; Editable = false; FieldClass = FlowField; - CalcFormula = average("AIT Log Entry"."Accuracy" 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(<> ''))); + CalcFormula = average("AIT Log Entry"."Test Method Line Accuracy" 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(<> ''))); } } diff --git a/src/Tools/AI Test Toolkit/src/Logs/AITTestSummary.Report.al b/src/Tools/AI Test Toolkit/src/Logs/AITTestSummary.Report.al index 3313d8bb09..5c959e62fc 100644 --- a/src/Tools/AI Test Toolkit/src/Logs/AITTestSummary.Report.al +++ b/src/Tools/AI Test Toolkit/src/Logs/AITTestSummary.Report.al @@ -32,10 +32,10 @@ report 149030 "AIT Test Summary" column(Status; Results.Status) { } - column(Accuracy; Results.Accuracy) + column(Accuracy; Results."Test Method Line Accuracy") { } - column(TurnsExecuted; Results."No. of Turns Executed") + column(TurnsExecuted; Results."No. of Turns") { } column(TurnsPassed; Results."No. of Turns Passed") 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 fa166aec8b..91e3925e07 100644 --- a/src/Tools/AI Test Toolkit/src/TestSuite/AITTestMethodLine.Table.al +++ b/src/Tools/AI Test Toolkit/src/TestSuite/AITTestMethodLine.Table.al @@ -166,13 +166,13 @@ table 149032 "AIT Test Method Line" FieldClass = FlowField; CalcFormula = count("AIT Log Entry" where("Test Suite Code" = field("Test Suite Code"), "Test Method Line No." = field("Line No."), Version = field("Base Version Filter"))); } - field(40; "No. of Turns Executed"; Integer) + field(40; "No. of Turns"; Integer) { Caption = 'No. of Turns Executed'; ToolTip = 'Specifies the total number of turns for the test line.'; Editable = false; FieldClass = FlowField; - CalcFormula = sum("AIT Log Entry"."No. of Turns Executed" where("Test Suite Code" = field("Test Suite Code"), "Test Method Line No." = field("Line No."), Version = field("Version Filter"), Operation = const('Run Procedure'), "Procedure Name" = filter(<> ''))); + CalcFormula = sum("AIT Log Entry"."No. of Turns" where("Test Suite Code" = field("Test Suite Code"), "Test Method Line No." = field("Line No."), Version = field("Version Filter"), Operation = const('Run Procedure'), "Procedure Name" = filter(<> ''))); } field(41; "No. of Turns Passed"; Integer) { @@ -182,13 +182,13 @@ table 149032 "AIT Test Method Line" FieldClass = FlowField; CalcFormula = sum("AIT Log Entry"."No. of Turns Passed" where("Test Suite Code" = field("Test Suite Code"), "Test Method Line No." = field("Line No."), Version = field("Version Filter"), Operation = const('Run Procedure'), "Procedure Name" = filter(<> ''))); } - field(45; Accuracy; Decimal) + field(45; "Test Method Line Accuracy"; Decimal) { Caption = 'Accuracy'; ToolTip = 'Specifies the average accuracy of the test line. The accuracy is calculated as the percentage of turns that passed or can be set manually by the test.'; Editable = false; FieldClass = FlowField; - CalcFormula = average("AIT Log Entry"."Accuracy" where("Test Suite Code" = field("Test Suite Code"), "Test Method Line No." = field("Line No."), Version = field("Version Filter"), Operation = const('Run Procedure'), "Procedure Name" = filter(<> ''))); + CalcFormula = average("AIT Log Entry"."Test Method Line Accuracy" where("Test Suite Code" = field("Test Suite Code"), "Test Method Line No." = field("Line No."), Version = field("Version Filter"), Operation = const('Run Procedure'), "Procedure Name" = filter(<> ''))); } field(101; "AL Test Suite"; Code[10]) { 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 9faae8490a..8df370b565 100644 --- a/src/Tools/AI Test Toolkit/src/TestSuite/AITTestMethodLines.Page.al +++ b/src/Tools/AI Test Toolkit/src/TestSuite/AITTestMethodLines.Page.al @@ -73,7 +73,7 @@ page 149034 "AIT Test Method Lines" AITLogEntry.DrillDownFailedAITLogEntries(Rec."Test Suite Code", Rec."Line No.", AITTestSuite.Version); end; } - field(Accuracy; Rec.Accuracy) + field(Accuracy; Rec."Test Method Line Accuracy") { } field(TurnsText; TurnsText) @@ -93,7 +93,7 @@ page 149034 "AIT Test Method Lines" AITLogEntry.DrillDownFailedAITLogEntries(Rec."Test Suite Code", Rec."Line No.", AITTestSuite."Base Version"); end; } - field("No. of Turns"; Rec."No. of Turns Executed") + field("No. of Turns"; Rec."No. of Turns") { Visible = false; } @@ -101,7 +101,7 @@ page 149034 "AIT Test Method Lines" { Visible = false; } - field("No. of Turns Failed"; Rec."No. of Turns Executed" - Rec."No. of Turns Passed") + field("No. of Turns Failed"; Rec."No. of Turns" - Rec."No. of Turns Passed") { Visible = false; Editable = false; 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 c0594135e4..09e657cb00 100644 --- a/src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuite.Table.al +++ b/src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuite.Table.al @@ -167,7 +167,7 @@ table 149030 "AIT Test Suite" ToolTip = 'Specifies the average accuracy of the test suite. The accuracy is calculated as the percentage of turns that passed or can be set manually by the test.'; Editable = false; FieldClass = FlowField; - CalcFormula = average("AIT Log Entry"."Accuracy" where("Test Suite Code" = field("Code"), Version = field("Version"), Operation = const('Run Procedure'), "Procedure Name" = filter(<> ''))); + CalcFormula = average("AIT Log Entry"."Test Method Line Accuracy" where("Test Suite Code" = field("Code"), Version = field("Version"), Operation = const('Run Procedure'), "Procedure Name" = filter(<> ''))); } field(50; "Test Runner Id"; Integer) { 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 2a0eac77c1..fd0b1755ea 100644 --- a/src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuiteMgt.Codeunit.al +++ b/src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuiteMgt.Codeunit.al @@ -359,9 +359,9 @@ codeunit 149034 "AIT Test Suite Mgt." AITLogEntry."Procedure Name" := CurrentTestMethodLine.Function; AITLogEntry."Tokens Consumed" := AITTestRunIteration.GetAITokenUsedByLastTestMethodLine(); - AITLogEntry."No. of Turns Executed" := AITTestRunIteration.GetNumberOfTurnsForLastTestMethodLine(); + AITLogEntry."No. of Turns" := AITTestRunIteration.GetNumberOfTurnsForLastTestMethodLine(); AITLogEntry."No. of Turns Passed" := AITTestRunIteration.GetNumberOfTurnsPassedForLastTestMethodLine(); - AITLogEntry.Accuracy := AITTestRunIteration.GetAccuracyForLastTestMethodLine(); + AITLogEntry."Test Method Line Accuracy" := AITTestRunIteration.GetAccuracyForLastTestMethodLine(); AITLogEntry.Insert(true); Commit(); @@ -380,13 +380,13 @@ codeunit 149034 "AIT Test Suite Mgt." internal procedure GetTurnsAsText(var AITTestMethodLine: Record "AIT Test Method Line"): Text begin - AITTestMethodLine.CalcFields("No. of Turns Passed", "No. of Turns Executed"); - exit(StrSubstNo(TurnsLbl, AITTestMethodLine."No. of Turns Passed", AITTestMethodLine."No. of Turns Executed")); + AITTestMethodLine.CalcFields("No. of Turns Passed", "No. of Turns"); + exit(StrSubstNo(TurnsLbl, AITTestMethodLine."No. of Turns Passed", AITTestMethodLine."No. of Turns")); end; internal procedure GetTurnsAsText(var AITLogEntry: Record "AIT Log Entry"): Text begin - exit(StrSubstNo(TurnsLbl, AITLogEntry."No. of Turns Passed", AITLogEntry."No. of Turns Executed")); + exit(StrSubstNo(TurnsLbl, AITLogEntry."No. of Turns Passed", AITLogEntry."No. of Turns")); end; internal procedure GetAvgDuration(AITTestMethodLine: Record "AIT Test Method Line"): Integer