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

[AI Test Tool] Add cancel action for running suites #2614

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading