Skip to content

Commit

Permalink
Add cancel action
Browse files Browse the repository at this point in the history
  • Loading branch information
stkillen committed Dec 27, 2024
1 parent 9d15085 commit 8d1d859
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
13 changes: 8 additions & 5 deletions src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuite.Page.al
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,14 @@ page 149031 "AIT Test Suite"
}
action(ResetStatus)
{
Enabled = Rec.Status = Rec.Status::Running;
Caption = 'Reset Status';
ToolTip = 'Reset the status.';
Image = ResetStatus;
Visible = Rec.Status = Rec.Status::Running;
Caption = 'Cancel';
ToolTip = 'Cancels the run and marks the run as Cancelled.';
Image = Cancel;

trigger OnAction()
begin
AITTestSuiteMgt.ResetStatus(Rec);
AITTestSuiteMgt.CancelRun(Rec);
end;
}

Expand Down Expand Up @@ -280,6 +280,9 @@ page 149031 "AIT Test Suite"
{
group(Category_Process)
{
actionref(ResetStatus_Promoted; ResetStatus)
{
}
actionref(Start_Promoted; Start)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ codeunit 149034 "AIT Test Suite Mgt."
CannotRunMultipleSuitesInParallelErr: Label 'There is already a test run in progress. You need to wait for it to finish or cancel it before starting a new test run.';
FeatureNameLbl: Label 'AI Test Toolkit', Locked = true;
LineNoFilterLbl: Label 'Codeunit %1 "%2" (Input: %3)', Locked = true;
ConfirmCancelQst: Label 'This action will mark the run as Cancelled. Are you sure you want to continue?';

procedure StartAITSuite(Iterations: Integer; var AITTestSuite: Record "AIT Test Suite")
var
Expand Down Expand Up @@ -208,16 +209,15 @@ codeunit 149034 "AIT Test Suite Mgt."
Commit();
end;

internal procedure ResetStatus(var AITTestSuite: Record "AIT Test Suite")
internal procedure CancelRun(var AITTestSuite: Record "AIT Test Suite")
var
AITTestMethodLine: Record "AIT Test Method Line";
ConfirmResetStatusQst: Label 'This action will mark the run as Completed. Are you sure you want to continue?';
begin
if not Confirm(ConfirmResetStatusQst) then
if not Confirm(ConfirmCancelQst) then
exit;

AITTestMethodLine.SetRange("Test Suite Code", AITTestSuite."Code");
AITTestMethodLine.ModifyAll(Status, AITTestMethodLine.Status::Completed, true);
AITTestMethodLine.ModifyAll(Status, AITTestMethodLine.Status::Cancelled, true);
AITTestSuite.Status := AITTestSuite.Status::Completed;
AITTestSuite."No. of Tests Running" := 0;
AITTestSuite."Ended at" := CurrentDateTime();
Expand Down

0 comments on commit 8d1d859

Please sign in to comment.