├── .gitignore ├── ALTestTool ├── ALTestTool.code-workspace ├── App │ ├── .gitignore │ ├── Images │ │ └── logo.png │ ├── app.json │ └── src │ │ ├── Codeunits │ │ ├── SetActionsEnablingALTT.Codeunit.al │ │ └── SetRunOnTestToolALTT.Codeunit.al │ │ ├── Page Extensions │ │ └── ALTestToolALTT.PageExt.al │ │ ├── Table Extensions │ │ └── TestMethodLineALTT.TableExt.al │ │ └── Tables │ │ └── ActionEnablArgsALTT.Table.al ├── Test │ ├── .gitignore │ ├── Images │ │ └── logo.png │ ├── app.json │ ├── atdd.scenarios │ │ ├── EnablingActionsSelectDeselectOnAllScenarios.ps1 │ │ ├── EnablingActionsSelectDeselectOnFailuresScenarios.ps1 │ │ ├── EnablingActionsSelectDeselectOnNonFailuresScenarios.ps1 │ │ ├── InstallModuleATDDTestScriptor.ps1 │ │ └── RunOnTestFunctionsScenarios.ps1 │ └── src │ │ └── codeunit │ │ ├── EnablActnsFlrsALTT.Codeunit.al │ │ ├── EnablActnsNonFlrsALTT.al │ │ ├── EnablActnsSelectALTT.Codeunit.al │ │ ├── LibPerfSelectALTT.Codeunit.al │ │ ├── LibTestFunctLnsALTT.Codeunit.al │ │ ├── LibVerifyActnsALTT.Codeunit.al │ │ ├── RunonTestFunctionsALTT.Codeunit.al │ │ └── TestInstallTTE.Codeunit.al └── azure-pipelines.yml ├── CALTestTool ├── .gitignore ├── ATDD Scenarios │ ├── EnablingActionsSelectDeselectOnAllScenarios.ps1 │ ├── EnablingActionsSelectDeselectOnFailuresScenarios.ps1 │ ├── EnablingActionsSelectDeselectOnNonFailuresScenarios.ps1 │ ├── InstallModuleATDDTestScriptor.ps1 │ └── RunOnTestFunctionsScenarios.ps1 ├── Images │ └── logo.png ├── app.json ├── src │ ├── Codeunits │ │ ├── Cod92000.SetActionsEnablingonTTFLX.al │ │ └── Cod92001.SetRunOnTestToolFLX.al │ ├── Page Extensions │ │ └── Pag130401-Ext92000.CALTestToolPageExt.al │ ├── Table Extensions │ │ └── Tab130401-Ext92000.CALTestLineTableExt.al │ └── Tables │ │ └── Tab92000.ActionEnablingArgumentsFLX.al └── test │ ├── Test Codeunits │ ├── Cod92050.RunonTestFunctionsFLX.al │ ├── Cod92051.EnablActnsSelectOnAllFLX.al │ ├── Cod92052.EnablingActionsSelectDeselectOnFailuresScenarios.al │ └── Cod92053.EnablingActionsSelectDeselectOnNonFailuresScenarios.al │ └── Test Libraries │ ├── Cod92060.LibTestFunctionLnsFLX.al │ ├── Cod92061.LibraryVerifyActionsFLX.al │ └── Cod92062.LibraryPerformSelectFLX.al ├── Images ├── AL Test Tool Extension Actions.png ├── Test Tool Extension Actions (Web Client).png └── Test Tool Extension Actions (Windows Client).png ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignores generated binary files and temporary files from Visual Studio and Visual Studio code 2 | 3 | # Binary files 4 | .alpackages/ 5 | *.app 6 | 7 | # Temp files 8 | .vs/ 9 | .vscode/ 10 | -------------------------------------------------------------------------------- /ALTestTool/ALTestTool.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "App" 5 | }, 6 | { 7 | "path": "Test" 8 | } 9 | ] 10 | } -------------------------------------------------------------------------------- /ALTestTool/App/.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignores generated binary files and temporary files from Visual Studio and Visual Studio code 2 | 3 | # Binary files 4 | .alpackages/ 5 | *.app 6 | 7 | # Temp files 8 | .vs/ 9 | .vscode/ 10 | -------------------------------------------------------------------------------- /ALTestTool/App/Images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluxxus-nl/Test-Tool-Extension/d2169d2ba3c2f048533636b8e8e38069ff69926b/ALTestTool/App/Images/logo.png -------------------------------------------------------------------------------- /ALTestTool/App/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "2b7d8424-6abd-4580-87cb-1cdedd461f11", 3 | "name": "AL TestTool Extension", 4 | "publisher": "fluxxus.nl", 5 | "version": "1.0.0.0", 6 | "brief": "AL TestTool extension for book Automated Testing in Microsoft Dynamics 365 Business Central", 7 | "description": "AL TestTool extension extends the standard AL Test Tool with a number of useful features", 8 | "privacyStatement": "", 9 | "EULA": "", 10 | "help": "https://github.com/fluxxus-nl/Test-Tool-Extension", 11 | "url": "http://www.fluxxus.nl", 12 | "logo": "images/logo.png", 13 | "platform": "16.0.0.0", 14 | "application": "16.0.0.0", 15 | "dependencies": [ 16 | { 17 | "id": "23de40a6-dfe8-4f80-80db-d70f83ce8caf", 18 | "name": "Test Runner", 19 | "publisher": "Microsoft", 20 | "version": "16.0.0.0" 21 | } 22 | ], 23 | "screenshots": [], 24 | "idRanges": [ 25 | { 26 | "from": 92100, 27 | "to": 92199 28 | } 29 | ], 30 | "showMyCode": true, 31 | "runtime": "5.0" 32 | } -------------------------------------------------------------------------------- /ALTestTool/App/src/Codeunits/SetActionsEnablingALTT.Codeunit.al: -------------------------------------------------------------------------------- 1 | codeunit 92100 "Set Actions Enabling ALTT FLX" 2 | { 3 | // (c) fluxxus.nl - https://github.com/fluxxus-nl/Test-Tool-Extension 4 | 5 | procedure SetActionsEnabling(var TestMethodLine: Record "Test Method Line"; var ActionEnablingArguments: Record "Action Enabl. Args. ALTT FLX") 6 | var 7 | TestMethodLine2: Record "Test Method Line"; 8 | begin 9 | TestMethodLine2.CopyFilters(TestMethodLine); 10 | 11 | TestMethodLine2.SetRange(Run, false); 12 | ActionEnablingArguments.SelectAllEnabled := not TestMethodLine2.IsEmpty(); 13 | 14 | TestMethodLine2.SetRange(Run, true); 15 | ActionEnablingArguments.DeselectAllEnabled := not TestMethodLine2.IsEmpty(); 16 | 17 | if not ActionEnablingArguments.SelectAllEnabled and not ActionEnablingArguments.DeselectAllEnabled then begin 18 | ActionEnablingArguments.SelectFailuresEnabled := false; 19 | ActionEnablingArguments.SelectNonFailuresEnabled := false; 20 | exit; 21 | end; 22 | 23 | TestMethodLine2.SetRange(Run); 24 | TestMethodLine2.SetRange(Result, TestMethodLine2.Result::Failure); 25 | if TestMethodLine2.IsEmpty() then begin 26 | ActionEnablingArguments.SelectFailuresEnabled := false; 27 | 28 | TestMethodLine2.SetFilter(Result, '<>%1', TestMethodLine2.Result::Failure); 29 | TestMethodLine2.SetRange(Run, false); 30 | ActionEnablingArguments.SelectNonFailuresEnabled := not TestMethodLine2.IsEmpty(); 31 | exit; 32 | end; 33 | 34 | ActionEnablingArguments.SelectFailuresEnabled := 35 | AreFailuresDeselected(TestMethodLine2); 36 | 37 | ActionEnablingArguments.SelectNonFailuresEnabled := 38 | AreNonFailuresDeselected(TestMethodLine2); 39 | end; 40 | 41 | local procedure AreNonFailuresDeselected(var TestMethodLine: Record "Test Method Line"): Boolean 42 | var 43 | TestMethodLine2: Record "Test Method Line"; 44 | begin 45 | TestMethodLine2.CopyFilters(TestMethodLine); 46 | TestMethodLine2.SetRange("Line Type", TestMethodLine2."Line Type"::"Function"); 47 | TestMethodLine2.SetFilter("Function", '<>%1', 'OnRun'); 48 | TestMethodLine2.SetFilter(Result, '<>%1', TestMethodLine2.Result::Failure); 49 | TestMethodLine2.SetRange(Run, false); 50 | exit(not TestMethodLine2.IsEmpty()); 51 | end; 52 | 53 | local procedure AreFailuresDeselected(var TestMethodLine: Record "Test Method Line"): Boolean 54 | var 55 | TestMethodLine2: Record "Test Method Line"; 56 | begin 57 | TestMethodLine2.CopyFilters(TestMethodLine); 58 | TestMethodLine2.SetRange("Line Type", TestMethodLine2."Line Type"::"Function"); 59 | TestMethodLine2.SetFilter("Function", '<>%1', 'OnRun'); 60 | TestMethodLine2.SetRange(Result, TestMethodLine2.Result::Failure); 61 | TestMethodLine2.SetRange(Run, false); 62 | exit(not TestMethodLine2.IsEmpty()); 63 | end; 64 | } -------------------------------------------------------------------------------- /ALTestTool/App/src/Codeunits/SetRunOnTestToolALTT.Codeunit.al: -------------------------------------------------------------------------------- 1 | codeunit 92101 "Set Run On Test Tool ALTT FLX" 2 | { 3 | // (c) fluxxus.nl - https://github.com/fluxxus-nl/Test-Tool-Extension 4 | 5 | procedure SetRun(var TestMethodLine: Record "Test Method Line"; RunType: Option All,"None",Failures,NonFailures) 6 | var 7 | TestMethodLine2: Record "Test Method Line"; 8 | begin 9 | TestMethodLine2.CopyFilters(TestMethodLine); 10 | 11 | if TestMethodLine."Test Suite" <> '' then 12 | TestMethodLine2.SetRange("Test Suite", TestMethodLine."Test Suite"); 13 | 14 | case RunType of 15 | RunType::"None": 16 | SetRunOnNone(TestMethodLine2); 17 | RunType::All: 18 | SetRunOnAll(TestMethodLine2); 19 | RunType::NonFailures: 20 | SetRunOnNonFailures(TestMethodLine2); 21 | RunType::Failures: 22 | SetRunOnFailures(TestMethodLine2); 23 | end; 24 | end; 25 | 26 | local procedure SetRunOnNone(var TestMethodLine: Record "Test Method Line") 27 | begin 28 | TestMethodLine.ModifyAll(Run, false); 29 | end; 30 | 31 | local procedure SetRunOnAll(var TestMethodLine: Record "Test Method Line") 32 | begin 33 | TestMethodLine.ModifyAll(Run, true); 34 | end; 35 | 36 | local procedure SetRunOnNonFailures(var TestMethodLine: Record "Test Method Line") 37 | begin 38 | SetRunOnAll(TestMethodLine); 39 | TurnOffRunOnFailingFunctions(TestMethodLine); 40 | end; 41 | 42 | local procedure SetRunOnFailures(var TestMethodLine: Record "Test Method Line") 43 | begin 44 | SetRunOnNone(TestMethodLine); 45 | TurnOnRunOnFailingFunctions(TestMethodLine); 46 | end; 47 | 48 | local procedure TurnOffRunOnFailingFunctions(var TestMethodLine: Record "Test Method Line") 49 | begin 50 | TestMethodLine.SetRange("Line Type", TestMethodLine."Line Type"::"Function"); 51 | TestMethodLine.SetRange(Result, TestMethodLine.Result::Failure); 52 | TestMethodLine.ModifyAll(Run, false); 53 | 54 | TurnOffRunOnOnRunOfFullyFailingCodeunit(TestMethodLine); 55 | end; 56 | 57 | local procedure TurnOffRunOnOnRunOfFullyFailingCodeunit(var TestMethodLine: Record "Test Method Line") 58 | var 59 | TestMethodLine2: Record "Test Method Line"; 60 | begin 61 | TestMethodLine.SetRange("Line Type", TestMethodLine."Line Type"::"Codeunit"); 62 | if TestMethodLine.FindSet() then 63 | repeat 64 | TestMethodLine2.SetRange("Test Codeunit", TestMethodLine."Test Codeunit"); 65 | TestMethodLine2.SetRange("Line Type", TestMethodLine."Line Type"::"Function"); 66 | TestMethodLine2.SetFilter("Function", '<>%1', 'OnRun'); 67 | TestMethodLine2.SetRange(Run, true); 68 | if TestMethodLine2.IsEmpty() then begin 69 | TestMethodLine2.SetRange("Line Type"); 70 | TestMethodLine2.SetRange("Function"); 71 | TestMethodLine2.SetRange(Run); 72 | TestMethodLine2.ModifyAll(Run, false); 73 | end; 74 | until TestMethodLine.Next() = 0; 75 | end; 76 | 77 | local procedure TurnOnRunOnFailingFunctions(var TestMethodLine: Record "Test Method Line") 78 | var 79 | begin 80 | TestMethodLine.SetFilter("Line Type", '%1|%2', TestMethodLine."Line Type"::"Codeunit", TestMethodLine."Line Type"::"Function"); 81 | TestMethodLine.SetRange(Result, TestMethodLine.Result::Failure); 82 | TestMethodLine.ModifyAll(Run, true); 83 | 84 | TurnOnRunOnOnRunOfFullyFailingCodeunit(TestMethodLine); 85 | end; 86 | 87 | local procedure TurnOnRunOnOnRunOfFullyFailingCodeunit(var TestMethodLine: Record "Test Method Line") 88 | var 89 | TestMethodLine2: Record "Test Method Line"; 90 | begin 91 | TestMethodLine.SetRange("Line Type", TestMethodLine."Line Type"::"Codeunit"); 92 | if TestMethodLine.FindSet() then 93 | repeat 94 | TestMethodLine2.SetRange("Test Codeunit", TestMethodLine."Test Codeunit"); 95 | TestMethodLine2.SetRange("Function", 'OnRun'); 96 | TestMethodLine2.ModifyAll(Run, true); 97 | until TestMethodLine.Next() = 0; 98 | end; 99 | } -------------------------------------------------------------------------------- /ALTestTool/App/src/Page Extensions/ALTestToolALTT.PageExt.al: -------------------------------------------------------------------------------- 1 | pageextension 92100 "AL Test Tool ALTT FLX" extends "AL Test Tool" //130451 2 | { 3 | // (c) fluxxus.nl - https://github.com/fluxxus-nl/Test-Tool-Extension 4 | 5 | layout 6 | { 7 | modify(Run) 8 | { 9 | trigger OnAfterValidate() 10 | begin 11 | Modify(); 12 | SetActionsEnabling(); 13 | end; 14 | } 15 | } 16 | 17 | actions 18 | { 19 | modify(DeleteLines) 20 | { 21 | trigger OnAfterAction() 22 | begin 23 | SetActionsEnabling(); 24 | end; 25 | } 26 | 27 | modify(GetTestCodeunits) 28 | { 29 | trigger OnAfterAction() 30 | begin 31 | SetActionsEnabling(); 32 | end; 33 | } 34 | 35 | modify(RunTests) 36 | { 37 | trigger OnAfterAction() 38 | begin 39 | SetActionsEnabling(); 40 | end; 41 | } 42 | 43 | modify(RunSelectedTests) 44 | { 45 | ShortcutKey = 'Ctrl+F9'; 46 | 47 | trigger OnAfterAction() 48 | begin 49 | SetActionsEnabling(); 50 | end; 51 | } 52 | 53 | addafter(SelectTestRunner) 54 | { 55 | group(SelectFLX) 56 | { 57 | Caption = '&Select Run'; 58 | 59 | action(SelectAllFLX) 60 | { 61 | Caption = 'Select on All'; 62 | ToolTip = 'Select Run on all tests.'; 63 | ApplicationArea = All; 64 | Image = AllLines; 65 | Enabled = SelectAllEnabled; 66 | 67 | trigger OnAction() 68 | begin 69 | SetRunOnTests(0) // 0 = All 70 | end; 71 | } 72 | action(DeselectAllFLX) 73 | { 74 | Caption = 'Deselect on All'; 75 | ToolTip = 'Deselect Run on all tests.'; 76 | ApplicationArea = All; 77 | Image = CancelAllLines; 78 | Enabled = DeselectAllEnabled; 79 | 80 | trigger OnAction() 81 | begin 82 | SetRunOnTests(1) // 1 = None 83 | end; 84 | } 85 | action(SelectFailuresFLX) 86 | { 87 | Caption = 'Select on Failures'; 88 | ToolTip = 'Select Run on all failing tests and deselect on all others.'; 89 | ApplicationArea = All; 90 | Image = EnableAllBreakpoints; 91 | Enabled = SelectFailuresEnabled; 92 | 93 | trigger OnAction() 94 | begin 95 | SetRunOnTests(2) // 2 = Failures 96 | end; 97 | } 98 | action(SelectNonFailuresFLX) 99 | { 100 | Caption = 'Select on Non Failures'; 101 | ToolTip = 'Deselect Run on all failing tests and select on all others.'; 102 | ApplicationArea = All; 103 | Image = DisableAllBreakpoints; 104 | Enabled = SelectNonFailuresEnabled; 105 | 106 | trigger OnAction() 107 | begin 108 | SetRunOnTests(3) // 3 = NonFailures 109 | end; 110 | } 111 | } 112 | } 113 | } 114 | var 115 | SelectAllEnabled: Boolean; 116 | DeselectAllEnabled: Boolean; 117 | SelectFailuresEnabled: Boolean; 118 | SelectNonFailuresEnabled: Boolean; 119 | 120 | trigger OnOpenPage() 121 | begin 122 | SetActionsEnabling(); 123 | end; 124 | 125 | local procedure SetRunOnTests(RunType: Option All,"Non",Failures,NonFailures) 126 | var 127 | SetRunOnTestTool: Codeunit "Set Run On Test Tool ALTT FLX"; 128 | begin 129 | SetRunOnTestTool.SetRun(Rec, RunType); 130 | SetActionsEnabling(); 131 | end; 132 | 133 | local procedure SetActionsEnabling() 134 | var 135 | ActionEnablingArguments: Record "Action Enabl. Args. ALTT FLX"; 136 | SetActionsEnablingForTestTool: Codeunit "Set Actions Enabling ALTT FLX"; 137 | begin 138 | SetActionsEnablingForTestTool.SetActionsEnabling(Rec, ActionEnablingArguments); 139 | 140 | SelectAllEnabled := ActionEnablingArguments.SelectAllEnabled; 141 | DeselectAllEnabled := ActionEnablingArguments.DeselectAllEnabled; 142 | SelectFailuresEnabled := ActionEnablingArguments.SelectFailuresEnabled; 143 | SelectNonFailuresEnabled := ActionEnablingArguments.SelectNonFailuresEnabled; 144 | 145 | CurrPage.Update(false); 146 | end; 147 | } -------------------------------------------------------------------------------- /ALTestTool/App/src/Table Extensions/TestMethodLineALTT.TableExt.al: -------------------------------------------------------------------------------- 1 | tableextension 92100 "Test Method Line ALTT FLX" extends "Test Method Line" //130450 2 | { 3 | // (c) fluxxus.nl - https://github.com/fluxxus-nl/Test-Tool-Extension 4 | 5 | procedure InitRecord(NewSuiteName: Code[10]; NewLineNo: Integer; NewLineType: Option "Group","Codeunit","Function"; NewCodeunitID: Integer; NewActive: Boolean) 6 | begin 7 | "Test Suite" := NewSuiteName; 8 | "Line No." := NewLineNo; 9 | "Test Codeunit" := NewCodeunitID; 10 | "Line Type" := NewLineType; 11 | Validate(Run, NewActive); 12 | end; 13 | } -------------------------------------------------------------------------------- /ALTestTool/App/src/Tables/ActionEnablArgsALTT.Table.al: -------------------------------------------------------------------------------- 1 | table 92100 "Action Enabl. Args. ALTT FLX" 2 | { 3 | // (c) fluxxus.nl - https://github.com/fluxxus-nl/Test-Tool-Extension 4 | 5 | fields 6 | { 7 | field(1; SelectAllEnabled; Boolean) { } 8 | field(2; DeselectAllEnabled; Boolean) { } 9 | field(3; SelectFailuresEnabled; Boolean) { } 10 | field(4; SelectNonFailuresEnabled; Boolean) { } 11 | } 12 | 13 | keys 14 | { 15 | key(PK; SelectAllEnabled) 16 | { 17 | Clustered = true; 18 | } 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /ALTestTool/Test/.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignores generated binary files and temporary files from Visual Studio and Visual Studio code 2 | 3 | # Binary files 4 | .alpackages/ 5 | .snapshots/ 6 | *.app 7 | 8 | # Temp files 9 | .vs/ 10 | .vscode/ 11 | .altestrunner/ -------------------------------------------------------------------------------- /ALTestTool/Test/Images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluxxus-nl/Test-Tool-Extension/d2169d2ba3c2f048533636b8e8e38069ff69926b/ALTestTool/Test/Images/logo.png -------------------------------------------------------------------------------- /ALTestTool/Test/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "19470ce1-3be3-4745-a8f0-9f665e8546cb", 3 | "name": "AL TestTool Extension (test)", 4 | "publisher": "fluxxus.nl", 5 | "version": "1.0.0.0", 6 | "brief": "Example test app for AL TestTool extension", 7 | "description": "AL TestTool extension extends the standard AL Test Tool with a number of useful features", 8 | "privacyStatement": "", 9 | "EULA": "", 10 | "help": "https://github.com/fluxxus-nl/Test-Tool-Extension", 11 | "url": "http://www.fluxxus.nl", 12 | "logo": "images/logo.png", 13 | "platform": "16.0.0.0", 14 | "application": "16.0.0.0", 15 | "dependencies": [ 16 | { 17 | "id": "23de40a6-dfe8-4f80-80db-d70f83ce8caf", 18 | "name": "Test Runner", 19 | "publisher": "Microsoft", 20 | "version": "16.0.0.0" 21 | }, 22 | { 23 | "id": "5d86850b-0d76-4eca-bd7b-951ad998e997", 24 | "name": "Tests-TestLibraries", 25 | "publisher": "Microsoft", 26 | "version": "16.0.0.0" 27 | }, 28 | { 29 | "id": "2b7d8424-6abd-4580-87cb-1cdedd461f11", 30 | "name": "AL TestTool Extension", 31 | "publisher": "fluxxus.nl", 32 | "version": "1.0.0.0" 33 | } 34 | ], 35 | "screenshots": [], 36 | "idRanges": [ 37 | { 38 | "from": 92100, 39 | "to": 92199 40 | } 41 | ], 42 | "showMyCode": true, 43 | "runtime": "5.0" 44 | } -------------------------------------------------------------------------------- /ALTestTool/Test/atdd.scenarios/EnablingActionsSelectDeselectOnAllScenarios.ps1: -------------------------------------------------------------------------------- 1 | $Features = @() 2 | 3 | $Features += 4 | Feature 'Enabling Actions Select/Deselect on All Unfiltered' { 5 | Scenario 1 'Unfiltered disabled test functions' { 6 | Given 'One disabled test codeunit with five disabled test functions' 7 | Given 'One disabled test codeunit with three disabled test functions' 8 | When 'Do nothing' 9 | Then 'Select on All is enabled' 10 | Then 'Deselect on All is disabled' 11 | } 12 | 13 | Scenario 2 'Unfiltered enabled test functions' { 14 | Given 'One enabled test codeunit with five enabled test functions' 15 | Given 'One enabled test codeunit with three enabled test functions' 16 | When 'Do nothing' 17 | Then 'Select on All is disabled' 18 | Then 'Deselect on All is enabled' 19 | } 20 | 21 | Scenario 3 'Unfiltered enabled and disbled test functions' { 22 | Given 'One enabled test codeunit with five enabled test functions' 23 | Given 'One disabled test codeunit with three disabled test functions' 24 | When 'Do nothing' 25 | Then 'Select on All is enabled' 26 | Then 'Deselect on All is enabled' 27 | } 28 | 29 | Scenario 4 'Enable Run on unfiltered successful test functions' { 30 | Given 'One disabled test codeunit with five disabled successful test functions' 31 | Given 'One disabled test codeunit with three disabled successful test functions' 32 | When 'Perform Select on All' 33 | Then 'Run is set on all test codeunits and functions' 34 | Then 'Select on All is disabled' 35 | Then 'Deselect on All is enabled' 36 | } 37 | 38 | Scenario 5 'Disable Run on unfiltered successful test functions' { 39 | Given 'One enabled test codeunit with five enabled successful test functions' 40 | Given 'One enabled test codeunit with three enabled successful test functions' 41 | When 'Perform Deselect on All' 42 | Then 'Run is not set on all test codeunits and functions' 43 | Then 'Select on All is enabled' 44 | Then 'Deselect on All is disabled' 45 | } 46 | } 47 | 48 | $Features += 49 | Feature 'Enabling Actions Select/Deselect on All Filtered' { 50 | Scenario 6 'Filtered disabled test functions' { 51 | Given 'One disabled test codeunit with five disabled test functions' 52 | Given 'One disabled test codeunit with three disabled test functions' 53 | When 'Set filter on second test codeunit' 54 | Then 'Select on All is enabled' 55 | Then 'Deselect on All is disabled' 56 | } 57 | 58 | Scenario 7 'Filtered enabled test functions' { 59 | Given 'One enabled test codeunit with five enabled test functions' 60 | Given 'One enabled test codeunit with three enabled test functions' 61 | When 'Set filter on second test codeunit' 62 | Then 'Select on All is disabled' 63 | Then 'Deselect on All is enabled' 64 | } 65 | 66 | Scenario 8 'Filtered enabled and disabled test functions' { 67 | Given 'One enabled test codeunit with five enabled test functions' 68 | Given 'One disabled test codeunit with three disabled test functions' 69 | When 'Set filter on second test codeunit' 70 | Then 'Select on All is enabled' 71 | Then 'Deselect on All is disabled' 72 | } 73 | 74 | Scenario 9 'Enable Run on filtered successful test functions' { 75 | Given 'One disabled test codeunit with five disabled successful test functions' 76 | Given 'One disabled test codeunit with three disabled successful test functions' 77 | Given 'Filter on second test codeunit' 78 | When 'Perform Select on All' 79 | Then 'Run is set on second test codeunit and functions' 80 | Then 'Select on All is disabled' 81 | Then 'Deselect on All is enabled' 82 | } 83 | 84 | Scenario 10 'Disable Run on filtered successful test functions' { 85 | Given 'One enabled test codeunit with five enabled successful test functions' 86 | Given 'One enabled test codeunit with three enabled successful test functions' 87 | Given 'Filter on second test codeunit' 88 | When 'Perform Deselect on All' 89 | Then 'Run is not set on second test codeunit and functions' 90 | Then 'Select on All is enabled' 91 | Then 'Deselect on All is disabled' 92 | } 93 | } 94 | 95 | $Features | ` 96 | ConvertTo-ALTestCodeunit ` 97 | -CodeunitID 92151 ` 98 | -CodeunitName 'Enabl. Actns Select On All FLX' ` 99 | -InitializeFunction ` 100 | -GivenFunctionName "Create {0}" ` 101 | -ThenFunctionName "Verify {0}" ` 102 | # | Out-File '.\Test Codeunits\Cod92151.EnablingActionsSelectDeselectOnAllScenarios.al' -------------------------------------------------------------------------------- /ALTestTool/Test/atdd.scenarios/EnablingActionsSelectDeselectOnFailuresScenarios.ps1: -------------------------------------------------------------------------------- 1 | $Features = @() 2 | 3 | $Features += 4 | Feature 'Enabling Actions on Failures Unfiltered' { 5 | Scenario 1 'Unfiltered disabled failed test functions' { 6 | Given 'One disabled test codeunit with five disabled failed test functions' 7 | Given 'One disabled test codeunit with three disabled failed test functions' 8 | When 'Do nothing' 9 | Then 'Select on All is enabled' 10 | Then 'Deselect on All is disabled' 11 | Then 'Select on Failures is enabled' 12 | Then 'Select on Non Failures is disabled' 13 | } 14 | 15 | Scenario 2 'Unfiltered enabled failed test functions' { 16 | Given 'One enabled test codeunit with five enabled failed test functions' 17 | Given 'One enabled test codeunit with three enabled failed test functions' 18 | When 'Do nothing' 19 | Then 'Select on All is disabled' 20 | Then 'Deselect on All is enabled' 21 | Then 'Select on Failures is disabled' 22 | Then 'Select on Non Failures is disabled' 23 | } 24 | 25 | Scenario 3 'Unfiltered enabled and disabled failed test functions' { 26 | Given 'One enabled test codeunit with five enabled failed test functions' 27 | Given 'One disabled test codeunit with three disabled failed test functions' 28 | When 'Do nothing' 29 | Then 'Select on All is enabled' 30 | Then 'Deselect on All is enabled' 31 | Then 'Select on Failures is enabled' 32 | Then 'Select on Non Failures is disabled' 33 | } 34 | 35 | Scenario 4 'Select on All on unfiltered disabled failed test functions' { 36 | Given 'One disabled test codeunit with five disabled failed test functions' 37 | Given 'One disabled test codeunit with three disabled failed test functions' 38 | When 'Perform Select on All' 39 | Then 'Run is set on all test codeunits and functions' 40 | Then 'Select on All is disabled' 41 | Then 'Deselect on All is enabled' 42 | Then 'Select on Failures is disabled' 43 | Then 'Select on Non Failures is disabled' 44 | } 45 | 46 | Scenario 5 'Deselect on All on unfiltered enabled failed test functions' { 47 | Given 'One enabled test codeunit with five enabled failed test functions' 48 | Given 'One enabled test codeunit with three enabled failed test functions' 49 | When 'Perform Deselect on All' 50 | Then 'Run is not set on all test codeunits and functions' 51 | Then 'Select on All is enabled' 52 | Then 'Deselect on All is disabled' 53 | Then 'Select on Failures is enabled' 54 | Then 'Select on Non Failures is disabled' 55 | } 56 | Scenario 6 'Select on Failures on unfiltered disabled failed test functions' { 57 | Given 'One disabled test codeunit with five disabled failed test functions' 58 | Given 'One disabled test codeunit with three disabled failed test functions' 59 | When 'Perform Select on Failures' 60 | Then 'Run is set on all test codeunits and functions' 61 | Then 'Select on All is disabled' 62 | Then 'Deselect on All is enabled' 63 | Then 'Select on Failures is disabled' 64 | Then 'Select on Non Failures is disabled' 65 | } 66 | 67 | Scenario 7 'Select on Failures on unfiltered enabled and disabled failed test functions' { 68 | Given 'One enabled test codeunit with five enabled failed test functions' 69 | Given 'One disabled test codeunit with three disabled failed test functions' 70 | When 'Perform Select on Failures' 71 | Then 'Run is set on all test codeunits and functions' 72 | Then 'Select on All is disabled' 73 | Then 'Deselect on All is enabled' 74 | Then 'Select on Failures is disabled' 75 | Then 'Select on Non Failures is disabled' 76 | } 77 | } 78 | 79 | $Features += 80 | Feature 'Enabling Actions on Failures Filtered' { 81 | Scenario 8 'Filtered disabled failed test functions' { 82 | Given 'One disabled test codeunit with five disabled failed test functions' 83 | Given 'One disabled test codeunit with three disabled failed test functions' 84 | When 'Set filter on second test codeunit' 85 | Then 'Select on All is enabled' 86 | Then 'Deselect on All is disabled' 87 | Then 'Select on Failures is enabled' 88 | Then 'Select on Non Failures is disabled' 89 | } 90 | 91 | Scenario 9 'Filtered enabled failed test functions' { 92 | Given 'One enabled test codeunit with five enabled failed test functions' 93 | Given 'One enabled test codeunit with three enabled failed test functions' 94 | When 'Set filter on second test codeunit' 95 | Then 'Select on All is disabled' 96 | Then 'Deselect on All is enabled' 97 | Then 'Select on Failures is disabled' 98 | Then 'Select on Non Failures is disabled' 99 | } 100 | 101 | Scenario 10 'Filtered enabled and disabled failed test functions 1' { 102 | Given 'One enabled test codeunit with five enabled failed test functions' 103 | Given 'One disabled test codeunit with three disabled failed test functions' 104 | When 'Set filter on first test codeunit' 105 | Then 'Select on All is disabled' 106 | Then 'Deselect on All is enabled' 107 | Then 'Select on Failures is disabled' 108 | Then 'Select on Non Failures is disabled' 109 | } 110 | 111 | Scenario 11 'Filtered enabled and disabled failed test functions 2' { 112 | Given 'One enabled test codeunit with five enabled failed test functions' 113 | Given 'One disabled test codeunit with three disabled failed test functions' 114 | When 'Set filter on second test codeunit' 115 | Then 'Select on All is enabled' 116 | Then 'Deselect on All is disabled' 117 | Then 'Select on Failures is enabled' 118 | Then 'Select on Non Failures is disabled' 119 | } 120 | 121 | Scenario 12 'Select on All on filtered disabled failed test functions' { 122 | Given 'One disabled test codeunit with five disabled failed test functions' 123 | Given 'One disabled test codeunit with three disabled failed test functions' 124 | Given 'Filter on second test codeunit' 125 | When 'Perform Select on All' 126 | Then 'Run is set on all filtered test codeunits and functions' 127 | Then 'Select on All is disabled' 128 | Then 'Deselect on All is enabled' 129 | Then 'Select on Failures is disabled' 130 | Then 'Select on Non Failures is disabled' 131 | } 132 | 133 | Scenario 13 'Deselect on All on filtered enabled failed test functions' { 134 | Given 'One enabled test codeunit with five enabled failed test functions' 135 | Given 'One enabled test codeunit with three enabled failed test functions' 136 | Given 'Filter on second test codeunit' 137 | When 'Perform Deselect on All' 138 | Then 'Run is not set on all filtered test codeunits and functions' 139 | Then 'Select on All is enabled' 140 | Then 'Deselect on All is disabled' 141 | Then 'Select on Failures is enabled' 142 | Then 'Select on Non Failures is disabled' 143 | } 144 | Scenario 14 'Select on Failures on filtered disabled failed test functions' { 145 | Given 'One disabled test codeunit with five disabled failed test functions' 146 | Given 'One disabled test codeunit with three disabled failed test functions' 147 | Given 'Filter on second test codeunit' 148 | When 'Perform Select on Failures' 149 | Then 'Run is set on all filtered test codeunits and functions' 150 | Then 'Select on All is disabled' 151 | Then 'Deselect on All is enabled' 152 | Then 'Select on Failures is disabled' 153 | Then 'Select on Non Failures is disabled' 154 | } 155 | 156 | Scenario 15 'Select on Failures on filtered enabled and disabled failed test functions' { 157 | Given 'One enabled test codeunit with five enabled failed test functions' 158 | Given 'One disabled test codeunit with three disabled failed test functions' 159 | Given 'Filter on second test codeunit' 160 | When 'Perform Select on Failures' 161 | Then 'Run is set on all filtered test codeunits and functions' 162 | Then 'Select on All is disabled' 163 | Then 'Deselect on All is enabled' 164 | Then 'Select on Failures is disabled' 165 | Then 'Select on Non Failures is disabled' 166 | } 167 | } 168 | 169 | $Features | ` 170 | ConvertTo-ALTestCodeunit ` 171 | -CodeunitID 92152 ` 172 | -CodeunitName 'Enabl. Actions on Failures FLX' ` 173 | -InitializeFunction ` 174 | -GivenFunctionName "Create {0}" ` 175 | -ThenFunctionName "Verify {0}" ` 176 | | Out-File '.\Test Codeunits\Cod92152.EnablingActionsSelectDeselectOnFailuresScenarios.al' -------------------------------------------------------------------------------- /ALTestTool/Test/atdd.scenarios/EnablingActionsSelectDeselectOnNonFailuresScenarios.ps1: -------------------------------------------------------------------------------- 1 | $Features = @() 2 | 3 | $Features += 4 | Feature 'Enabling Actions on Non Failures Unfiltered' { 5 | Scenario 1 'Unfiltered disabled succesfull test functions' { 6 | Given 'One disabled test codeunit with five disabled succesfull test functions' 7 | Given 'One disabled test codeunit with three disabled succesfull test functions' 8 | When 'Do nothing' 9 | Then 'Select on All is enabled' 10 | Then 'Deselect on All is disabled' 11 | Then 'Select on Failures is disabled' 12 | Then 'Select on Non Failures is enabled' 13 | } 14 | 15 | Scenario 2 'Unfiltered enabled succesfull test functions' { 16 | Given 'One enabled test codeunit with five enabled succesfull test functions' 17 | Given 'One enabled test codeunit with three enabled succesfull test functions' 18 | When 'Do nothing' 19 | Then 'Select on All is disabled' 20 | Then 'Deselect on All is enabled' 21 | Then 'Select on Failures is disabled' 22 | Then 'Select on Non Failures is disabled' 23 | } 24 | 25 | Scenario 3 'Unfiltered enabled and disabled succesfull test functions' { 26 | Given 'One enabled test codeunit with five enabled succesfull test functions' 27 | Given 'One disabled test codeunit with three disabled succesfull test functions' 28 | When 'Do nothing' 29 | Then 'Select on All is enabled' 30 | Then 'Deselect on All is enabled' 31 | Then 'Select on Failures is disabled' 32 | Then 'Select on Non Failures is enabled' 33 | } 34 | 35 | Scenario 4 'Select on All on unfiltered disabled succesfull test functions' { 36 | Given 'One disabled test codeunit with five disabled succesfull test functions' 37 | Given 'One disabled test codeunit with three disabled succesfull test functions' 38 | When 'Perform Select on All' 39 | Then 'Run is set on all test codeunits and functions' 40 | Then 'Select on All is disabled' 41 | Then 'Deselect on All is enabled' 42 | Then 'Select on Failures is disabled' 43 | Then 'Select on Non Failures is disabled' 44 | } 45 | 46 | Scenario 5 'Deselect on All on unfiltered enabled succesfull test functions' { 47 | Given 'One enabled test codeunit with five enabled succesfull test functions' 48 | Given 'One enabled test codeunit with three enabled succesfull test functions' 49 | When 'Perform Deselect on All' 50 | Then 'Run is not set on all test codeunits and functions' 51 | Then 'Select on All is enabled' 52 | Then 'Deselect on All is disabled' 53 | Then 'Select on Failures is disabled' 54 | Then 'Select on Non Failures is enabled' 55 | } 56 | Scenario 6 'Select on Failures on unfiltered disabled succesfull test functions' { 57 | Given 'One disabled test codeunit with five disabled succesfull test functions' 58 | Given 'One disabled test codeunit with three disabled succesfull test functions' 59 | When 'Perform Select on Non Failures' 60 | Then 'Run is set on all test codeunits and functions' 61 | Then 'Select on All is disabled' 62 | Then 'Deselect on All is enabled' 63 | Then 'Select on Failures is disabled' 64 | Then 'Select on Non Failures is disabled' 65 | } 66 | 67 | Scenario 7 'Select on Failures on unfiltered enabled and disabled succesfull test functions' { 68 | Given 'One enabled test codeunit with five enabled succesfull test functions' 69 | Given 'One disabled test codeunit with three disabled succesfull test functions' 70 | When 'Perform Select on Non Failures' 71 | Then 'Run is set on all test codeunits and functions' 72 | Then 'Select on All is disabled' 73 | Then 'Deselect on All is enabled' 74 | Then 'Select on Failures is disabled' 75 | Then 'Select on Non Failures is disabled' 76 | } 77 | } 78 | 79 | $Features += 80 | Feature 'Enabling Actions on Non Failures Filtered' { 81 | Scenario 8 'Filtered disabled succesfull test functions' { 82 | Given 'One disabled test codeunit with five disabled succesfull test functions' 83 | Given 'One disabled test codeunit with three disabled succesfull test functions' 84 | When 'Set filter on second test codeunit' 85 | Then 'Select on All is enabled' 86 | Then 'Deselect on All is disabled' 87 | Then 'Select on Failures is disabled' 88 | Then 'Select on Non Failures is enabled' 89 | } 90 | 91 | Scenario 9 'Filtered enabled succesfull test functions' { 92 | Given 'One enabled test codeunit with five enabled succesfull test functions' 93 | Given 'One enabled test codeunit with three enabled succesfull test functions' 94 | When 'Set filter on second test codeunit' 95 | Then 'Select on All is disabled' 96 | Then 'Deselect on All is enabled' 97 | Then 'Select on Failures is disabled' 98 | Then 'Select on Non Failures is disabled' 99 | } 100 | 101 | Scenario 10 'Filtered enabled and disabled succesfull test functions 1' { 102 | Given 'One enabled test codeunit with five enabled succesfull test functions' 103 | Given 'One disabled test codeunit with three disabled succesfull test functions' 104 | When 'Set filter on first test codeunit' 105 | Then 'Select on All is disabled' 106 | Then 'Deselect on All is enabled' 107 | Then 'Select on Failures is disabled' 108 | Then 'Select on Non Failures is disabled' 109 | } 110 | 111 | Scenario 11 'Filtered enabled and disabled succesfull test functions 2' { 112 | Given 'One enabled test codeunit with five enabled succesfull test functions' 113 | Given 'One disabled test codeunit with three disabled succesfull test functions' 114 | When 'Set filter on second test codeunit' 115 | Then 'Select on All is enabled' 116 | Then 'Deselect on All is disabled' 117 | Then 'Select on Failures is disabled' 118 | Then 'Select on Non Failures is enabled' 119 | } 120 | 121 | Scenario 12 'Select on All on filtered disabled succesfull test functions' { 122 | Given 'One disabled test codeunit with five disabled succesfull test functions' 123 | Given 'One disabled test codeunit with three disabled succesfull test functions' 124 | Given 'Filter on second test codeunit' 125 | When 'Perform Select on All' 126 | Then 'Run is set on all filtered test codeunits and functions' 127 | Then 'Select on All is disabled' 128 | Then 'Deselect on All is enabled' 129 | Then 'Select on Failures is disabled' 130 | Then 'Select on Non Failures is disabled' 131 | } 132 | 133 | Scenario 13 'Deselect on All on filtered enabled succesfull test functions' { 134 | Given 'One enabled test codeunit with five enabled succesfull test functions' 135 | Given 'One enabled test codeunit with three enabled succesfull test functions' 136 | Given 'Filter on second test codeunit' 137 | When 'Perform Deselect on All' 138 | Then 'Run is not set on all filtered test codeunits and functions' 139 | Then 'Select on All is enabled' 140 | Then 'Deselect on All is disabled' 141 | Then 'Select on Failures is disabled' 142 | Then 'Select on Non Failures is enabled' 143 | } 144 | Scenario 14 'Select on Failures on filtered disabled succesfull test functions' { 145 | Given 'One disabled test codeunit with five disabled succesfull test functions' 146 | Given 'One disabled test codeunit with three disabled succesfull test functions' 147 | Given 'Filter on second test codeunit' 148 | When 'Perform Select on Non Failures' 149 | Then 'Run is set on all filtered test codeunits and functions' 150 | Then 'Select on All is disabled' 151 | Then 'Deselect on All is enabled' 152 | Then 'Select on Failures is disabled' 153 | Then 'Select on Non Failures is disabled' 154 | } 155 | 156 | Scenario 15 'Select on Failures on filtered enabled and disabled succesfull test functions' { 157 | Given 'One enabled test codeunit with five enabled succesfull test functions' 158 | Given 'One disabled test codeunit with three disabled succesfull test functions' 159 | Given 'Filter on second test codeunit' 160 | When 'Perform Select on Non Failures' 161 | Then 'Run is set on all filtered test codeunits and functions' 162 | Then 'Select on All is disabled' 163 | Then 'Deselect on All is enabled' 164 | Then 'Select on Failures is disabled' 165 | Then 'Select on Non Failures is disabled' 166 | } 167 | } 168 | 169 | $Features | ` 170 | ConvertTo-ALTestCodeunit ` 171 | -CodeunitID 92153 ` 172 | -CodeunitName 'Enabling Actions on Non Failures' ` 173 | -InitializeFunction ` 174 | -GivenFunctionName "Create {0}" ` 175 | -ThenFunctionName "Verify {0}" ` 176 | | Out-File '.\Test Codeunits\Cod92153.EnablingActionsSelectDeselectOnNonFailuresScenarios.al' -------------------------------------------------------------------------------- /ALTestTool/Test/atdd.scenarios/InstallModuleATDDTestScriptor.ps1: -------------------------------------------------------------------------------- 1 | Install-Module ATDD.TestScriptor -Force 2 | Import-Module ATDD.TestScriptor -Force -------------------------------------------------------------------------------- /ALTestTool/Test/atdd.scenarios/RunOnTestFunctionsScenarios.ps1: -------------------------------------------------------------------------------- 1 | $Features = @() 2 | 3 | $Features += 4 | Feature 'Run on Unfiltered Test Functions' { 5 | Scenario 1 'Enable Run on unfiltered test functions (all disabled)' { 6 | Given 'One disabled test codeunit with five disabled test functions' 7 | Given 'One disabled test codeunit with three disabled test functions' 8 | When 'Perform Select on All' 9 | Then 'Run is set on all test codeunits and functions' 10 | } 11 | 12 | Scenario 2 'Enable Run on unfiltered test functions (all enabled)' { 13 | Given 'One enabled test codeunit with five enabled test functions' 14 | Given 'One enabled test codeunit with three enabled test functions' 15 | When 'Perform Select on All' 16 | Then 'Run is set on all test codeunits and functions' 17 | } 18 | 19 | Scenario 3 'Disable Run on unfiltered test functions (all enabled)' { 20 | Given 'One enabled test codeunit with five enabled test functions' 21 | Given 'One enabled test codeunit with three enabled test functions' 22 | When 'Perform Deselect on All' 23 | Then 'Run is not set on all test codeunits and functions' 24 | } 25 | 26 | Scenario 4 'Disable Run on unfiltered test functions (all disabled)' { 27 | Given 'One disabled test codeunit with five disabled test functions' 28 | Given 'One disabled test codeunit with three disabled test functions' 29 | When 'Perform Deselect on All' 30 | Then 'Run is not set on all test codeunits and functions' 31 | } 32 | 33 | Scenario 5 'Enable Run only on unfiltered failed test functions (all enabled)' { 34 | Given 'One enabled test codeunit with enabled test functions five successful' 35 | Given 'One enabled test codeunit with enabled test functions two successful and two failed' 36 | Given 'One enabled test codeunit with enabled test functions two successful and two failed' 37 | When 'Perform Select on Failures' 38 | Then 'Run is set only on failed test codeunits and functions' 39 | } 40 | 41 | Scenario 6 'Enable Run only on unfiltered failed test functions (all disabled)' { 42 | Given 'One disabled test codeunit with disabled test functions five successful' 43 | Given 'One disabled test codeunit with disabled test functions two successful and two failed' 44 | Given 'One disabled test codeunit with disabled test functions two successful and two failed' 45 | When 'Perform Select on Failures' 46 | Then 'Run is set only on failed test codeunits and functions' 47 | } 48 | 49 | Scenario 7 'Enable Run only on unfiltered non failed test functions (all enabled)' { 50 | Given 'One enabled test codeunit with enabled test functions five successful' 51 | Given 'One enabled test codeunit with enabled test functions two successful and two failed' 52 | Given 'One enabled test codeunit with enabled test functions two successful and two failed' 53 | When 'Perform Select on Non Failures' 54 | Then 'Run is set only on non failed test codeunits and functions' 55 | } 56 | 57 | Scenario 8 'Enable Run only on unfiltered non failed test functions (all disabled)' { 58 | Given 'One disabled test codeunit with disabled test functions five successful' 59 | Given 'One disabled test codeunit with disabled test functions two successful and two failed' 60 | Given 'One disabled test codeunit with disabled test functions two successful and two failed' 61 | When 'Perform Select on Non Failures' 62 | Then 'Run is set only on non failed test codeunits and functions' 63 | } 64 | } 65 | 66 | $Features += 67 | Feature 'Run on Filtered Test Functions' { 68 | Scenario 9 'Enable Run on filtered test functions (all disabled)' { 69 | Given 'One disabled test codeunit with five disabled test functions' 70 | Given 'One disabled test codeunit with three disabled test functions' 71 | Given 'Filter on second test codeunit' 72 | When 'Perform Select on All' 73 | Then 'Run is set only on second test codeunit and its functions' 74 | } 75 | 76 | Scenario 10 'Enable Run on filtered test functions (all enabled)' { 77 | Given 'One enabled test codeunit with five enabled test functions' 78 | Given 'One enabled test codeunit with three enabled test functions' 79 | Given 'Filter on second test codeunit' 80 | When 'Perform Select on All' 81 | Then 'Run is set on all test codeunits and functions' 82 | } 83 | 84 | Scenario 11 'Disable Run on filtered test functions (all enabled)' { 85 | Given 'One enabled test codeunit with five enabled test functions' 86 | Given 'One enabled test codeunit with three enabled test functions' 87 | Given 'Filter on second test codeunit' 88 | When 'Perform Deselect on All' 89 | Then 'Run is not set on second test codeunit and its functions' 90 | } 91 | 92 | Scenario 12 'Disable Run on filtered test functions (all disabled)' { 93 | Given 'One disabled test codeunit with five disabled test functions' 94 | Given 'One disabled test codeunit with three disabled test functions' 95 | Given 'Filter on second test codeunit' 96 | When 'Perform Deselect on All' 97 | Then 'Run is not set on all test codeunits and functions' 98 | } 99 | 100 | Scenario 13 'Enable Run only on filtered failed test functions (all enabled)' { 101 | Given 'One enabled test codeunit with enabled test functions five successful' 102 | Given 'One enabled test codeunit with enabled test functions two successful and two failed' 103 | Given 'One enabled test codeunit with enabled test functions two successful and two failed' 104 | Given 'Filter on second test codeunit' 105 | When 'Perform Select on Failures' 106 | Then 'Run is not set only on non failed functions of second test codeunit' 107 | } 108 | 109 | Scenario 14 'Enable Run only on filtered failed test functions (all disabled)' { 110 | Given 'One disabled test codeunit with disabled test functions five successful' 111 | Given 'One disabled test codeunit with disabled test functions two successful and two failed' 112 | Given 'One disabled test codeunit with disabled test functions two successful and two failed' 113 | Given 'Filter on second test codeunit' 114 | When 'Perform Select on Failures' 115 | Then 'Run is set only on second test codeunit and its failed functions' 116 | } 117 | 118 | Scenario 15 'Enable Run only on filtered non failed test functions (all enabled)' { 119 | Given 'One enabled test codeunit with enabled test functions five successful' 120 | Given 'One enabled test codeunit with enabled test functions two successful and two failed' 121 | Given 'One enabled test codeunit with enabled test functions two successful and two failed' 122 | Given 'Filter on second test codeunit' 123 | When 'Perform Select on Non Failures' 124 | Then 'Run is not set only on failed functions of second test codeunit' 125 | } 126 | 127 | Scenario 16 'Enable Run only on filtered non failed test functions (all disabled)' { 128 | Given 'One disabled test codeunit with disabled test functions five successful' 129 | Given 'One disabled test codeunit with disabled test functions two successful and two failed' 130 | Given 'One disabled test codeunit with disabled test functions two successful and two failed' 131 | Given 'Filter on second test codeunit' 132 | When 'Perform Select on Non Failures' 133 | Then 'Run is set only on second test codeunit and its non failed functions' 134 | } 135 | } 136 | 137 | $Features | ` 138 | ConvertTo-ALTestCodeunit ` 139 | -CodeunitID 92150 ` 140 | -CodeunitName 'Run on Test Functions FLX' ` 141 | -InitializeFunction ` 142 | -GivenFunctionName "Create {0}" ` 143 | -ThenFunctionName "Verify {0}" ` 144 | # | Out-File '.\Test Codeunits\Cod92150.RunOnTestFunctions.al' -------------------------------------------------------------------------------- /ALTestTool/Test/src/codeunit/EnablActnsFlrsALTT.Codeunit.al: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluxxus-nl/Test-Tool-Extension/d2169d2ba3c2f048533636b8e8e38069ff69926b/ALTestTool/Test/src/codeunit/EnablActnsFlrsALTT.Codeunit.al -------------------------------------------------------------------------------- /ALTestTool/Test/src/codeunit/EnablActnsNonFlrsALTT.al: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluxxus-nl/Test-Tool-Extension/d2169d2ba3c2f048533636b8e8e38069ff69926b/ALTestTool/Test/src/codeunit/EnablActnsNonFlrsALTT.al -------------------------------------------------------------------------------- /ALTestTool/Test/src/codeunit/EnablActnsSelectALTT.Codeunit.al: -------------------------------------------------------------------------------- 1 | codeunit 92151 "Enabl. Actns. Select ALTT FLX" 2 | { 3 | SubType = Test; 4 | 5 | trigger OnRun() 6 | begin 7 | // (c) fluxxus.nl - https://github.com/fluxxus-nl/Test-Tool-Extension 8 | 9 | // [FEATURE] Enabling Actions Select/Deselect on All Unfiltered 10 | // [FEATURE] Enabling Actions Select/Deselect on All Filtered 11 | end; 12 | 13 | [Test] 14 | procedure UnfilteredDisabledTestFunctions() 15 | // [FEATURE] Enabling Actions Select/Deselect on All Unfiltered 16 | begin 17 | // [SCENARIO #0001] Unfiltered disabled test functions 18 | Initialize(); 19 | 20 | // [GIVEN] One disabled test codeunit with five disabled test functions 21 | CreateOneDisabledTestCodeunitWithFiveDisabledTestFunctions(); 22 | // [GIVEN] One disabled test codeunit with three disabled test functions 23 | CreateOneDisabledTestCodeunitWithThreeDisabledTestFunctions(); 24 | 25 | // [WHEN] Do nothing 26 | DoNothing(); 27 | 28 | // [THEN] Select on All is enabled 29 | VerifySelectOnAllIsEnabled(NoFilterOnCodeunit()); 30 | // [THEN] Deselect on All is disabled 31 | VerifyDeselectOnAllIsDisabled(NoFilterOnCodeunit()); 32 | end; 33 | 34 | [Test] 35 | procedure UnfilteredEnabledTestFunctions() 36 | // [FEATURE] Enabling Actions Select/Deselect on All Unfiltered 37 | begin 38 | // [SCENARIO #0002] Unfiltered enabled test functions 39 | Initialize(); 40 | 41 | // [GIVEN] One enabled test codeunit with five enabled test functions 42 | CreateOneEnabledTestCodeunitWithFiveEnabledTestFunctions(); 43 | // [GIVEN] One enabled test codeunit with three enabled test functions 44 | CreateOneEnabledTestCodeunitWithThreeEnabledTestFunctions(); 45 | 46 | // [WHEN] Do nothing 47 | DoNothing(); 48 | 49 | // [THEN] Select on All is disabled 50 | VerifySelectOnAllIsDisabled(NoFilterOnCodeunit()); 51 | // [THEN] Deselect on All is enabled 52 | VerifyDeselectOnAllIsEnabled(NoFilterOnCodeunit()); 53 | end; 54 | 55 | [Test] 56 | procedure UnfilteredEnabledAndDisbledTestFunctions() 57 | // [FEATURE] Enabling Actions Select/Deselect on All Unfiltered 58 | begin 59 | // [SCENARIO #0003] Unfiltered enabled and disbled test functions 60 | Initialize(); 61 | 62 | // [GIVEN] One enabled test codeunit with five enabled test functions 63 | CreateOneEnabledTestCodeunitWithFiveEnabledTestFunctions(); 64 | // [GIVEN] One disabled test codeunit with three disabled test functions 65 | CreateOneDisabledTestCodeunitWithThreeDisabledTestFunctions(); 66 | 67 | // [WHEN] Do nothing 68 | DoNothing(); 69 | 70 | // [THEN] Select on All is enabled 71 | VerifySelectOnAllIsEnabled(NoFilterOnCodeunit()); 72 | // [THEN] Deselect on All is enabled 73 | VerifyDeselectOnAllIsEnabled(NoFilterOnCodeunit()); 74 | end; 75 | 76 | [Test] 77 | procedure EnableRunOnUnfilteredSuccessfulTestFunctions() 78 | // [FEATURE] Enabling Actions Select/Deselect on All Unfiltered 79 | begin 80 | // [SCENARIO #0004] Enable Run on unfiltered successful test functions 81 | Initialize(); 82 | 83 | // [GIVEN] One disabled test codeunit with five disabled successful test functions 84 | CreateOneDisabledTestCodeunitWithFiveDisabledSuccessfulTestFunctions(); 85 | // [GIVEN] One disabled test codeunit with three disabled successful test functions 86 | CreateOneDisabledTestCodeunitWithThreeDisabledSuccessfulTestFunctions(); 87 | 88 | // [WHEN] Perform Select on All 89 | PerformSelectOnAll(NoFilterOnCodeunit()); 90 | 91 | // [THEN] Run is set on all test codeunits and functions 92 | VerifyRunIsSetOnAllTestCodeunitsAndFunctions(); 93 | // [THEN] Select on All is disabled 94 | VerifySelectOnAllIsDisabled(NoFilterOnCodeunit()); 95 | // [THEN] Deselect on All is enabled 96 | VerifyDeselectOnAllIsEnabled(NoFilterOnCodeunit()); 97 | end; 98 | 99 | [Test] 100 | procedure DisableRunOnUnfilteredSuccessfulTestFunctions() 101 | // [FEATURE] Enabling Actions Select/Deselect on All Unfiltered 102 | begin 103 | // [SCENARIO #0005] Disable Run on unfiltered successful test functions 104 | Initialize(); 105 | 106 | // [GIVEN] One enabled test codeunit with five enabled successful test functions 107 | CreateOneEnabledTestCodeunitWithFiveEnabledSuccessfulTestFunctions(); 108 | // [GIVEN] One enabled test codeunit with three enabled successful test functions 109 | CreateOneEnabledTestCodeunitWithThreeEnabledSuccessfulTestFunctions(); 110 | 111 | // [WHEN] Perform Deselect on All 112 | PerformDeselectOnAll(NoFilterOnCodeunit()); 113 | 114 | // [THEN] Run is not set on all test codeunits and functions 115 | VerifyRunIsNotSetOnAllTestCodeunitsAndFunctions(); 116 | // [THEN] Select on All is enabled 117 | VerifySelectOnAllIsEnabled(NoFilterOnCodeunit()); 118 | // [THEN] Deselect on All is disabled 119 | VerifyDeselectOnAllIsDisabled(NoFilterOnCodeunit()); 120 | end; 121 | 122 | [Test] 123 | procedure FilteredDisabledTestFunctions() 124 | // [FEATURE] Enabling Actions Select/Deselect on All Filtered 125 | var 126 | SecondCodeunitID: Integer; 127 | begin 128 | // [SCENARIO #0006] Filtered disabled test functions 129 | Initialize(); 130 | 131 | // [GIVEN] One disabled test codeunit with five disabled test functions 132 | CreateOneDisabledTestCodeunitWithFiveDisabledTestFunctions(); 133 | // [GIVEN] One disabled test codeunit with three disabled test functions 134 | SecondCodeunitID := CreateOneDisabledTestCodeunitWithThreeDisabledTestFunctions(); 135 | 136 | // [WHEN] Set filter on second test codeunit 137 | // handled by Verify... task in [THEN] part based on SecondCodeunitID 138 | 139 | // [THEN] Select on All is enabled 140 | VerifySelectOnAllIsEnabled(SetFilterOn(SecondCodeunitID)); 141 | // [THEN] Deselect on All is disabled 142 | VerifyDeselectOnAllIsDisabled(SetFilterOn(SecondCodeunitID)); 143 | end; 144 | 145 | [Test] 146 | procedure FilteredEnabledTestFunctions() 147 | // [FEATURE] Enabling Actions Select/Deselect on All Filtered 148 | var 149 | SecondCodeunitID: Integer; 150 | begin 151 | // [SCENARIO #0007] Filtered enabled test functions 152 | Initialize(); 153 | 154 | // [GIVEN] One enabled test codeunit with five enabled test functions 155 | CreateOneEnabledTestCodeunitWithFiveEnabledTestFunctions(); 156 | // [GIVEN] One enabled test codeunit with three enabled test functions 157 | SecondCodeunitID := CreateOneEnabledTestCodeunitWithThreeEnabledTestFunctions(); 158 | 159 | // [WHEN] Set filter on second test codeunit 160 | // handled by Verify... task in [THEN] part based on SecondCodeunitID 161 | 162 | // [THEN] Select on All is disabled 163 | VerifySelectOnAllIsDisabled(SetFilterOn(SecondCodeunitID)); 164 | // [THEN] Deselect on All is enabled 165 | VerifyDeselectOnAllIsEnabled(SetFilterOn(SecondCodeunitID)); 166 | end; 167 | 168 | [Test] 169 | procedure FilteredEnabledAndDisbledTestFunctions() 170 | // [FEATURE] Enabling Actions Select/Deselect on All Filtered 171 | var 172 | SecondCodeunitID: Integer; 173 | begin 174 | // [SCENARIO #0008] Filtered enabled and disabled test functions 175 | Initialize(); 176 | 177 | // [GIVEN] One enabled test codeunit with five enabled test functions 178 | CreateOneEnabledTestCodeunitWithFiveEnabledTestFunctions(); 179 | // [GIVEN] One disabled test codeunit with three disabled test functions 180 | SecondCodeunitID := CreateOneDisabledTestCodeunitWithThreeDisabledTestFunctions(); 181 | 182 | // [WHEN] Set filter on second test codeunit 183 | // handled by Verify... task in [THEN] part based on SecondCodeunitID 184 | 185 | 186 | // [THEN] Select on All is enabled 187 | VerifySelectOnAllIsEnabled(SetFilterOn(SecondCodeunitID)); 188 | // [THEN] Deselect on All is enabled 189 | VerifyDeselectOnAllIsDisabled(SetFilterOn(SecondCodeunitID)); 190 | end; 191 | 192 | [Test] 193 | procedure EnableRunOnFilteredSuccessfulTestFunctions() 194 | // [FEATURE] Enabling Actions Select/Deselect on All Filtered 195 | var 196 | SecondCodeunitID: Integer; 197 | begin 198 | // [SCENARIO #0009] Enable Run on filtered successful test functions 199 | Initialize(); 200 | 201 | // [GIVEN] One disabled test codeunit with five disabled successful test functions 202 | CreateOneDisabledTestCodeunitWithFiveDisabledSuccessfulTestFunctions(); 203 | // [GIVEN] One disabled test codeunit with three disabled successful test functions 204 | SecondCodeunitID := CreateOneDisabledTestCodeunitWithThreeDisabledSuccessfulTestFunctions(); 205 | // [GIVEN] Filter on second test codeunit 206 | // handled by Perform... task in [WHEN] part based on SecondCodeunitID 207 | 208 | // [WHEN] Perform Select on All 209 | PerformSelectOnAll(SetFilterOn(SecondCodeunitID)); 210 | 211 | // [THEN] Run is set on second test codeunit and functions 212 | VerifyRunIsSetOnSecondTestCodeunitsAndFunctions(SetFilterOn(SecondCodeunitID)); 213 | // [THEN] Select on All is disabled 214 | VerifySelectOnAllIsDisabled(SetFilterOn(SecondCodeunitID)); 215 | // [THEN] Deselect on All is enabled 216 | VerifyDeselectOnAllIsEnabled(SetFilterOn(SecondCodeunitID)); 217 | end; 218 | 219 | [Test] 220 | procedure DisableRunOnFilteredSuccessfulTestFunctions() 221 | // [FEATURE] Enabling Actions Select/Deselect on All Filtered 222 | var 223 | SecondCodeunitID: Integer; 224 | begin 225 | // [SCENARIO #0010] Disable Run on filtered successful test functions 226 | Initialize(); 227 | 228 | // [GIVEN] One enabled test codeunit with five enabled successful test functions 229 | CreateOneEnabledTestCodeunitWithFiveEnabledSuccessfulTestFunctions(); 230 | // [GIVEN] One enabled test codeunit with three enabled successful test functions 231 | SecondCodeunitID := CreateOneEnabledTestCodeunitWithThreeEnabledSuccessfulTestFunctions(); 232 | // [GIVEN] Filter on second test codeunit 233 | // handled by Perform... task in [WHEN] part based on SecondCodeunitID 234 | 235 | // [WHEN] Perform Deselect on All 236 | PerformDeselectOnAll(SetFilterOn(SecondCodeunitID)); 237 | 238 | // [THEN] Run is not set on second test codeunit and functions 239 | VerifyRunIsNotSetOnSecondTestCodeunitsAndFunctions(SetFilterOn(SecondCodeunitID)); 240 | // [THEN] Select on All is enabled 241 | VerifySelectOnAllIsEnabled(SetFilterOn(SecondCodeunitID)); 242 | // [THEN] Deselect on All is disabled 243 | VerifyDeselectOnAllIsDisabled(SetFilterOn(SecondCodeunitID)); 244 | end; 245 | 246 | var 247 | Assert: Codeunit Assert; 248 | LibraryTestFunctions: Codeunit "Lib. - Test Funct Lns ALTT FLX"; 249 | LibraryVerifyActions: Codeunit "Lib. - Verify Actns. ALTT FLX"; 250 | TestSuiteName: Code[10]; 251 | 252 | local procedure Initialize() 253 | var 254 | LibraryTestInitialize: Codeunit "Library - Test Initialize"; 255 | LibraryUtility: Codeunit "Library - Utility"; 256 | begin 257 | LibraryTestInitialize.OnTestInitialize(Codeunit::"Enabl. Actns. Select ALTT FLX"); 258 | 259 | TestSuiteName := LibraryUtility.GenerateGUID(); 260 | LibraryTestFunctions.CreateTestSuite(TestSuiteName); 261 | LibraryTestFunctions.SetCodeunitBaseID(-Codeunit::"Enabl. Actns. Select ALTT FLX"); 262 | end; 263 | 264 | local procedure CreateFilterOnSecondTestCodeunit() 265 | begin 266 | end; 267 | 268 | local procedure CreateOneDisabledTestCodeunitWithFiveDisabledSuccessfulTestFunctions(): Integer 269 | begin 270 | LibraryTestFunctions.CreateTestCodeunit(TestSuiteName, LibraryTestFunctions.GetNextCodeunitID(), IsDisabled()); 271 | LibraryTestFunctions.CreateTestFunctions(TestSuiteName, LibraryTestFunctions.GetCurrentCodeunitID(), IsDisabled(), 5, 0); 272 | exit(LibraryTestFunctions.GetCurrentCodeunitID()); 273 | end; 274 | 275 | local procedure CreateOneDisabledTestCodeunitWithFiveDisabledTestFunctions(): Integer 276 | begin 277 | CreateOneDisabledTestCodeunitWithFiveDisabledSuccessfulTestFunctions() 278 | end; 279 | 280 | local procedure CreateOneDisabledTestCodeunitWithThreeDisabledSuccessfulTestFunctions(): Integer 281 | begin 282 | LibraryTestFunctions.CreateTestCodeunit(TestSuiteName, LibraryTestFunctions.GetNextCodeunitID(), IsDisabled()); 283 | LibraryTestFunctions.CreateTestFunctions(TestSuiteName, LibraryTestFunctions.GetCurrentCodeunitID(), IsDisabled(), 3, 0); 284 | exit(LibraryTestFunctions.GetCurrentCodeunitID()); 285 | end; 286 | 287 | local procedure CreateOneDisabledTestCodeunitWithThreeDisabledTestFunctions(): Integer 288 | begin 289 | exit(CreateOneDisabledTestCodeunitWithThreeDisabledSuccessfulTestFunctions()) 290 | end; 291 | 292 | local procedure CreateOneEnabledTestCodeunitWithFiveEnabledSuccessfulTestFunctions(): Integer 293 | begin 294 | LibraryTestFunctions.CreateTestCodeunit(TestSuiteName, LibraryTestFunctions.GetNextCodeunitID(), IsDisabled()); 295 | LibraryTestFunctions.CreateTestFunctions(TestSuiteName, LibraryTestFunctions.GetCurrentCodeunitID(), IsEnabled(), 5, 0); 296 | exit(LibraryTestFunctions.GetCurrentCodeunitID()); 297 | end; 298 | 299 | local procedure CreateOneEnabledTestCodeunitWithFiveEnabledTestFunctions(): Integer 300 | begin 301 | exit(CreateOneEnabledTestCodeunitWithFiveEnabledSuccessfulTestFunctions()) 302 | end; 303 | 304 | local procedure CreateOneEnabledTestCodeunitWithThreeEnabledSuccessfulTestFunctions(): Integer 305 | begin 306 | LibraryTestFunctions.CreateTestCodeunit(TestSuiteName, LibraryTestFunctions.GetNextCodeunitID(), IsDisabled()); 307 | LibraryTestFunctions.CreateTestFunctions(TestSuiteName, LibraryTestFunctions.GetCurrentCodeunitID(), IsEnabled(), 3, 0); 308 | exit(LibraryTestFunctions.GetCurrentCodeunitID()); 309 | end; 310 | 311 | local procedure CreateOneEnabledTestCodeunitWithThreeEnabledTestFunctions(): Integer 312 | begin 313 | exit(CreateOneEnabledTestCodeunitWithThreeEnabledSuccessfulTestFunctions()) 314 | end; 315 | 316 | // local procedure CreateTestFunctions(NewSuiteName: Code[10]; NewCodeunitID: Integer; NewEnabled: Boolean; NoOfSuccesfull: Integer; NoOfFailed: Integer) 317 | // var 318 | // i: Integer; 319 | // begin 320 | // for i := 1 to NoOfSuccesfull do 321 | // CreateTestFunction(NewSuiteName, NewCodeunitID, NewEnabled, true); 322 | 323 | // for i := 1 to NoOfFailed do 324 | // CreateTestFunction(NewSuiteName, NewCodeunitID, NewEnabled, false); 325 | // end; 326 | 327 | local procedure DoNothing() 328 | begin 329 | end; 330 | 331 | local procedure PerformDeselectOnAll(CodeunitID: Integer) 332 | begin 333 | SetRun(CodeunitID, 2) // 2 = Failures 334 | end; 335 | 336 | local procedure PerformSelectOnAll(CodeunitID: Integer) 337 | begin 338 | SetRun(CodeunitID, 0) // 0 = All 339 | end; 340 | 341 | local procedure SetRun(CodeunitID: Integer; RunType: Option All,"Non",Failures,NonFailures) 342 | var 343 | TestMethodLine: Record "Test Method Line"; 344 | SetRunOnTestTool: Codeunit "Set Run On Test Tool ALTT FLX"; 345 | begin 346 | SetFilterOnTestMethodLine(TestMethodLine, CodeunitID); 347 | SetRunOnTestTool.SetRun(TestMethodLine, RunType) 348 | end; 349 | 350 | local procedure NoFilterOnCodeunit(): Integer 351 | begin 352 | exit(0) 353 | end; 354 | 355 | local procedure SetFilterOn(CodeunitID: Integer): Integer 356 | begin 357 | exit(CodeunitID) 358 | end; 359 | 360 | local procedure IsEnabled(): Boolean 361 | begin 362 | exit(true) 363 | end; 364 | 365 | local procedure IsDisabled(): Boolean 366 | begin 367 | exit(false) 368 | end; 369 | 370 | local procedure VerifySelectOnAllIsDisabled(CodeunitID: Integer) 371 | begin 372 | LibraryVerifyActions.VerifySelectOnAllIsDisabled(TestSuiteName, CodeunitID); 373 | end; 374 | 375 | local procedure VerifySelectOnAllIsEnabled(CodeunitID: Integer) 376 | begin 377 | LibraryVerifyActions.VerifySelectOnAllIsEnabled(TestSuiteName, CodeunitID); 378 | end; 379 | 380 | local procedure VerifyDeselectOnAllIsDisabled(CodeunitID: Integer) 381 | begin 382 | LibraryVerifyActions.VerifyDeselectOnAllIsDisabled(TestSuiteName, CodeunitID); 383 | end; 384 | 385 | local procedure VerifyDeselectOnAllIsEnabled(CodeunitID: Integer) 386 | begin 387 | LibraryVerifyActions.VerifyDeselectOnAllIsEnabled(TestSuiteName, CodeunitID); 388 | end; 389 | 390 | local procedure VerifyRunIsNotSetOnAllTestCodeunitsAndFunctions() 391 | begin 392 | VerifyRunOn(NoFilterOnCodeunit(), IsDisabled()) 393 | end; 394 | 395 | local procedure VerifyRunIsSetOnAllTestCodeunitsAndFunctions() 396 | begin 397 | VerifyRunOn(NoFilterOnCodeunit(), IsEnabled()) 398 | end; 399 | 400 | local procedure VerifyRunIsNotSetOnSecondTestCodeunitsAndFunctions(CodeunitID: Integer) 401 | begin 402 | VerifyRunOn(CodeunitID, IsDisabled()) 403 | end; 404 | 405 | local procedure VerifyRunIsSetOnSecondTestCodeunitsAndFunctions(CodeunitID: Integer) 406 | begin 407 | VerifyRunOn(CodeunitID, IsEnabled()) 408 | end; 409 | 410 | local procedure VerifyRunOn(CodeunitID: Integer; Enabled: Boolean) 411 | var 412 | TestMethodLine: Record "Test Method Line"; 413 | NoOfAllLinesInTestSuite: Integer; 414 | NoOfEnabledLinesInTestSuite: Integer; 415 | begin 416 | SetFilterOnTestMethodLine(TestMethodLine, CodeunitID); 417 | NoOfAllLinesInTestSuite := TestMethodLine.Count(); 418 | TestMethodLine.SetRange(Run, Enabled); 419 | NoOfEnabledLinesInTestSuite := TestMethodLine.Count(); 420 | Assert.AreEqual(NoOfAllLinesInTestSuite, NoOfEnabledLinesInTestSuite, 'NoOfAllLines <> NoOfEnabledLines'); 421 | end; 422 | 423 | local procedure SetFilterOnTestMethodLine(var TestMethodLine: Record "Test Method Line"; CodeunitID: Integer) 424 | begin 425 | LibraryVerifyActions.SetFilterOnTestMethodLine(TestMethodLine, TestSuiteName, CodeunitID); 426 | end; 427 | } -------------------------------------------------------------------------------- /ALTestTool/Test/src/codeunit/LibPerfSelectALTT.Codeunit.al: -------------------------------------------------------------------------------- 1 | codeunit 92162 "Lib. - Perf. Select ALTT FLX" 2 | { 3 | // (c) fluxxus.nl - https://github.com/fluxxus-nl/Test-Tool-Extension 4 | 5 | procedure PerformSelectOnAll(TestSuiteName: Code[10]; CodeunitID: Integer) 6 | begin 7 | SetRun(TestSuiteName, CodeunitID, 0) // 0 = All 8 | end; 9 | 10 | procedure PerformDeselectOnAll(TestSuiteName: Code[10]; CodeunitID: Integer) 11 | begin 12 | SetRun(TestSuiteName, CodeunitID, 1) // 1 = None 13 | end; 14 | 15 | procedure PerformSelectOnFailures(TestSuiteName: Code[10]; CodeunitID: Integer) 16 | begin 17 | SetRun(TestSuiteName, CodeunitID, 2) // 2 = Failures 18 | end; 19 | 20 | procedure PerformSelectOnNonFailures(TestSuiteName: Code[10]; CodeunitID: Integer) 21 | begin 22 | SetRun(TestSuiteName, CodeunitID, 3) // 3 = NonFailures 23 | end; 24 | 25 | local procedure SetRun(TestSuiteName: Code[10]; CodeunitID: Integer; RunType: Option All,"Non",Failures,NonFailures) 26 | var 27 | TestMethodLine: Record "Test Method Line"; 28 | SetRunOnTestTool: Codeunit "Set Run On Test Tool ALTT FLX"; 29 | begin 30 | TestMethodLine."Test Suite" := TestSuiteName; 31 | if CodeunitID <> 0 then 32 | TestMethodLine.SetRange("Test Codeunit", CodeunitID); 33 | SetRunOnTestTool.SetRun(TestMethodLine, RunType) 34 | end; 35 | 36 | } -------------------------------------------------------------------------------- /ALTestTool/Test/src/codeunit/LibTestFunctLnsALTT.Codeunit.al: -------------------------------------------------------------------------------- 1 | codeunit 92160 "Lib. - Test Funct Lns ALTT FLX" 2 | { 3 | // (c) fluxxus.nl - https://github.com/fluxxus-nl/Test-Tool-Extension 4 | 5 | var 6 | BaseCodeunitID: Integer; 7 | CurrentCodeunitID: Integer; 8 | 9 | procedure CreateTestSuite(NewName: Code[10]) 10 | var 11 | CALTestSuite: Record "CAL Test Suite"; 12 | begin 13 | if not CALTestSuite.Get(NewName) then begin 14 | CALTestSuite.Name := NewName; 15 | CALTestSuite.Insert(); 16 | end; 17 | end; 18 | 19 | procedure CreateTestCodeunit(TestSuiteName: Code[10]; TestCodeunitID: Integer; Enabled: Boolean) 20 | var 21 | TestMethodLine: Record "Test Method Line"; 22 | begin 23 | CreateTestMethodLine(TestMethodLine, TestSuiteName, TestMethodLine."Line Type"::"Codeunit", TestCodeunitID, Enabled); 24 | end; 25 | 26 | procedure SetTestCodeunitResult(TestSuiteName: Code[10]; TestCodeunitID: Integer) 27 | var 28 | TestCodeunitLine: Record "Test Method Line"; 29 | TestFunctionLine: Record "Test Method Line"; 30 | begin 31 | GetTestCodeunitLine(TestCodeunitLine, TestSuiteName, TestCodeunitID); 32 | 33 | TestFunctionLine.SetRange("Test Suite", TestSuiteName); 34 | TestFunctionLine.SetRange("Test Codeunit", TestCodeunitID); 35 | TestFunctionLine.SetRange("Line Type", TestFunctionLine."Line Type"::Function); 36 | TestFunctionLine.SetRange(Result, TestFunctionLine.Result::Failure); 37 | if TestFunctionLine.FindFirst() then begin 38 | TestCodeunitLine.Result := TestFunctionLine.Result::Failure; 39 | TestCodeunitLine."Error Call Stack" := TestFunctionLine."Error Call Stack"; 40 | TestCodeunitLine."Error Code" := TestFunctionLine."Error Code"; 41 | TestCodeunitLine."Error Message" := TestFunctionLine."Error Message"; 42 | TestCodeunitLine."Error Message Preview" := TestFunctionLine."Error Message Preview"; 43 | end else begin 44 | TestFunctionLine.SetRange(Result); 45 | if TestFunctionLine.FindFirst() then begin 46 | TestCodeunitLine.Result := TestFunctionLine.Result; 47 | TestCodeunitLine."Error Call Stack" := TestFunctionLine."Error Call Stack"; 48 | TestCodeunitLine."Error Code" := TestFunctionLine."Error Code"; 49 | TestCodeunitLine."Error Message" := TestFunctionLine."Error Message"; 50 | TestCodeunitLine."Error Message Preview" := TestFunctionLine."Error Message Preview"; 51 | end; 52 | end; 53 | TestCodeunitLine.Modify(); 54 | end; 55 | 56 | procedure GetTestCodeunitLine(var TestMethodLine: Record "Test Method Line"; TestSuiteName: Code[10]; TestCodeunitID: Integer) 57 | begin 58 | TestMethodLine.SetRange("Test Suite", TestSuiteName); 59 | TestMethodLine.SetRange("Test Codeunit", TestCodeunitID); 60 | TestMethodLine.SetRange("Line Type", TestMethodLine."Line Type"::Codeunit); 61 | TestMethodLine.FindFirst(); 62 | end; 63 | 64 | procedure CreateTestFunction(TestSuiteName: Code[10]; TestCodeunitID: Integer; Enabled: Boolean; Succesfull: Boolean) 65 | var 66 | TestMethodLine: Record "Test Method Line"; 67 | begin 68 | CreateTestMethodLine(TestMethodLine, TestSuiteName, TestMethodLine."Line Type"::"Function", TestCodeunitID, Enabled); 69 | if Succesfull then 70 | TestMethodLine.Result := TestMethodLine.Result::Success 71 | else 72 | TestMethodLine.Result := TestMethodLine.Result::Failure; 73 | TestMethodLine.Modify(); 74 | end; 75 | 76 | procedure CreateTestFunctions(NewSuiteName: Code[10]; NewCodeunitID: Integer; NewEnabled: Boolean; NoOfSuccesfull: Integer; NoOfFailed: Integer) 77 | var 78 | i: Integer; 79 | begin 80 | for i := 1 to NoOfSuccesfull do 81 | CreateTestFunction(NewSuiteName, NewCodeunitID, NewEnabled, true); 82 | 83 | for i := 1 to NoOfFailed do 84 | CreateTestFunction(NewSuiteName, NewCodeunitID, NewEnabled, false); 85 | end; 86 | 87 | procedure CreateTestMethodLine(var TestMethodLine: Record "Test Method Line"; NewSuiteName: Code[10]; NewLineType: Option "Group","Codeunit","Function"; NewCodeunitID: Integer; NewEnabled: Boolean) 88 | var 89 | LineNo: Integer; 90 | begin 91 | LineNo := GetLastTestMethodLineNo(NewSuiteName) + 10000; 92 | TestMethodLine.InitRecord(NewSuiteName, LineNo, NewLineType, NewCodeunitID, NewEnabled); 93 | TestMethodLine.Name := CopyStr(StrSubstNo('%1 %2 %3', Format(NewLineType), NewCodeunitID, LineNo), 1, MaxStrLen(TestMethodLine.Name)); 94 | TestMethodLine."Function" := TestMethodLine.Name; 95 | TestMethodLine.Insert(); 96 | end; 97 | 98 | procedure SetCodeunitBaseID(CodeunitBaseID: Integer) 99 | begin 100 | BaseCodeunitID := CodeunitBaseID; 101 | end; 102 | 103 | procedure GetNextCodeunitID(): Integer 104 | begin 105 | if CurrentCodeunitID = 0 then 106 | CurrentCodeunitID := BaseCodeunitID; 107 | CurrentCodeunitID := CurrentCodeunitID + 1; 108 | exit(CurrentCodeunitID); 109 | end; 110 | 111 | procedure GetCurrentCodeunitID(): Integer 112 | begin 113 | exit(CurrentCodeunitID); 114 | end; 115 | 116 | local procedure GetLastTestMethodLineNo(TestSuiteName: Code[10]): Integer 117 | var 118 | TestMethodLine: Record "Test Method Line"; 119 | begin 120 | TestMethodLine.SetRange("Test Suite", TestSuiteName); 121 | if TestMethodLine.FindLast() then; 122 | exit(TestMethodLine."Line No."); 123 | end; 124 | } -------------------------------------------------------------------------------- /ALTestTool/Test/src/codeunit/LibVerifyActnsALTT.Codeunit.al: -------------------------------------------------------------------------------- 1 | codeunit 92161 "Lib. - Verify Actns. ALTT FLX" 2 | { 3 | // (c) fluxxus.nl - https://github.com/fluxxus-nl/Test-Tool-Extension 4 | 5 | var 6 | Assert: Codeunit Assert; 7 | 8 | procedure VerifySelectOnAllIsDisabled(TestSuiteName: Code[10]; CodeunitID: Integer) 9 | var 10 | TestMethodLine: Record "Test Method Line"; 11 | ActionEnablingArguments: Record "Action Enabl. Args. ALTT FLX"; 12 | SetActionsEnablingOnTestTool: Codeunit "Set Actions Enabling ALTT FLX"; 13 | begin 14 | SetFilterOnTestMethodLine(TestMethodLine, TestSuiteName, CodeunitID); 15 | SetActionsEnablingOnTestTool.SetActionsEnabling(TestMethodLine, ActionEnablingArguments); 16 | Assert.IsFalse(ActionEnablingArguments.SelectAllEnabled, 'Select on All is not disabled'); 17 | end; 18 | 19 | procedure VerifySelectOnAllIsEnabled(TestSuiteName: Code[10]; CodeunitID: Integer) 20 | var 21 | TestMethodLine: Record "Test Method Line"; 22 | ActionEnablingArguments: Record "Action Enabl. Args. ALTT FLX"; 23 | SetActionsEnablingOnTestTool: Codeunit "Set Actions Enabling ALTT FLX"; 24 | begin 25 | SetFilterOnTestMethodLine(TestMethodLine, TestSuiteName, CodeunitID); 26 | SetActionsEnablingOnTestTool.SetActionsEnabling(TestMethodLine, ActionEnablingArguments); 27 | Assert.IsTrue(ActionEnablingArguments.SelectAllEnabled, 'Select on All is not enabled'); 28 | end; 29 | 30 | procedure VerifyDeselectOnAllIsDisabled(TestSuiteName: Code[10]; CodeunitID: Integer) 31 | var 32 | TestMethodLine: Record "Test Method Line"; 33 | ActionEnablingArguments: Record "Action Enabl. Args. ALTT FLX"; 34 | SetActionsEnablingOnTestTool: Codeunit "Set Actions Enabling ALTT FLX"; 35 | begin 36 | SetFilterOnTestMethodLine(TestMethodLine, TestSuiteName, CodeunitID); 37 | SetActionsEnablingOnTestTool.SetActionsEnabling(TestMethodLine, ActionEnablingArguments); 38 | Assert.IsFalse(ActionEnablingArguments.DeselectAllEnabled, 'Deselect on All is not disabled'); 39 | end; 40 | 41 | procedure VerifyDeselectOnAllIsEnabled(TestSuiteName: Code[10]; CodeunitID: Integer) 42 | var 43 | TestMethodLine: Record "Test Method Line"; 44 | ActionEnablingArguments: Record "Action Enabl. Args. ALTT FLX"; 45 | SetActionsEnablingOnTestTool: Codeunit "Set Actions Enabling ALTT FLX"; 46 | begin 47 | SetFilterOnTestMethodLine(TestMethodLine, TestSuiteName, CodeunitID); 48 | SetActionsEnablingOnTestTool.SetActionsEnabling(TestMethodLine, ActionEnablingArguments); 49 | Assert.IsTrue(ActionEnablingArguments.DeselectAllEnabled, 'Deselect on All is not enabled'); 50 | end; 51 | 52 | procedure VerifySelectOnFailuresIsDisabled(TestSuiteName: Code[10]; CodeunitID: Integer) 53 | var 54 | TestMethodLine: Record "Test Method Line"; 55 | ActionEnablingArguments: Record "Action Enabl. Args. ALTT FLX"; 56 | SetActionsEnablingOnTestTool: Codeunit "Set Actions Enabling ALTT FLX"; 57 | begin 58 | SetFilterOnTestMethodLine(TestMethodLine, TestSuiteName, CodeunitID); 59 | SetActionsEnablingOnTestTool.SetActionsEnabling(TestMethodLine, ActionEnablingArguments); 60 | Assert.IsFalse(ActionEnablingArguments.SelectFailuresEnabled, 'Select on Failures is not disabled'); 61 | end; 62 | 63 | procedure VerifySelectOnFailuresIsEnabled(TestSuiteName: Code[10]; CodeunitID: Integer) 64 | var 65 | TestMethodLine: Record "Test Method Line"; 66 | ActionEnablingArguments: Record "Action Enabl. Args. ALTT FLX"; 67 | SetActionsEnablingOnTestTool: Codeunit "Set Actions Enabling ALTT FLX"; 68 | begin 69 | SetFilterOnTestMethodLine(TestMethodLine, TestSuiteName, CodeunitID); 70 | SetActionsEnablingOnTestTool.SetActionsEnabling(TestMethodLine, ActionEnablingArguments); 71 | Assert.IsTrue(ActionEnablingArguments.SelectFailuresEnabled, 'Select on Failures is not enabled'); 72 | end; 73 | 74 | procedure VerifySelectOnNonFailuresIsDisabled(TestSuiteName: Code[10]; CodeunitID: Integer) 75 | var 76 | TestMethodLine: Record "Test Method Line"; 77 | ActionEnablingArguments: Record "Action Enabl. Args. ALTT FLX"; 78 | SetActionsEnablingOnTestTool: Codeunit "Set Actions Enabling ALTT FLX"; 79 | begin 80 | SetFilterOnTestMethodLine(TestMethodLine, TestSuiteName, CodeunitID); 81 | SetActionsEnablingOnTestTool.SetActionsEnabling(TestMethodLine, ActionEnablingArguments); 82 | Assert.IsFalse(ActionEnablingArguments.SelectNonFailuresEnabled, 'Select on Non Failures is not disabled'); 83 | end; 84 | 85 | procedure VerifySelectOnNonFailuresIsEnabled(TestSuiteName: Code[10]; CodeunitID: Integer) 86 | var 87 | TestMethodLine: Record "Test Method Line"; 88 | ActionEnablingArguments: Record "Action Enabl. Args. ALTT FLX"; 89 | SetActionsEnablingOnTestTool: Codeunit "Set Actions Enabling ALTT FLX"; 90 | begin 91 | SetFilterOnTestMethodLine(TestMethodLine, TestSuiteName, CodeunitID); 92 | SetActionsEnablingOnTestTool.SetActionsEnabling(TestMethodLine, ActionEnablingArguments); 93 | Assert.IsTrue(ActionEnablingArguments.SelectNonFailuresEnabled, 'Select on Non Failures is not denabled'); 94 | end; 95 | 96 | procedure SetFilterOnTestMethodLine(var TestMethodLine: Record "Test Method Line"; TestSuiteName: Code[10]; CodeunitID: Integer) 97 | begin 98 | TestMethodLine.SetRange("Test Suite", TestSuiteName); 99 | if CodeunitID <> 0 then 100 | TestMethodLine.SetRange("Test Codeunit", CodeunitID); 101 | end; 102 | 103 | procedure VerifyRunOnAll(TestSuiteName: Code[10]; CodeunitID: Integer; Enabled: Boolean) 104 | var 105 | TestMethodLine: Record "Test Method Line"; 106 | NoOfAllLinesInTestSuite: Integer; 107 | NoOfEnabledLinesInTestSuite: Integer; 108 | begin 109 | SetFilterOnTestMethodLine(TestMethodLine, TestSuiteName, CodeunitID); 110 | NoOfAllLinesInTestSuite := TestMethodLine.Count(); 111 | TestMethodLine.SetRange(Run, Enabled); 112 | NoOfEnabledLinesInTestSuite := TestMethodLine.Count(); 113 | Assert.AreEqual(NoOfAllLinesInTestSuite, NoOfEnabledLinesInTestSuite, 'NoOfAllLines <> NoOfEnabledLines'); 114 | end; 115 | } -------------------------------------------------------------------------------- /ALTestTool/Test/src/codeunit/RunonTestFunctionsALTT.Codeunit.al: -------------------------------------------------------------------------------- 1 | codeunit 92150 "Run on Test Functions ALTT FLX" 2 | { 3 | SubType = Test; 4 | 5 | trigger OnRun() 6 | begin 7 | // (c) fluxxus.nl - https://github.com/fluxxus-nl/Test-Tool-Extension 8 | 9 | // [FEATURE] Run on Unfiltered Test Functions 10 | // [FEATURE] Run on Filtered Test Functions 11 | end; 12 | 13 | [Test] 14 | [TransactionModel(TransactionModel::AutoRollback)] 15 | procedure EnableRunOnUnfilteredTestFunctionsAllDisabled() 16 | // [FEATURE] Run on Unfiltered Test Functions 17 | begin 18 | // [SCENARIO #0001] Enable Run on unfiltered test functions (all disabled) 19 | Initialize(); 20 | 21 | // [GIVEN] One disabled test codeunit with five disabled test functions 22 | CreateOneDisabledTestCodeunitWithFiveDisabledTestFunctions(); 23 | // [GIVEN] One disabled test codeunit with three disabled test functions 24 | CreateOneDisabledTestCodeunitWithThreeDisabledTestFunctions(); 25 | 26 | // [WHEN] Perform Select on All 27 | PerformSelectOnAll(NoFilterOnCodeunit()); 28 | 29 | // [THEN] Run is set on all test codeunits and functions 30 | VerifyRunIsSetOnAllTestCodeunitsAndFunctions(NoFilterOnCodeunit()); 31 | end; 32 | 33 | [Test] 34 | [TransactionModel(TransactionModel::AutoRollback)] 35 | procedure EnableRunOnUnfilteredTestFunctionsAllEnabled() 36 | // [FEATURE] Run on Unfiltered Test Functions 37 | begin 38 | // [SCENARIO #0002] Enable Run on unfiltered test functions (all enabled) 39 | Initialize(); 40 | 41 | // [GIVEN] One enabled test codeunit with five enabled test functions 42 | CreateOneEnabledTestCodeunitWithFiveEnabledTestFunctions(); 43 | // [GIVEN] One enabled test codeunit with three enabled test functions 44 | CreateOneEnabledTestCodeunitWithThreeEnabledTestFunctions(); 45 | 46 | // [WHEN] Perform Select on All 47 | PerformSelectOnAll(NoFilterOnCodeunit()); 48 | 49 | // [THEN] Run is set on all test codeunits and functions 50 | VerifyRunIsSetOnAllTestCodeunitsAndFunctions(NoFilterOnCodeunit()); 51 | end; 52 | 53 | [Test] 54 | [TransactionModel(TransactionModel::AutoRollback)] 55 | procedure DisableRunOnUnfilteredTestFunctionsAllEnabled() 56 | // [FEATURE] Run on Unfiltered Test Functions 57 | begin 58 | // [SCENARIO #0003] Disable Run on unfiltered test functions (all enabled) 59 | Initialize(); 60 | 61 | // [GIVEN] One enabled test codeunit with five enabled test functions 62 | CreateOneEnabledTestCodeunitWithFiveEnabledTestFunctions(); 63 | // [GIVEN] One enabled test codeunit with three enabled test functions 64 | CreateOneEnabledTestCodeunitWithThreeEnabledTestFunctions(); 65 | 66 | // [WHEN] Perform Deselect on All 67 | PerformDeselectOnAll(NoFilterOnCodeunit()); 68 | 69 | // [THEN] Run is not set on all test codeunits and functions 70 | VerifyRunIsNotSetOnAllTestCodeunitsAndFunctions(NoFilterOnCodeunit()); 71 | end; 72 | 73 | [Test] 74 | [TransactionModel(TransactionModel::AutoRollback)] 75 | procedure DisableRunOnUnfilteredTestFunctionsAllDisabled() 76 | // [FEATURE] Run on Unfiltered Test Functions 77 | begin 78 | // [SCENARIO #0004] Disable Run on unfiltered test functions (all disabled) 79 | Initialize(); 80 | 81 | // [GIVEN] One disabled test codeunit with five disabled test functions 82 | CreateOneDisabledTestCodeunitWithFiveDisabledTestFunctions(); 83 | // [GIVEN] One disabled test codeunit with three disabled test functions 84 | CreateOneDisabledTestCodeunitWithThreeDisabledTestFunctions(); 85 | 86 | // [WHEN] Perform Deselect on All 87 | PerformDeselectOnAll(NoFilterOnCodeunit()); 88 | 89 | // [THEN] Run is not set on all test codeunits and functions 90 | VerifyRunIsNotSetOnAllTestCodeunitsAndFunctions(NoFilterOnCodeunit()); 91 | end; 92 | 93 | [Test] 94 | [TransactionModel(TransactionModel::AutoRollback)] 95 | procedure EnableRunOnlyOnUnfilteredFailedTestFunctionsAllEnabled() 96 | // [FEATURE] Run on Unfiltered Test Functions 97 | begin 98 | // [SCENARIO #0005] Enable Run only on unfiltered failed test functions (all enabled) 99 | Initialize(); 100 | 101 | // [GIVEN] One enabled test codeunit with enabled test functions five successful 102 | CreateOneEnabledTestCodeunitWithEnabledTestFunctionsFiveSuccessful(); 103 | // [GIVEN] One enabled test codeunit with enabled test functions one successful and two failed 104 | CreateOneEnabledTestCodeunitWithEnabledTestFunctionsTwoSuccessfulAndTwoFailed(); 105 | // [GIVEN] One enabled test codeunit with enabled test functions two successful and one failed 106 | CreateOneEnabledTestCodeunitWithEnabledTestFunctionsTwoSuccessfulAndTwoFailed(); 107 | 108 | // [WHEN] Perform Select on Failures 109 | PerformSelectOnFailures(NoFilterOnCodeunit()); 110 | 111 | // [THEN] Run is set only on failed test codeunits and functions 112 | VerifyRunIsSetOnlyOnFailedTestCodeunitsAndFunctions(); 113 | end; 114 | 115 | [Test] 116 | [TransactionModel(TransactionModel::AutoRollback)] 117 | procedure EnableRunOnlyOnUnfilteredFailedTestFunctionsAllDisabled() 118 | // [FEATURE] Run on Unfiltered Test Functions 119 | begin 120 | // [SCENARIO #0006] Enable Run only on unfiltered failed test functions (all disabled) 121 | Initialize(); 122 | 123 | // [GIVEN] One disabled test codeunit with disabled test functions five successful 124 | CreateOneDisabledTestCodeunitWithDisabledTestFunctionsFiveSuccessful(); 125 | // [GIVEN] One disabled test codeunit with disabled test functions one successful and two failed 126 | CreateOneDisabledTestCodeunitWithDisabledTestFunctionsTwoSuccessfulAndTwoFailed(); 127 | // [GIVEN] One disabled test codeunit with disabled test functions two successful and one failed 128 | CreateOneDisabledTestCodeunitWithDisabledTestFunctionsTwoSuccessfulAndTwoFailed(); 129 | 130 | // [WHEN] Perform Select on Failures 131 | PerformSelectOnFailures(NoFilterOnCodeunit()); 132 | 133 | // [THEN] Run is set only on failed test codeunits and functions 134 | VerifyRunIsSetOnlyOnFailedTestCodeunitsAndFunctions(); 135 | end; 136 | 137 | [Test] 138 | [TransactionModel(TransactionModel::AutoRollback)] 139 | procedure EnableRunOnlyOnUnfilteredNonFailedTestFunctionsAllEnabled() 140 | // [FEATURE] Run on Unfiltered Test Functions 141 | begin 142 | // [SCENARIO #0007] Enable Run only on unfiltered non failed test functions (all enabled) 143 | Initialize(); 144 | 145 | // [GIVEN] One enabled test codeunit with enabled test functions five successful 146 | CreateOneEnabledTestCodeunitWithEnabledTestFunctionsFiveSuccessful(); 147 | // [GIVEN] One enabled test codeunit with enabled test functions one successful and two failed 148 | CreateOneEnabledTestCodeunitWithEnabledTestFunctionsTwoSuccessfulAndTwoFailed(); 149 | // [GIVEN] One enabled test codeunit with enabled test functions two successful and one failed 150 | CreateOneEnabledTestCodeunitWithEnabledTestFunctionsTwoSuccessfulAndTwoFailed(); 151 | 152 | // [WHEN] Perform Select on Non Failures 153 | PerformSelectOnNonFailures(NoFilterOnCodeunit()); 154 | 155 | // [THEN] Run is set only on non failed test codeunits and functions 156 | VerifyRunIsSetOnlyOnNonFailedTestCodeunitsAndFunctions(); 157 | end; 158 | 159 | [Test] 160 | [TransactionModel(TransactionModel::AutoRollback)] 161 | procedure EnableRunOnlyOnUnfilteredNonFailedTestFunctionsAllDisabled() 162 | // [FEATURE] Run on Unfiltered Test Functions 163 | begin 164 | // [SCENARIO #0008] Enable Run only on unfiltered non failed test functions (all disabled) 165 | Initialize(); 166 | 167 | // [GIVEN] One disabled test codeunit with disabled test functions five successful 168 | CreateOneDisabledTestCodeunitWithDisabledTestFunctionsFiveSuccessful(); 169 | // [GIVEN] One disabled test codeunit with disabled test functions one successful and two failed 170 | CreateOneDisabledTestCodeunitWithDisabledTestFunctionsTwoSuccessfulAndTwoFailed(); 171 | // [GIVEN] One disabled test codeunit with disabled test functions two successful and one failed 172 | CreateOneDisabledTestCodeunitWithDisabledTestFunctionsTwoSuccessfulAndTwoFailed(); 173 | 174 | // [WHEN] Perform Select on Non Failures 175 | PerformSelectOnNonFailures(NoFilterOnCodeunit()); 176 | 177 | // [THEN] Run is set only on non failed test codeunits and functions 178 | VerifyRunIsSetOnlyOnNonFailedTestCodeunitsAndFunctions(); 179 | end; 180 | 181 | [Test] 182 | [TransactionModel(TransactionModel::AutoRollback)] 183 | procedure EnableRunOnFilteredTestFunctionsAllDisabled() 184 | // [FEATURE] Run on Filtered Test Functions 185 | var 186 | SecondCodeunitID: Integer; 187 | begin 188 | // [SCENARIO #0009] Enable Run on filtered test functions (all disabled) 189 | Initialize(); 190 | 191 | // [GIVEN] One disabled test codeunit with five disabled test functions 192 | CreateOneDisabledTestCodeunitWithFiveDisabledTestFunctions(); 193 | // [GIVEN] One disabled test codeunit with three disabled test functions 194 | SecondCodeunitID := CreateOneDisabledTestCodeunitWithThreeDisabledTestFunctions(); 195 | // [GIVEN] Filter on second test codeunit 196 | // handled by Perform... task in [WHEN] part based on SecondCodeunitID 197 | 198 | // [WHEN] Perform Select on All 199 | PerformSelectOnAll(SetFilterOn(SecondCodeunitID)); 200 | 201 | // [THEN] Run is set only on second test codeunit and its functions 202 | VerifyRunIsSetOnlyOnSecondTestCodeunitAndItsFunctions(SecondCodeunitID); 203 | end; 204 | 205 | [Test] 206 | [TransactionModel(TransactionModel::AutoRollback)] 207 | procedure EnableRunOnFilteredTestFunctionsAllEnabled() 208 | // [FEATURE] Run on Filtered Test Functions 209 | var 210 | SecondCodeunitID: Integer; 211 | begin 212 | // [SCENARIO #0010] Enable Run on filtered test functions (all enabled) 213 | Initialize(); 214 | // [GIVEN] One enabled test codeunit with five enabled test functions 215 | CreateOneEnabledTestCodeunitWithFiveEnabledTestFunctions(); 216 | // [GIVEN] One enabled test codeunit with three enabled test functions 217 | SecondCodeunitID := CreateOneEnabledTestCodeunitWithThreeEnabledTestFunctions(); 218 | // [GIVEN] Filter on second test codeunit 219 | // handled by Perform... task in [WHEN] part based on SecondCodeunitID 220 | 221 | // [WHEN] Perform Select on All 222 | PerformSelectOnAll(SetFilterOn(SecondCodeunitID)); 223 | 224 | // [THEN] Run is set on all test codeunits and functions 225 | VerifyRunIsSetOnAllTestCodeunitsAndFunctions(SetFilterOn(SecondCodeunitID)); 226 | end; 227 | 228 | [Test] 229 | [TransactionModel(TransactionModel::AutoRollback)] 230 | procedure DisableRunOnFilteredTestFunctionsAllEnabled() 231 | // [FEATURE] Run on Filtered Test Functions 232 | var 233 | SecondCodeunitID: Integer; 234 | begin 235 | // [SCENARIO #0011] Disable Run on filtered test functions (all enabled) 236 | Initialize(); 237 | 238 | // [GIVEN] One enabled test codeunit with five enabled test functions 239 | CreateOneEnabledTestCodeunitWithFiveEnabledTestFunctions(); 240 | // [GIVEN] One enabled test codeunit with three enabled test functions 241 | SecondCodeunitID := CreateOneEnabledTestCodeunitWithThreeEnabledTestFunctions(); 242 | // [GIVEN] Filter on second test codeunit 243 | // handled by Perform... task in [WHEN] part based on SecondCodeunitID 244 | 245 | // [WHEN] Perform Deselect on All 246 | PerformDeselectOnAll(SetFilterOn(SecondCodeunitID)); 247 | 248 | // [THEN] Run is not set on second test codeunit and its functions 249 | VerifyRunIsNotSetOnSecondTestCodeunitAndItsFunctions(SecondCodeunitID); 250 | end; 251 | 252 | [Test] 253 | [TransactionModel(TransactionModel::AutoRollback)] 254 | procedure DisableRunOnFilteredTestFunctionsAllDisabled() 255 | // [FEATURE] Run on Filtered Test Functions 256 | var 257 | SecondCodeunitID: Integer; 258 | begin 259 | // [SCENARIO #0012] Disable Run on filtered test functions (all disabled) 260 | Initialize(); 261 | 262 | // [GIVEN] One disabled test codeunit with five disabled test functions 263 | CreateOneDisabledTestCodeunitWithFiveDisabledTestFunctions(); 264 | // [GIVEN] One disabled test codeunit with three disabled test functions 265 | SecondCodeunitID := CreateOneDisabledTestCodeunitWithThreeDisabledTestFunctions(); 266 | // [GIVEN] Filter on second test codeunit 267 | // handled by Perform... task in [WHEN] part based on SecondCodeunitID 268 | 269 | // [WHEN] Perform Deselect on All 270 | PerformDeselectOnAll(SetFilterOn(SecondCodeunitID)); 271 | 272 | // [THEN] Run is not set on all test codeunits and functions 273 | VerifyRunIsNotSetOnAllTestCodeunitsAndFunctions(SetFilterOn(SecondCodeunitID)); 274 | end; 275 | 276 | [Test] 277 | [TransactionModel(TransactionModel::AutoRollback)] 278 | procedure EnableRunOnlyOnFilteredFailedTestFunctionsAllEnabled() 279 | // [FEATURE] Run on Filtered Test Functions 280 | var 281 | SecondCodeunitID: Integer; 282 | begin 283 | // [SCENARIO #0013] Enable Run only on filtered failed test functions (all enabled) 284 | Initialize(); 285 | 286 | // [GIVEN] One enabled test codeunit with enabled test functions five successful 287 | CreateOneEnabledTestCodeunitWithEnabledTestFunctionsFiveSuccessful(); 288 | // [GIVEN] One enabled test codeunit with enabled test functions two successful and two failed 289 | SecondCodeunitID := CreateOneEnabledTestCodeunitWithEnabledTestFunctionsTwoSuccessfulAndTwoFailed(); 290 | // [GIVEN] One enabled test codeunit with enabled test functions two successful and two failed 291 | CreateOneEnabledTestCodeunitWithEnabledTestFunctionsTwoSuccessfulAndTwoFailed(); 292 | // [GIVEN] Filter on second test codeunit 293 | // handled by Perform... task in [WHEN] part based on SecondCodeunitID 294 | 295 | // [WHEN] Perform Select on Failures 296 | PerformSelectOnFailures(SetFilterOn(SecondCodeunitID)); 297 | 298 | // [THEN] Run is not set only on non failed functions of second test codeunit 299 | VerifyRunIsNotSetOnlyOnNonFailedFunctionsOfSecondTestCodeunit(SecondCodeunitID); 300 | end; 301 | 302 | [Test] 303 | [TransactionModel(TransactionModel::AutoRollback)] 304 | procedure EnableRunOnlyOnFilteredFailedTestFunctionsAllDisabled() 305 | // [FEATURE] Run on Filtered Test Functions 306 | var 307 | SecondCodeunitID: Integer; 308 | begin 309 | // [SCENARIO #0014] Enable Run only on filtered failed test functions (all disabled) 310 | Initialize(); 311 | 312 | // [GIVEN] One disabled test codeunit with disabled test functions five successful 313 | CreateOneDisabledTestCodeunitWithDisabledTestFunctionsFiveSuccessful(); 314 | // [GIVEN] One disabled test codeunit with disabled test functions two successful and two failed 315 | SecondCodeunitID := CreateOneDisabledTestCodeunitWithDisabledTestFunctionsTwoSuccessfulAndTwoFailed(); 316 | // [GIVEN] One disabled test codeunit with disabled test functions two successful and two failed 317 | CreateOneDisabledTestCodeunitWithDisabledTestFunctionsTwoSuccessfulAndTwoFailed(); 318 | // [GIVEN] Filter on second test codeunit 319 | // handled by Perform... task in [WHEN] part based on SecondCodeunitID 320 | 321 | // [WHEN] Perform Select on Failures 322 | PerformSelectOnFailures(SetFilterOn(SecondCodeunitID)); 323 | 324 | // [THEN] Run is set only on second test codeunit and its failed functions 325 | VerifyRunIsSetOnlyOnSecondTestCodeunitAndItsFailedFunctions(SecondCodeunitID); 326 | end; 327 | 328 | [Test] 329 | [TransactionModel(TransactionModel::AutoRollback)] 330 | procedure EnableRunOnlyOnFilteredNonFailedTestFunctionsAllEnabled() 331 | // [FEATURE] Run on Filtered Test Functions 332 | var 333 | SecondCodeunitID: Integer; 334 | begin 335 | // [SCENARIO #0015] Enable Run only on filtered non failed test functions (all enabled) 336 | Initialize(); 337 | 338 | // [GIVEN] One enabled test codeunit with enabled test functions five successful 339 | CreateOneEnabledTestCodeunitWithEnabledTestFunctionsFiveSuccessful(); 340 | // [GIVEN] One enabled test codeunit with enabled test functions two successful and two failed 341 | SecondCodeunitID := CreateOneEnabledTestCodeunitWithEnabledTestFunctionsTwoSuccessfulAndTwoFailed(); 342 | // [GIVEN] One enabled test codeunit with enabled test functions two successful and two failed 343 | CreateOneEnabledTestCodeunitWithEnabledTestFunctionsTwoSuccessfulAndTwoFailed(); 344 | // [GIVEN] Filter on second test codeunit 345 | // handled by Perform... task in [WHEN] part based on SecondCodeunitID 346 | 347 | // [WHEN] Perform Select on Non Failures 348 | PerformSelectOnNonFailures(SetFilterOn(SecondCodeunitID)); 349 | 350 | // [THEN] Run is not set only on failed functions of second test codeunit 351 | VerifyRunIsNotSetOnlyOnFailedFunctionsOfSecondTestCodeunit(SecondCodeunitID); 352 | end; 353 | 354 | [Test] 355 | [TransactionModel(TransactionModel::AutoRollback)] 356 | procedure EnableRunOnlyOnFilteredNonFailedTestFunctionsAllDisabled() 357 | // [FEATURE] Run on Filtered Test Functions 358 | var 359 | SecondCodeunitID: Integer; 360 | begin 361 | // [SCENARIO #0016] Enable Run only on filtered non failed test functions (all disabled) 362 | Initialize(); 363 | 364 | // [GIVEN] One disabled test codeunit with disabled test functions five successful 365 | CreateOneDisabledTestCodeunitWithDisabledTestFunctionsFiveSuccessful(); 366 | // [GIVEN] One disabled test codeunit with disabled test functions two successful and two failed 367 | SecondCodeunitID := CreateOneDisabledTestCodeunitWithDisabledTestFunctionsTwoSuccessfulAndTwoFailed(); 368 | // [GIVEN] One disabled test codeunit with disabled test functions two successful and two failed 369 | CreateOneDisabledTestCodeunitWithDisabledTestFunctionsTwoSuccessfulAndTwoFailed(); 370 | // [GIVEN] Filter on second test codeunit 371 | // handled by Perform... task in [WHEN] part based on SecondCodeunitID 372 | 373 | // [WHEN] Perform Select on Non Failures 374 | PerformSelectOnNonFailures(SetFilterOn(SecondCodeunitID)); 375 | 376 | // [THEN] Run is set only on second test codeunit and its non failed functions 377 | VerifyRunIsSetOnlyOnSecondTestCodeunitAndItsNonFailedFunctions(SecondCodeunitID); 378 | end; 379 | 380 | var 381 | Assert: Codeunit Assert; 382 | LibraryPerformSelect: Codeunit "Lib. - Perf. Select ALTT FLX"; 383 | LibraryTestFunctions: Codeunit "Lib. - Test Funct Lns ALTT FLX"; 384 | LibraryVerifyActions: Codeunit "Lib. - Verify Actns. ALTT FLX"; 385 | 386 | TestSuiteName: Code[10]; 387 | 388 | local procedure Initialize() 389 | var 390 | LibraryTestInitialize: Codeunit "Library - Test Initialize"; 391 | LibraryUtility: Codeunit "Library - Utility"; 392 | begin 393 | LibraryTestInitialize.OnTestInitialize(Codeunit::"Run on Test Functions ALTT FLX"); 394 | 395 | TestSuiteName := LibraryUtility.GenerateGUID(); 396 | LibraryTestFunctions.CreateTestSuite(TestSuiteName); 397 | LibraryTestFunctions.SetCodeunitBaseID(-92100); 398 | end; 399 | 400 | local procedure CreateOneDisabledTestCodeunitWithDisabledTestFunctionsFiveSuccessful(): Integer 401 | begin 402 | LibraryTestFunctions.CreateTestCodeunit(TestSuiteName, LibraryTestFunctions.GetNextCodeunitID(), IsDisabled()); 403 | LibraryTestFunctions.CreateTestFunctions(TestSuiteName, LibraryTestFunctions.GetCurrentCodeunitID(), IsDisabled(), 5, 0); 404 | exit(LibraryTestFunctions.GetCurrentCodeunitID()) 405 | end; 406 | 407 | local procedure CreateOneDisabledTestCodeunitWithDisabledTestFunctionsTwoSuccessfulAndTwoFailed(): Integer 408 | begin 409 | LibraryTestFunctions.CreateTestCodeunit(TestSuiteName, LibraryTestFunctions.GetNextCodeunitID(), IsDisabled()); 410 | LibraryTestFunctions.CreateTestFunctions(TestSuiteName, LibraryTestFunctions.GetCurrentCodeunitID(), IsDisabled(), 2, 2); 411 | exit(LibraryTestFunctions.GetCurrentCodeunitID()) 412 | end; 413 | 414 | local procedure CreateOneDisabledTestCodeunitWithFiveDisabledTestFunctions(): Integer 415 | begin 416 | LibraryTestFunctions.CreateTestCodeunit(TestSuiteName, LibraryTestFunctions.GetNextCodeunitID(), IsDisabled()); 417 | LibraryTestFunctions.CreateTestFunctions(TestSuiteName, LibraryTestFunctions.GetCurrentCodeunitID(), IsDisabled(), 5, 0); 418 | exit(LibraryTestFunctions.GetCurrentCodeunitID()) 419 | end; 420 | 421 | local procedure CreateOneDisabledTestCodeunitWithThreeDisabledTestFunctions(): Integer 422 | begin 423 | LibraryTestFunctions.CreateTestCodeunit(TestSuiteName, LibraryTestFunctions.GetNextCodeunitID(), IsDisabled()); 424 | LibraryTestFunctions.CreateTestFunctions(TestSuiteName, LibraryTestFunctions.GetCurrentCodeunitID(), IsDisabled(), 3, 0); 425 | exit(LibraryTestFunctions.GetCurrentCodeunitID()) 426 | end; 427 | 428 | local procedure CreateOneEnabledTestCodeunitWithEnabledTestFunctionsFiveSuccessful(): Integer 429 | begin 430 | LibraryTestFunctions.CreateTestCodeunit(TestSuiteName, LibraryTestFunctions.GetNextCodeunitID(), IsEnabled()); 431 | LibraryTestFunctions.CreateTestFunctions(TestSuiteName, LibraryTestFunctions.GetCurrentCodeunitID(), IsEnabled(), 5, 0); 432 | exit(LibraryTestFunctions.GetCurrentCodeunitID()) 433 | end; 434 | 435 | local procedure CreateOneEnabledTestCodeunitWithEnabledTestFunctionsTwoSuccessfulAndTwoFailed(): Integer 436 | begin 437 | LibraryTestFunctions.CreateTestCodeunit(TestSuiteName, LibraryTestFunctions.GetNextCodeunitID(), IsEnabled()); 438 | LibraryTestFunctions.CreateTestFunctions(TestSuiteName, LibraryTestFunctions.GetCurrentCodeunitID(), IsEnabled(), 2, 2); 439 | exit(LibraryTestFunctions.GetCurrentCodeunitID()) 440 | end; 441 | 442 | local procedure CreateOneEnabledTestCodeunitWithFiveEnabledTestFunctions(): Integer 443 | begin 444 | LibraryTestFunctions.CreateTestCodeunit(TestSuiteName, LibraryTestFunctions.GetNextCodeunitID(), IsEnabled()); 445 | LibraryTestFunctions.CreateTestFunctions(TestSuiteName, LibraryTestFunctions.GetCurrentCodeunitID(), IsEnabled(), 5, 0); 446 | exit(LibraryTestFunctions.GetCurrentCodeunitID()) 447 | end; 448 | 449 | local procedure CreateOneEnabledTestCodeunitWithThreeEnabledTestFunctions(): Integer 450 | begin 451 | LibraryTestFunctions.CreateTestCodeunit(TestSuiteName, LibraryTestFunctions.GetNextCodeunitID(), IsEnabled()); 452 | LibraryTestFunctions.CreateTestFunctions(TestSuiteName, LibraryTestFunctions.GetCurrentCodeunitID(), IsEnabled(), 3, 0); 453 | exit(LibraryTestFunctions.GetCurrentCodeunitID()); 454 | end; 455 | 456 | local procedure PerformSelectOnAll(CodeunitID: Integer) 457 | begin 458 | LibraryPerformSelect.PerformSelectOnAll(TestSuiteName, CodeunitID) 459 | end; 460 | 461 | local procedure PerformDeselectOnAll(CodeunitID: Integer) 462 | begin 463 | LibraryPerformSelect.PerformDeselectOnAll(TestSuiteName, CodeunitID) 464 | end; 465 | 466 | local procedure PerformSelectOnFailures(CodeunitID: Integer) 467 | begin 468 | LibraryPerformSelect.PerformSelectOnFailures(TestSuiteName, CodeunitID) 469 | end; 470 | 471 | local procedure PerformSelectOnNonFailures(CodeunitID: Integer) 472 | begin 473 | LibraryPerformSelect.PerformSelectOnNonFailures(TestSuiteName, CodeunitID) 474 | end; 475 | 476 | local procedure NoFilterOnCodeunit(): Integer 477 | begin 478 | exit(0) 479 | end; 480 | 481 | local procedure SetFilterOn(CodeunitID: Integer): Integer 482 | begin 483 | exit(CodeunitID) 484 | end; 485 | 486 | local procedure IsEnabled(): Boolean 487 | begin 488 | exit(true) 489 | end; 490 | 491 | local procedure IsDisabled(): Boolean 492 | begin 493 | exit(false) 494 | end; 495 | 496 | local procedure VerifyRunIsSetOnAllTestCodeunitsAndFunctions(CodeunitID: Integer) 497 | begin 498 | LibraryVerifyActions.VerifyRunOnAll(TestSuiteName, CodeunitID, IsEnabled()) 499 | end; 500 | 501 | local procedure VerifyRunIsNotSetOnAllTestCodeunitsAndFunctions(CodeunitID: Integer) 502 | begin 503 | LibraryVerifyActions.VerifyRunOnAll(TestSuiteName, CodeunitID, IsDisabled()) 504 | end; 505 | 506 | local procedure VerifyRunIsSetOnlyOnFailedTestCodeunitsAndFunctions() 507 | var 508 | TestMethodLine: Record "Test Method Line"; 509 | NoOfEnabledLinesInTestSuite: Integer; 510 | NoOfFailedLinesInTestSuite: Integer; 511 | begin 512 | TestMethodLine.SetRange("Test Suite", TestSuiteName); 513 | TestMethodLine.SetRange(Run, true); 514 | NoOfEnabledLinesInTestSuite := TestMethodLine.Count(); 515 | TestMethodLine.SetRange(Run); 516 | TestMethodLine.SetRange(Result, TestMethodLine.Result::Failure); 517 | NoOfFailedLinesInTestSuite := TestMethodLine.Count(); 518 | Assert.AreEqual(NoOfFailedLinesInTestSuite, NoOfEnabledLinesInTestSuite, 'NoOfFailedLines <> NoOfEnabledLines'); 519 | end; 520 | 521 | local procedure VerifyRunIsSetOnlyOnNonFailedTestCodeunitsAndFunctions() 522 | var 523 | TestMethodLine: Record "Test Method Line"; 524 | NoOfEnabledLinesInTestSuite: Integer; 525 | NoOfNonFailedLinesInTestSuite: Integer; 526 | begin 527 | TestMethodLine.SetRange("Test Suite", TestSuiteName); 528 | TestMethodLine.SetRange(Run, true); 529 | NoOfEnabledLinesInTestSuite := TestMethodLine.Count(); 530 | TestMethodLine.SetRange(Run); 531 | TestMethodLine.SetFilter(Result, '<>%1', TestMethodLine.Result::Failure); 532 | NoOfNonFailedLinesInTestSuite := TestMethodLine.Count(); 533 | Assert.AreEqual(NoOfNonFailedLinesInTestSuite, NoOfEnabledLinesInTestSuite, 'NoOfNonFailedLines <> NoOfEnabledLines'); 534 | end; 535 | 536 | local procedure VerifyRunIsNotSetOnlyOnFailedFunctionsOfSecondTestCodeunit(CodeunitID: Integer) 537 | var 538 | TestMethodLine: Record "Test Method Line"; 539 | NoOfDisabledLinesInTestSuite: Integer; 540 | NoOfFailedLinesInTestCodeunit: Integer; 541 | begin 542 | TestMethodLine.SetRange("Test Suite", TestSuiteName); 543 | TestMethodLine.SetRange(Run, false); 544 | NoOfDisabledLinesInTestSuite := TestMethodLine.Count(); 545 | TestMethodLine.SetRange(Run); 546 | TestMethodLine.SetRange("Test Codeunit", CodeunitID); 547 | TestMethodLine.SetRange(Result, TestMethodLine.Result::Failure); 548 | TestMethodLine.SetRange("Line Type", TestMethodLine."Line Type"::Function); 549 | NoOfFailedLinesInTestCodeunit := TestMethodLine.Count(); 550 | Assert.AreEqual(NoOfFailedLinesInTestCodeunit, NoOfDisabledLinesInTestSuite, 'NoOfFailedLines <> NoOfDisabledLines'); 551 | end; 552 | 553 | local procedure VerifyRunIsNotSetOnlyOnNonFailedFunctionsOfSecondTestCodeunit(CodeunitID: Integer) 554 | var 555 | TestMethodLine: Record "Test Method Line"; 556 | NoOfDisabledLinesInTestSuite: Integer; 557 | NoOfNonFailedLinesInTestCodeunit: Integer; 558 | begin 559 | TestMethodLine.SetRange("Test Suite", TestSuiteName); 560 | TestMethodLine.SetRange(Run, false); 561 | NoOfDisabledLinesInTestSuite := TestMethodLine.Count(); 562 | TestMethodLine.SetRange(Run); 563 | TestMethodLine.SetRange("Test Codeunit", CodeunitID); 564 | TestMethodLine.SetFilter(Result, '<>%1', TestMethodLine.Result::Failure); 565 | NoOfNonFailedLinesInTestCodeunit := TestMethodLine.Count(); 566 | Assert.AreEqual(NoOfNonFailedLinesInTestCodeunit, NoOfDisabledLinesInTestSuite, 'NoOfNonFailedLines <> NoOfDisabledLines'); 567 | end; 568 | 569 | local procedure VerifyRunIsNotSetOnSecondTestCodeunitAndItsFunctions(CodeunitID: Integer) 570 | var 571 | TestMethodLine: Record "Test Method Line"; 572 | NoOfDisabledLinesInTestSuite: Integer; 573 | NoOfLinesInTestCodeunit: Integer; 574 | begin 575 | TestMethodLine.SetRange("Test Suite", TestSuiteName); 576 | TestMethodLine.SetRange(Run, false); 577 | NoOfDisabledLinesInTestSuite := TestMethodLine.Count(); 578 | TestMethodLine.SetRange(Run); 579 | TestMethodLine.SetRange("Test Codeunit", CodeunitID); 580 | NoOfLinesInTestCodeunit := TestMethodLine.Count(); 581 | Assert.AreEqual(NoOfLinesInTestCodeunit, NoOfDisabledLinesInTestSuite, 'NoOfLinesInTestCodeunit <> NoOfDisabledLines'); 582 | end; 583 | 584 | local procedure VerifyRunIsSetOnlyOnSecondTestCodeunitAndItsFailedFunctions(CodeunitID: Integer) 585 | var 586 | TestMethodLine: Record "Test Method Line"; 587 | NoOfEnabledLinesInTestSuite: Integer; 588 | NoOfFailedLinesInTestCodeunit: Integer; 589 | begin 590 | TestMethodLine.SetRange("Test Suite", TestSuiteName); 591 | TestMethodLine.SetRange(Run, true); 592 | NoOfEnabledLinesInTestSuite := TestMethodLine.Count(); 593 | TestMethodLine.SetRange(Run); 594 | TestMethodLine.SetRange("Test Codeunit", CodeunitID); 595 | TestMethodLine.SetRange(Result, TestMethodLine.Result::Failure); 596 | NoOfFailedLinesInTestCodeunit := TestMethodLine.Count(); 597 | Assert.AreEqual(NoOfFailedLinesInTestCodeunit, NoOfEnabledLinesInTestSuite, 'NoOfFailedLines <> NoOfEnabledLines'); 598 | end; 599 | 600 | local procedure VerifyRunIsSetOnlyOnSecondTestCodeunitAndItsFunctions(CodeunitID: Integer) 601 | var 602 | TestMethodLine: Record "Test Method Line"; 603 | NoOfEnabledLinesInTestCodeunit: Integer; 604 | NoOfEnabledLinesInTestSuite: Integer; 605 | begin 606 | TestMethodLine.SetRange("Test Suite", TestSuiteName); 607 | TestMethodLine.SetRange(Run, true); 608 | NoOfEnabledLinesInTestSuite := TestMethodLine.Count(); 609 | TestMethodLine.SetRange(Run); 610 | TestMethodLine.SetRange("Test Codeunit", CodeunitID); 611 | NoOfEnabledLinesInTestCodeunit := TestMethodLine.Count(); 612 | Assert.AreEqual(NoOfEnabledLinesInTestCodeunit, NoOfEnabledLinesInTestSuite, 'NoOfEnabledLinesInTestCodeunit <> NoOfEnabledLines'); 613 | end; 614 | 615 | local procedure VerifyRunIsSetOnlyOnSecondTestCodeunitAndItsNonFailedFunctions(CodeunitID: Integer) 616 | var 617 | TestMethodLine: Record "Test Method Line"; 618 | NoOfEnabledLinesInTestSuite: Integer; 619 | NoOfNonFailedLinesInTestCodeunit: Integer; 620 | begin 621 | TestMethodLine.SetRange("Test Suite", TestSuiteName); 622 | TestMethodLine.SetRange(Run, true); 623 | NoOfEnabledLinesInTestSuite := TestMethodLine.Count(); 624 | TestMethodLine.SetRange(Run); 625 | TestMethodLine.SetRange("Test Codeunit", CodeunitID); 626 | TestMethodLine.SetFilter(Result, '<>%1', TestMethodLine.Result::Failure); 627 | NoOfNonFailedLinesInTestCodeunit := TestMethodLine.Count(); 628 | Assert.AreEqual(NoOfNonFailedLinesInTestCodeunit, NoOfEnabledLinesInTestSuite, 'NoOfNonFailedLines <> NoOfEnabledLines'); 629 | end; 630 | } -------------------------------------------------------------------------------- /ALTestTool/Test/src/codeunit/TestInstallTTE.Codeunit.al: -------------------------------------------------------------------------------- 1 | codeunit 92199 "Test Install TTE FLX" 2 | { 3 | Subtype = Install; 4 | 5 | trigger OnInstallAppPerCompany() 6 | begin 7 | SetupTestSuite(); 8 | end; 9 | 10 | local procedure SetupTestSuite() 11 | var 12 | ALTestSuite: Record "AL Test Suite"; 13 | TestSuiteMgt: Codeunit "Test Suite Mgt."; 14 | SuiteName: Code[10]; 15 | MyModuleInfo: ModuleInfo; 16 | begin 17 | NavApp.GetCurrentModuleInfo(MyModuleInfo); 18 | SuiteName := 'DEFAULT'; 19 | 20 | if ALTestSuite.Get(SuiteName) then 21 | ALTestSuite.Delete(true); 22 | 23 | TestSuiteMgt.CreateTestSuite(SuiteName); 24 | ALTestSuite.Get(SuiteName); 25 | TestSuiteMgt.SelectTestMethodsByExtension(ALTestSuite, MyModuleInfo.id()); 26 | end; 27 | } -------------------------------------------------------------------------------- /ALTestTool/azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | name: $(Build.BuildId) 2 | 3 | trigger: 4 | branches: 5 | include: 6 | - master/ALTestTool 7 | 8 | variables: 9 | - group: 'PipelineVariables' 10 | 11 | pool: TestAutomationExamples 12 | 13 | steps: 14 | - checkout: self 15 | clean: true 16 | 17 | - task: ALOpsDockerCreate@1 18 | displayName: 'ALOPS - Create Docker Image' # It will reuse the image if already exists, or build one if it doesn't. 19 | inputs: 20 | artifacttype: Sandbox 21 | 22 | - task: ALOpsDockerStart@1 23 | displayName: 'ALOPS - Start Docker Container' # No need to provide any details - it will get the details from previous step 24 | 25 | - task: ALOpsDockerWait@1 26 | displayName: 'ALOPS - Wait for Docker Container to start' 27 | inputs: 28 | search_string: 'Ready for connections!' 29 | 30 | - task: ALOpsLicenseImport@1 31 | displayName: 'ALOPS - License Import' 32 | inputs: 33 | usedocker: true 34 | license_path: '$(LuxBeheerBcDevLicense)' 35 | 36 | #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 37 | 38 | - task: ALOpsAppPublish@1 39 | displayName: 'ALOPS - Install AL TestTool' # install necessary dependent apps for testability 40 | inputs: 41 | usedocker: true 42 | installaltesttool: true 43 | skip_verification: true 44 | install_al_app_names: | 45 | Tests-TestLibraries 46 | System Application Test 47 | System Application Test Library 48 | Any 49 | Library Assert 50 | Test Runner 51 | 52 | #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 53 | 54 | - task: ALOpsAppCompiler@1 55 | displayName: 'ALOPS - Compile Extension: App' 56 | inputs: 57 | usedocker: true 58 | nav_app_version: '1.0.[yyyyWW].*' 59 | targetproject: 'ALTestTool/app/app.json' 60 | app_file_suffix: '_APP' # A trick to uniquely identify the APP (from the TEST-app) 61 | 62 | - task: ALOpsAppPublish@1 63 | displayName: 'ALOPS - Publish Extension' 64 | inputs: 65 | usedocker: true 66 | nav_artifact_app_filter: '*.app' 67 | skip_verification: true 68 | 69 | - task: ALOpsAppCompiler@1 70 | displayName: 'ALOPS - Compile Extension: Test-App' 71 | inputs: 72 | usedocker: true 73 | nav_app_version: '1.0.[yyyyWW].*' 74 | targetproject: 'ALTestTool/test/app.json' 75 | app_file_suffix: '_TEST' # A trick to uniquely identify the Test-App (from the App) 76 | 77 | - task: ALOpsAppPublish@1 78 | displayName: 'ALOPS - Publish Extension' 79 | inputs: 80 | usedocker: true 81 | nav_artifact_app_filter: '*.app' 82 | skip_verification: true 83 | 84 | #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 85 | 86 | - task: ALOpsAppTest@1 87 | displayName: 'ALOPS - Run TestSuite' 88 | inputs: 89 | usedocker: true 90 | import_action: "Skip" 91 | import_testtoolkit: false 92 | testpage: '130455' 93 | testsuite: 'DEFAULT' 94 | failed_test_action: 'Ignore' 95 | continueOnError: true 96 | 97 | - task: PublishTestResults@2 98 | displayName: 'Publish Test Results **/TestResults.xml' 99 | inputs: 100 | testResultsFormat: XUnit 101 | testResultsFiles: '**/TestResults.xml' 102 | failTaskOnFailedTests: true 103 | testRunTitle: 'BC Test Results: $(Build.BuildId)' 104 | 105 | #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 106 | 107 | - task: ALOpsDockerRemove@1 108 | displayName: 'ALOPS - Remove Docker Container' 109 | enabled: true 110 | condition: always() -------------------------------------------------------------------------------- /CALTestTool/.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignores generated binary files and temporary files from Visual Studio and Visual Studio code 2 | 3 | # Binary files 4 | .alpackages/ 5 | *.app 6 | 7 | # Temp files 8 | .vs/ 9 | .vscode/ 10 | -------------------------------------------------------------------------------- /CALTestTool/ATDD Scenarios/EnablingActionsSelectDeselectOnAllScenarios.ps1: -------------------------------------------------------------------------------- 1 | $Features = @() 2 | 3 | $Features += 4 | Feature 'Enabling Actions Select/Deselect on All Unfiltered' { 5 | Scenario 1 'Unfiltered disabled test functions' { 6 | Given 'One disabled test codeunit with five disabled test functions' 7 | Given 'One disabled test codeunit with three disabled test functions' 8 | When 'Do nothing' 9 | Then 'Select on All is enabled' 10 | Then 'Deselect on All is disabled' 11 | } 12 | 13 | Scenario 2 'Unfiltered enabled test functions' { 14 | Given 'One enabled test codeunit with five enabled test functions' 15 | Given 'One enabled test codeunit with three enabled test functions' 16 | When 'Do nothing' 17 | Then 'Select on All is disabled' 18 | Then 'Deselect on All is enabled' 19 | } 20 | 21 | Scenario 3 'Unfiltered enabled and disbled test functions' { 22 | Given 'One enabled test codeunit with five enabled test functions' 23 | Given 'One disabled test codeunit with three disabled test functions' 24 | When 'Do nothing' 25 | Then 'Select on All is enabled' 26 | Then 'Deselect on All is enabled' 27 | } 28 | 29 | Scenario 4 'Enable Run on unfiltered successful test functions' { 30 | Given 'One disabled test codeunit with five disabled successful test functions' 31 | Given 'One disabled test codeunit with three disabled successful test functions' 32 | When 'Perform Select on All' 33 | Then 'Run is set on all test codeunits and functions' 34 | Then 'Select on All is disabled' 35 | Then 'Deselect on All is enabled' 36 | } 37 | 38 | Scenario 5 'Disable Run on unfiltered successful test functions' { 39 | Given 'One enabled test codeunit with five enabled successful test functions' 40 | Given 'One enabled test codeunit with three enabled successful test functions' 41 | When 'Perform Deselect on All' 42 | Then 'Run is not set on all test codeunits and functions' 43 | Then 'Select on All is enabled' 44 | Then 'Deselect on All is disabled' 45 | } 46 | } 47 | 48 | $Features += 49 | Feature 'Enabling Actions Select/Deselect on All Filtered' { 50 | Scenario 6 'Filtered disabled test functions' { 51 | Given 'One disabled test codeunit with five disabled test functions' 52 | Given 'One disabled test codeunit with three disabled test functions' 53 | When 'Set filter on second test codeunit' 54 | Then 'Select on All is enabled' 55 | Then 'Deselect on All is disabled' 56 | } 57 | 58 | Scenario 7 'Filtered enabled test functions' { 59 | Given 'One enabled test codeunit with five enabled test functions' 60 | Given 'One enabled test codeunit with three enabled test functions' 61 | When 'Set filter on second test codeunit' 62 | Then 'Select on All is disabled' 63 | Then 'Deselect on All is enabled' 64 | } 65 | 66 | Scenario 8 'Filtered enabled and disabled test functions' { 67 | Given 'One enabled test codeunit with five enabled test functions' 68 | Given 'One disabled test codeunit with three disabled test functions' 69 | When 'Set filter on second test codeunit' 70 | Then 'Select on All is enabled' 71 | Then 'Deselect on All is disabled' 72 | } 73 | 74 | Scenario 9 'Enable Run on filtered successful test functions' { 75 | Given 'One disabled test codeunit with five disabled successful test functions' 76 | Given 'One disabled test codeunit with three disabled successful test functions' 77 | Given 'Filter on second test codeunit' 78 | When 'Perform Select on All' 79 | Then 'Run is set on second test codeunit and functions' 80 | Then 'Select on All is disabled' 81 | Then 'Deselect on All is enabled' 82 | } 83 | 84 | Scenario 10 'Disable Run on filtered successful test functions' { 85 | Given 'One enabled test codeunit with five enabled successful test functions' 86 | Given 'One enabled test codeunit with three enabled successful test functions' 87 | Given 'Filter on second test codeunit' 88 | When 'Perform Deselect on All' 89 | Then 'Run is not set on second test codeunit and functions' 90 | Then 'Select on All is enabled' 91 | Then 'Deselect on All is disabled' 92 | } 93 | } 94 | 95 | $Features | ` 96 | ConvertTo-ALTestCodeunit ` 97 | -CodeunitID 92051 ` 98 | -CodeunitName 'Enabl. Actns Select On All FLX' ` 99 | -InitializeFunction ` 100 | -GivenFunctionName "Create {0}" ` 101 | -ThenFunctionName "Verify {0}" ` 102 | # | Out-File '.\Test Codeunits\Cod92051.EnablingActionsSelectDeselectOnAllScenarios.al' -------------------------------------------------------------------------------- /CALTestTool/ATDD Scenarios/EnablingActionsSelectDeselectOnFailuresScenarios.ps1: -------------------------------------------------------------------------------- 1 | $Features = @() 2 | 3 | $Features += 4 | Feature 'Enabling Actions on Failures Unfiltered' { 5 | Scenario 1 'Unfiltered disabled failed test functions' { 6 | Given 'One disabled test codeunit with five disabled failed test functions' 7 | Given 'One disabled test codeunit with three disabled failed test functions' 8 | When 'Do nothing' 9 | Then 'Select on All is enabled' 10 | Then 'Deselect on All is disabled' 11 | Then 'Select on Failures is enabled' 12 | Then 'Select on Non Failures is disabled' 13 | } 14 | 15 | Scenario 2 'Unfiltered enabled failed test functions' { 16 | Given 'One enabled test codeunit with five enabled failed test functions' 17 | Given 'One enabled test codeunit with three enabled failed test functions' 18 | When 'Do nothing' 19 | Then 'Select on All is disabled' 20 | Then 'Deselect on All is enabled' 21 | Then 'Select on Failures is disabled' 22 | Then 'Select on Non Failures is disabled' 23 | } 24 | 25 | Scenario 3 'Unfiltered enabled and disabled failed test functions' { 26 | Given 'One enabled test codeunit with five enabled failed test functions' 27 | Given 'One disabled test codeunit with three disabled failed test functions' 28 | When 'Do nothing' 29 | Then 'Select on All is enabled' 30 | Then 'Deselect on All is enabled' 31 | Then 'Select on Failures is enabled' 32 | Then 'Select on Non Failures is disabled' 33 | } 34 | 35 | Scenario 4 'Select on All on unfiltered disabled failed test functions' { 36 | Given 'One disabled test codeunit with five disabled failed test functions' 37 | Given 'One disabled test codeunit with three disabled failed test functions' 38 | When 'Perform Select on All' 39 | Then 'Run is set on all test codeunits and functions' 40 | Then 'Select on All is disabled' 41 | Then 'Deselect on All is enabled' 42 | Then 'Select on Failures is disabled' 43 | Then 'Select on Non Failures is disabled' 44 | } 45 | 46 | Scenario 5 'Deselect on All on unfiltered enabled failed test functions' { 47 | Given 'One enabled test codeunit with five enabled failed test functions' 48 | Given 'One enabled test codeunit with three enabled failed test functions' 49 | When 'Perform Deselect on All' 50 | Then 'Run is not set on all test codeunits and functions' 51 | Then 'Select on All is enabled' 52 | Then 'Deselect on All is disabled' 53 | Then 'Select on Failures is enabled' 54 | Then 'Select on Non Failures is disabled' 55 | } 56 | Scenario 6 'Select on Failures on unfiltered disabled failed test functions' { 57 | Given 'One disabled test codeunit with five disabled failed test functions' 58 | Given 'One disabled test codeunit with three disabled failed test functions' 59 | When 'Perform Select on Failures' 60 | Then 'Run is set on all test codeunits and functions' 61 | Then 'Select on All is disabled' 62 | Then 'Deselect on All is enabled' 63 | Then 'Select on Failures is disabled' 64 | Then 'Select on Non Failures is disabled' 65 | } 66 | 67 | Scenario 7 'Select on Failures on unfiltered enabled and disabled failed test functions' { 68 | Given 'One enabled test codeunit with five enabled failed test functions' 69 | Given 'One disabled test codeunit with three disabled failed test functions' 70 | When 'Perform Select on Failures' 71 | Then 'Run is set on all test codeunits and functions' 72 | Then 'Select on All is disabled' 73 | Then 'Deselect on All is enabled' 74 | Then 'Select on Failures is disabled' 75 | Then 'Select on Non Failures is disabled' 76 | } 77 | } 78 | 79 | $Features += 80 | Feature 'Enabling Actions on Failures Filtered' { 81 | Scenario 8 'Filtered disabled failed test functions' { 82 | Given 'One disabled test codeunit with five disabled failed test functions' 83 | Given 'One disabled test codeunit with three disabled failed test functions' 84 | When 'Set filter on second test codeunit' 85 | Then 'Select on All is enabled' 86 | Then 'Deselect on All is disabled' 87 | Then 'Select on Failures is enabled' 88 | Then 'Select on Non Failures is disabled' 89 | } 90 | 91 | Scenario 9 'Filtered enabled failed test functions' { 92 | Given 'One enabled test codeunit with five enabled failed test functions' 93 | Given 'One enabled test codeunit with three enabled failed test functions' 94 | When 'Set filter on second test codeunit' 95 | Then 'Select on All is disabled' 96 | Then 'Deselect on All is enabled' 97 | Then 'Select on Failures is disabled' 98 | Then 'Select on Non Failures is disabled' 99 | } 100 | 101 | Scenario 10 'Filtered enabled and disabled failed test functions 1' { 102 | Given 'One enabled test codeunit with five enabled failed test functions' 103 | Given 'One disabled test codeunit with three disabled failed test functions' 104 | When 'Set filter on first test codeunit' 105 | Then 'Select on All is disabled' 106 | Then 'Deselect on All is enabled' 107 | Then 'Select on Failures is disabled' 108 | Then 'Select on Non Failures is disabled' 109 | } 110 | 111 | Scenario 11 'Filtered enabled and disabled failed test functions 2' { 112 | Given 'One enabled test codeunit with five enabled failed test functions' 113 | Given 'One disabled test codeunit with three disabled failed test functions' 114 | When 'Set filter on second test codeunit' 115 | Then 'Select on All is enabled' 116 | Then 'Deselect on All is disabled' 117 | Then 'Select on Failures is enabled' 118 | Then 'Select on Non Failures is disabled' 119 | } 120 | 121 | Scenario 12 'Select on All on filtered disabled failed test functions' { 122 | Given 'One disabled test codeunit with five disabled failed test functions' 123 | Given 'One disabled test codeunit with three disabled failed test functions' 124 | Given 'Filter on second test codeunit' 125 | When 'Perform Select on All' 126 | Then 'Run is set on all filtered test codeunits and functions' 127 | Then 'Select on All is disabled' 128 | Then 'Deselect on All is enabled' 129 | Then 'Select on Failures is disabled' 130 | Then 'Select on Non Failures is disabled' 131 | } 132 | 133 | Scenario 13 'Deselect on All on filtered enabled failed test functions' { 134 | Given 'One enabled test codeunit with five enabled failed test functions' 135 | Given 'One enabled test codeunit with three enabled failed test functions' 136 | Given 'Filter on second test codeunit' 137 | When 'Perform Deselect on All' 138 | Then 'Run is not set on all filtered test codeunits and functions' 139 | Then 'Select on All is enabled' 140 | Then 'Deselect on All is disabled' 141 | Then 'Select on Failures is enabled' 142 | Then 'Select on Non Failures is disabled' 143 | } 144 | Scenario 14 'Select on Failures on filtered disabled failed test functions' { 145 | Given 'One disabled test codeunit with five disabled failed test functions' 146 | Given 'One disabled test codeunit with three disabled failed test functions' 147 | Given 'Filter on second test codeunit' 148 | When 'Perform Select on Failures' 149 | Then 'Run is set on all filtered test codeunits and functions' 150 | Then 'Select on All is disabled' 151 | Then 'Deselect on All is enabled' 152 | Then 'Select on Failures is disabled' 153 | Then 'Select on Non Failures is disabled' 154 | } 155 | 156 | Scenario 15 'Select on Failures on filtered enabled and disabled failed test functions' { 157 | Given 'One enabled test codeunit with five enabled failed test functions' 158 | Given 'One disabled test codeunit with three disabled failed test functions' 159 | Given 'Filter on second test codeunit' 160 | When 'Perform Select on Failures' 161 | Then 'Run is set on all filtered test codeunits and functions' 162 | Then 'Select on All is disabled' 163 | Then 'Deselect on All is enabled' 164 | Then 'Select on Failures is disabled' 165 | Then 'Select on Non Failures is disabled' 166 | } 167 | } 168 | 169 | $Features | ` 170 | ConvertTo-ALTestCodeunit ` 171 | -CodeunitID 92052 ` 172 | -CodeunitName 'Enabl. Actions on Failures FLX' ` 173 | -InitializeFunction ` 174 | -GivenFunctionName "Create {0}" ` 175 | -ThenFunctionName "Verify {0}" ` 176 | | Out-File '.\Test Codeunits\Cod92052.EnablingActionsSelectDeselectOnFailuresScenarios.al' -------------------------------------------------------------------------------- /CALTestTool/ATDD Scenarios/EnablingActionsSelectDeselectOnNonFailuresScenarios.ps1: -------------------------------------------------------------------------------- 1 | $Features = @() 2 | 3 | $Features += 4 | Feature 'Enabling Actions on Non Failures Unfiltered' { 5 | Scenario 1 'Unfiltered disabled succesfull test functions' { 6 | Given 'One disabled test codeunit with five disabled succesfull test functions' 7 | Given 'One disabled test codeunit with three disabled succesfull test functions' 8 | When 'Do nothing' 9 | Then 'Select on All is enabled' 10 | Then 'Deselect on All is disabled' 11 | Then 'Select on Failures is disabled' 12 | Then 'Select on Non Failures is enabled' 13 | } 14 | 15 | Scenario 2 'Unfiltered enabled succesfull test functions' { 16 | Given 'One enabled test codeunit with five enabled succesfull test functions' 17 | Given 'One enabled test codeunit with three enabled succesfull test functions' 18 | When 'Do nothing' 19 | Then 'Select on All is disabled' 20 | Then 'Deselect on All is enabled' 21 | Then 'Select on Failures is disabled' 22 | Then 'Select on Non Failures is disabled' 23 | } 24 | 25 | Scenario 3 'Unfiltered enabled and disabled succesfull test functions' { 26 | Given 'One enabled test codeunit with five enabled succesfull test functions' 27 | Given 'One disabled test codeunit with three disabled succesfull test functions' 28 | When 'Do nothing' 29 | Then 'Select on All is enabled' 30 | Then 'Deselect on All is enabled' 31 | Then 'Select on Failures is disabled' 32 | Then 'Select on Non Failures is enabled' 33 | } 34 | 35 | Scenario 4 'Select on All on unfiltered disabled succesfull test functions' { 36 | Given 'One disabled test codeunit with five disabled succesfull test functions' 37 | Given 'One disabled test codeunit with three disabled succesfull test functions' 38 | When 'Perform Select on All' 39 | Then 'Run is set on all test codeunits and functions' 40 | Then 'Select on All is disabled' 41 | Then 'Deselect on All is enabled' 42 | Then 'Select on Failures is disabled' 43 | Then 'Select on Non Failures is disabled' 44 | } 45 | 46 | Scenario 5 'Deselect on All on unfiltered enabled succesfull test functions' { 47 | Given 'One enabled test codeunit with five enabled succesfull test functions' 48 | Given 'One enabled test codeunit with three enabled succesfull test functions' 49 | When 'Perform Deselect on All' 50 | Then 'Run is not set on all test codeunits and functions' 51 | Then 'Select on All is enabled' 52 | Then 'Deselect on All is disabled' 53 | Then 'Select on Failures is disabled' 54 | Then 'Select on Non Failures is enabled' 55 | } 56 | Scenario 6 'Select on Failures on unfiltered disabled succesfull test functions' { 57 | Given 'One disabled test codeunit with five disabled succesfull test functions' 58 | Given 'One disabled test codeunit with three disabled succesfull test functions' 59 | When 'Perform Select on Non Failures' 60 | Then 'Run is set on all test codeunits and functions' 61 | Then 'Select on All is disabled' 62 | Then 'Deselect on All is enabled' 63 | Then 'Select on Failures is disabled' 64 | Then 'Select on Non Failures is disabled' 65 | } 66 | 67 | Scenario 7 'Select on Failures on unfiltered enabled and disabled succesfull test functions' { 68 | Given 'One enabled test codeunit with five enabled succesfull test functions' 69 | Given 'One disabled test codeunit with three disabled succesfull test functions' 70 | When 'Perform Select on Non Failures' 71 | Then 'Run is set on all test codeunits and functions' 72 | Then 'Select on All is disabled' 73 | Then 'Deselect on All is enabled' 74 | Then 'Select on Failures is disabled' 75 | Then 'Select on Non Failures is disabled' 76 | } 77 | } 78 | 79 | $Features += 80 | Feature 'Enabling Actions on Non Failures Filtered' { 81 | Scenario 8 'Filtered disabled succesfull test functions' { 82 | Given 'One disabled test codeunit with five disabled succesfull test functions' 83 | Given 'One disabled test codeunit with three disabled succesfull test functions' 84 | When 'Set filter on second test codeunit' 85 | Then 'Select on All is enabled' 86 | Then 'Deselect on All is disabled' 87 | Then 'Select on Failures is disabled' 88 | Then 'Select on Non Failures is enabled' 89 | } 90 | 91 | Scenario 9 'Filtered enabled succesfull test functions' { 92 | Given 'One enabled test codeunit with five enabled succesfull test functions' 93 | Given 'One enabled test codeunit with three enabled succesfull test functions' 94 | When 'Set filter on second test codeunit' 95 | Then 'Select on All is disabled' 96 | Then 'Deselect on All is enabled' 97 | Then 'Select on Failures is disabled' 98 | Then 'Select on Non Failures is disabled' 99 | } 100 | 101 | Scenario 10 'Filtered enabled and disabled succesfull test functions 1' { 102 | Given 'One enabled test codeunit with five enabled succesfull test functions' 103 | Given 'One disabled test codeunit with three disabled succesfull test functions' 104 | When 'Set filter on first test codeunit' 105 | Then 'Select on All is disabled' 106 | Then 'Deselect on All is enabled' 107 | Then 'Select on Failures is disabled' 108 | Then 'Select on Non Failures is disabled' 109 | } 110 | 111 | Scenario 11 'Filtered enabled and disabled succesfull test functions 2' { 112 | Given 'One enabled test codeunit with five enabled succesfull test functions' 113 | Given 'One disabled test codeunit with three disabled succesfull test functions' 114 | When 'Set filter on second test codeunit' 115 | Then 'Select on All is enabled' 116 | Then 'Deselect on All is disabled' 117 | Then 'Select on Failures is disabled' 118 | Then 'Select on Non Failures is enabled' 119 | } 120 | 121 | Scenario 12 'Select on All on filtered disabled succesfull test functions' { 122 | Given 'One disabled test codeunit with five disabled succesfull test functions' 123 | Given 'One disabled test codeunit with three disabled succesfull test functions' 124 | Given 'Filter on second test codeunit' 125 | When 'Perform Select on All' 126 | Then 'Run is set on all filtered test codeunits and functions' 127 | Then 'Select on All is disabled' 128 | Then 'Deselect on All is enabled' 129 | Then 'Select on Failures is disabled' 130 | Then 'Select on Non Failures is disabled' 131 | } 132 | 133 | Scenario 13 'Deselect on All on filtered enabled succesfull test functions' { 134 | Given 'One enabled test codeunit with five enabled succesfull test functions' 135 | Given 'One enabled test codeunit with three enabled succesfull test functions' 136 | Given 'Filter on second test codeunit' 137 | When 'Perform Deselect on All' 138 | Then 'Run is not set on all filtered test codeunits and functions' 139 | Then 'Select on All is enabled' 140 | Then 'Deselect on All is disabled' 141 | Then 'Select on Failures is disabled' 142 | Then 'Select on Non Failures is enabled' 143 | } 144 | Scenario 14 'Select on Failures on filtered disabled succesfull test functions' { 145 | Given 'One disabled test codeunit with five disabled succesfull test functions' 146 | Given 'One disabled test codeunit with three disabled succesfull test functions' 147 | Given 'Filter on second test codeunit' 148 | When 'Perform Select on Non Failures' 149 | Then 'Run is set on all filtered test codeunits and functions' 150 | Then 'Select on All is disabled' 151 | Then 'Deselect on All is enabled' 152 | Then 'Select on Failures is disabled' 153 | Then 'Select on Non Failures is disabled' 154 | } 155 | 156 | Scenario 15 'Select on Failures on filtered enabled and disabled succesfull test functions' { 157 | Given 'One enabled test codeunit with five enabled succesfull test functions' 158 | Given 'One disabled test codeunit with three disabled succesfull test functions' 159 | Given 'Filter on second test codeunit' 160 | When 'Perform Select on Non Failures' 161 | Then 'Run is set on all filtered test codeunits and functions' 162 | Then 'Select on All is disabled' 163 | Then 'Deselect on All is enabled' 164 | Then 'Select on Failures is disabled' 165 | Then 'Select on Non Failures is disabled' 166 | } 167 | } 168 | 169 | $Features | ` 170 | ConvertTo-ALTestCodeunit ` 171 | -CodeunitID 92053 ` 172 | -CodeunitName 'Enabling Actions on Non Failures' ` 173 | -InitializeFunction ` 174 | -GivenFunctionName "Create {0}" ` 175 | -ThenFunctionName "Verify {0}" ` 176 | | Out-File '.\Test Codeunits\Cod92053.EnablingActionsSelectDeselectOnNonFailuresScenarios.al' -------------------------------------------------------------------------------- /CALTestTool/ATDD Scenarios/InstallModuleATDDTestScriptor.ps1: -------------------------------------------------------------------------------- 1 | Install-Module ATDD.TestScriptor -Force 2 | Import-Module ATDD.TestScriptor -Force -------------------------------------------------------------------------------- /CALTestTool/ATDD Scenarios/RunOnTestFunctionsScenarios.ps1: -------------------------------------------------------------------------------- 1 | $Features = @() 2 | 3 | $Features += 4 | Feature 'Run on Unfiltered Test Functions' { 5 | Scenario 1 'Enable Run on unfiltered test functions (all disabled)' { 6 | Given 'One disabled test codeunit with five disabled test functions' 7 | Given 'One disabled test codeunit with three disabled test functions' 8 | When 'Perform Select on All' 9 | Then 'Run is set on all test codeunits and functions' 10 | } 11 | 12 | Scenario 2 'Enable Run on unfiltered test functions (all enabled)' { 13 | Given 'One enabled test codeunit with five enabled test functions' 14 | Given 'One enabled test codeunit with three enabled test functions' 15 | When 'Perform Select on All' 16 | Then 'Run is set on all test codeunits and functions' 17 | } 18 | 19 | Scenario 3 'Disable Run on unfiltered test functions (all enabled)' { 20 | Given 'One enabled test codeunit with five enabled test functions' 21 | Given 'One enabled test codeunit with three enabled test functions' 22 | When 'Perform Deselect on All' 23 | Then 'Run is not set on all test codeunits and functions' 24 | } 25 | 26 | Scenario 4 'Disable Run on unfiltered test functions (all disabled)' { 27 | Given 'One disabled test codeunit with five disabled test functions' 28 | Given 'One disabled test codeunit with three disabled test functions' 29 | When 'Perform Deselect on All' 30 | Then 'Run is not set on all test codeunits and functions' 31 | } 32 | 33 | Scenario 5 'Enable Run only on unfiltered failed test functions (all enabled)' { 34 | Given 'One enabled test codeunit with enabled test functions five successful' 35 | Given 'One enabled test codeunit with enabled test functions two successful and two failed' 36 | Given 'One enabled test codeunit with enabled test functions two successful and two failed' 37 | When 'Perform Select on Failures' 38 | Then 'Run is set only on failed test codeunits and functions' 39 | } 40 | 41 | Scenario 6 'Enable Run only on unfiltered failed test functions (all disabled)' { 42 | Given 'One disabled test codeunit with disabled test functions five successful' 43 | Given 'One disabled test codeunit with disabled test functions two successful and two failed' 44 | Given 'One disabled test codeunit with disabled test functions two successful and two failed' 45 | When 'Perform Select on Failures' 46 | Then 'Run is set only on failed test codeunits and functions' 47 | } 48 | 49 | Scenario 7 'Enable Run only on unfiltered non failed test functions (all enabled)' { 50 | Given 'One enabled test codeunit with enabled test functions five successful' 51 | Given 'One enabled test codeunit with enabled test functions two successful and two failed' 52 | Given 'One enabled test codeunit with enabled test functions two successful and two failed' 53 | When 'Perform Select on Non Failures' 54 | Then 'Run is set only on non failed test codeunits and functions' 55 | } 56 | 57 | Scenario 8 'Enable Run only on unfiltered non failed test functions (all disabled)' { 58 | Given 'One disabled test codeunit with disabled test functions five successful' 59 | Given 'One disabled test codeunit with disabled test functions two successful and two failed' 60 | Given 'One disabled test codeunit with disabled test functions two successful and two failed' 61 | When 'Perform Select on Non Failures' 62 | Then 'Run is set only on non failed test codeunits and functions' 63 | } 64 | } 65 | 66 | $Features += 67 | Feature 'Run on Filtered Test Functions' { 68 | Scenario 9 'Enable Run on filtered test functions (all disabled)' { 69 | Given 'One disabled test codeunit with five disabled test functions' 70 | Given 'One disabled test codeunit with three disabled test functions' 71 | Given 'Filter on second test codeunit' 72 | When 'Perform Select on All' 73 | Then 'Run is set only on second test codeunit and its functions' 74 | } 75 | 76 | Scenario 10 'Enable Run on filtered test functions (all enabled)' { 77 | Given 'One enabled test codeunit with five enabled test functions' 78 | Given 'One enabled test codeunit with three enabled test functions' 79 | Given 'Filter on second test codeunit' 80 | When 'Perform Select on All' 81 | Then 'Run is set on all test codeunits and functions' 82 | } 83 | 84 | Scenario 11 'Disable Run on filtered test functions (all enabled)' { 85 | Given 'One enabled test codeunit with five enabled test functions' 86 | Given 'One enabled test codeunit with three enabled test functions' 87 | Given 'Filter on second test codeunit' 88 | When 'Perform Deselect on All' 89 | Then 'Run is not set on second test codeunit and its functions' 90 | } 91 | 92 | Scenario 12 'Disable Run on filtered test functions (all disabled)' { 93 | Given 'One disabled test codeunit with five disabled test functions' 94 | Given 'One disabled test codeunit with three disabled test functions' 95 | Given 'Filter on second test codeunit' 96 | When 'Perform Deselect on All' 97 | Then 'Run is not set on all test codeunits and functions' 98 | } 99 | 100 | Scenario 13 'Enable Run only on filtered failed test functions (all enabled)' { 101 | Given 'One enabled test codeunit with enabled test functions five successful' 102 | Given 'One enabled test codeunit with enabled test functions two successful and two failed' 103 | Given 'One enabled test codeunit with enabled test functions two successful and two failed' 104 | Given 'Filter on second test codeunit' 105 | When 'Perform Select on Failures' 106 | Then 'Run is not set only on non failed functions of second test codeunit' 107 | } 108 | 109 | Scenario 14 'Enable Run only on filtered failed test functions (all disabled)' { 110 | Given 'One disabled test codeunit with disabled test functions five successful' 111 | Given 'One disabled test codeunit with disabled test functions two successful and two failed' 112 | Given 'One disabled test codeunit with disabled test functions two successful and two failed' 113 | Given 'Filter on second test codeunit' 114 | When 'Perform Select on Failures' 115 | Then 'Run is set only on second test codeunit and its failed functions' 116 | } 117 | 118 | Scenario 15 'Enable Run only on filtered non failed test functions (all enabled)' { 119 | Given 'One enabled test codeunit with enabled test functions five successful' 120 | Given 'One enabled test codeunit with enabled test functions two successful and two failed' 121 | Given 'One enabled test codeunit with enabled test functions two successful and two failed' 122 | Given 'Filter on second test codeunit' 123 | When 'Perform Select on Non Failures' 124 | Then 'Run is not set only on failed functions of second test codeunit' 125 | } 126 | 127 | Scenario 16 'Enable Run only on filtered non failed test functions (all disabled)' { 128 | Given 'One disabled test codeunit with disabled test functions five successful' 129 | Given 'One disabled test codeunit with disabled test functions two successful and two failed' 130 | Given 'One disabled test codeunit with disabled test functions two successful and two failed' 131 | Given 'Filter on second test codeunit' 132 | When 'Perform Select on Non Failures' 133 | Then 'Run is set only on second test codeunit and its non failed functions' 134 | } 135 | } 136 | 137 | $Features | ` 138 | ConvertTo-ALTestCodeunit ` 139 | -CodeunitID 92050 ` 140 | -CodeunitName 'Run on Test Functions FLX' ` 141 | -InitializeFunction ` 142 | -GivenFunctionName "Create {0}" ` 143 | -ThenFunctionName "Verify {0}" ` 144 | # | Out-File '.\Test Codeunits\Cod92050.RunOnTestFunctions.al' -------------------------------------------------------------------------------- /CALTestTool/Images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluxxus-nl/Test-Tool-Extension/d2169d2ba3c2f048533636b8e8e38069ff69926b/CALTestTool/Images/logo.png -------------------------------------------------------------------------------- /CALTestTool/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "ac560b36-9043-4868-af24-b819d6885cf4", 3 | "name": "CAL TestTool Extension", 4 | "publisher": "fluxxus.nl", 5 | "brief": "CAL TestTool extension for book Automated Testing in Microsoft Dynamics 365 Business Central", 6 | "description": "CAL TestTool extension extends the standard CL Test Tool with a number of useful features", 7 | "version": "1.0.0.0", 8 | "privacyStatement": "", 9 | "EULA": "", 10 | "help": "https://github.com/fluxxus-nl/Test-Tool-Extension", 11 | "url": "https://github.com/fluxxus-nl/Test-Tool-Extension", 12 | "logo": "Images/logo.png", 13 | "platform": "15.0.0.0", 14 | "dependencies": [ 15 | { 16 | "id": "63ca2fa4-4f03-4f2b-a480-172fef340d3f", 17 | "publisher": "Microsoft", 18 | "name": "System Application", 19 | "version": "15.0.0.0" 20 | }, 21 | { 22 | "id": "437dbf0e-84ff-417a-965d-ed2bb9650972", 23 | "publisher": "Microsoft", 24 | "name": "Base Application", 25 | "version": "15.0.0.0" 26 | }, 27 | { 28 | "id": "5d86850b-0d76-4eca-bd7b-951ad998e997", 29 | "name": "Tests-TestLibraries", 30 | "publisher": "Microsoft", 31 | "version": "15.0.0.0" 32 | } 33 | ], 34 | "screenshots": [], 35 | "idRanges": [ 36 | { 37 | "from": 92000, 38 | "to": 92099 39 | } 40 | ], 41 | "showMyCode": true, 42 | "runtime": "5.0" 43 | } -------------------------------------------------------------------------------- /CALTestTool/src/Codeunits/Cod92000.SetActionsEnablingonTTFLX.al: -------------------------------------------------------------------------------- 1 | codeunit 92000 "Set Actions Enabling on TT FLX" 2 | { 3 | // (c) fluxxus.nl - https://github.com/fluxxus-nl/Test-Tool-Extension 4 | 5 | procedure SetActionsEnabling(var CALTestLine: Record "CAL Test Line"; var ActionEnablingArguments: Record "Action Enabling Arguments FLX") 6 | var 7 | CALTestLine2: Record "CAL Test Line"; 8 | begin 9 | CALTestLine2.CopyFilters(CALTestLine); 10 | 11 | with CALTestLine2 do begin 12 | SetRange(Run, false); 13 | ActionEnablingArguments.SelectAllEnabled := not IsEmpty(); 14 | 15 | SetRange(Run, true); 16 | ActionEnablingArguments.DeselectAllEnabled := not IsEmpty(); 17 | 18 | with ActionEnablingArguments do 19 | if not SelectAllEnabled and not DeselectAllEnabled then begin 20 | SelectFailuresEnabled := false; 21 | SelectNonFailuresEnabled := false; 22 | exit; 23 | end; 24 | 25 | SetRange(Run); 26 | SetRange(Result, Result::Failure); 27 | if IsEmpty() then begin 28 | ActionEnablingArguments.SelectFailuresEnabled := false; 29 | 30 | SetFilter(Result, '<>%1', Result::Failure); 31 | SetRange(Run, false); 32 | ActionEnablingArguments.SelectNonFailuresEnabled := not IsEmpty(); 33 | exit; 34 | end; 35 | 36 | ActionEnablingArguments.SelectFailuresEnabled := 37 | AreFailuresDeselected(CALTestLine2); 38 | 39 | ActionEnablingArguments.SelectNonFailuresEnabled := 40 | AreNonFailuresDeselected(CALTestLine2); 41 | end; 42 | end; 43 | 44 | local procedure AreNonFailuresDeselected(var CALTestLine: Record "CAL Test Line"): Boolean 45 | var 46 | CALTestLine2: Record "CAL Test Line"; 47 | begin 48 | CALTestLine2.CopyFilters(CALTestLine); 49 | with CALTestLine2 do begin 50 | SetRange("Line Type", "Line Type"::"Function"); 51 | SetFilter("Function", '<>%1', 'OnRun'); 52 | SetFilter(Result, '<>%1', Result::Failure); 53 | SetRange(Run, false); 54 | exit(not IsEmpty()); 55 | end; 56 | end; 57 | 58 | local procedure AreFailuresDeselected(var CALTestLine: Record "CAL Test Line"): Boolean 59 | var 60 | CALTestLine2: Record "CAL Test Line"; 61 | begin 62 | CALTestLine2.CopyFilters(CALTestLine); 63 | with CALTestLine2 do begin 64 | SetRange("Line Type", "Line Type"::"Function"); 65 | SetFilter("Function", '<>%1', 'OnRun'); 66 | SetRange(Result, Result::Failure); 67 | SetRange(Run, false); 68 | exit(not IsEmpty()); 69 | end; 70 | end; 71 | } -------------------------------------------------------------------------------- /CALTestTool/src/Codeunits/Cod92001.SetRunOnTestToolFLX.al: -------------------------------------------------------------------------------- 1 | codeunit 92001 "Set Run On Test Tool FLX" 2 | { 3 | // (c) fluxxus.nl - https://github.com/fluxxus-nl/Test-Tool-Extension 4 | 5 | procedure SetRun(var CALTestLine: Record "CAL Test Line"; RunType: Option All,"None",Failures,NonFailures) 6 | var 7 | CALTestLine2: Record "CAL Test Line"; 8 | begin 9 | CALTestLine2.CopyFilters(CALTestLine); 10 | 11 | if CALTestLine."Test Suite" <> '' then 12 | CALTestLine2.SetRange("Test Suite", CALTestLine."Test Suite"); 13 | 14 | with CALTestLine2 do 15 | case RunType of 16 | RunType::"None": 17 | SetRunOnNone(CALTestLine2); 18 | RunType::All: 19 | SetRunOnAll(CALTestLine2); 20 | RunType::NonFailures: 21 | SetRunOnNonFailures(CALTestLine2); 22 | RunType::Failures: 23 | SetRunOnFailures(CALTestLine2); 24 | end; 25 | end; 26 | 27 | local procedure SetRunOnNone(var CALTestLine: Record "CAL Test Line") 28 | begin 29 | CALTestLine.ModifyAll(Run, false); 30 | end; 31 | 32 | local procedure SetRunOnAll(var CALTestLine: Record "CAL Test Line") 33 | begin 34 | CALTestLine.ModifyAll(Run, true); 35 | end; 36 | 37 | local procedure SetRunOnNonFailures(var CALTestLine: Record "CAL Test Line") 38 | begin 39 | SetRunOnAll(CALTestLine); 40 | TurnOffRunOnFailingFunctions(CALTestLine); 41 | end; 42 | 43 | local procedure SetRunOnFailures(var CALTestLine: Record "CAL Test Line") 44 | begin 45 | SetRunOnNone(CALTestLine); 46 | TurnOnRunOnFailingFunctions(CALTestLine); 47 | end; 48 | 49 | local procedure TurnOffRunOnFailingFunctions(var CALTestLine: Record "CAL Test Line") 50 | begin 51 | with CALTestLine do begin 52 | SetRange("Line Type", "Line Type"::"Function"); 53 | SetRange(Result, Result::Failure); 54 | ModifyAll(Run, false); 55 | 56 | TurnOffRunOnOnRunOfFullyFailingCodeunit(CALTestLine); 57 | end; 58 | end; 59 | 60 | local procedure TurnOffRunOnOnRunOfFullyFailingCodeunit(var CALTestLine: Record "CAL Test Line") 61 | var 62 | CALTestLine2: Record "CAL Test Line"; 63 | begin 64 | with CALTestLine do begin 65 | SetRange("Line Type", "Line Type"::"Codeunit"); 66 | if FindSet() then 67 | repeat 68 | CALTestLine2.SetRange("Test Codeunit", "Test Codeunit"); 69 | CALTestLine2.SetRange("Line Type", "Line Type"::"Function"); 70 | CALTestLine2.SetFilter("Function", '<>%1', 'OnRun'); 71 | CALTestLine2.SetRange(Run, true); 72 | if CALTestLine2.IsEmpty() then begin 73 | CALTestLine2.SetRange("Line Type"); 74 | CALTestLine2.SetRange("Function"); 75 | CALTestLine2.SetRange(Run); 76 | CALTestLine2.ModifyAll(Run, false); 77 | end; 78 | until Next() = 0; 79 | end; 80 | end; 81 | 82 | local procedure TurnOnRunOnFailingFunctions(var CALTestLine: Record "CAL Test Line") 83 | var 84 | begin 85 | with CALTestLine do begin 86 | SetFilter("Line Type", '%1|%2', "Line Type"::"Codeunit", "Line Type"::"Function"); 87 | SetRange(Result, Result::Failure); 88 | ModifyAll(Run, true); 89 | 90 | TurnOnRunOnOnRunOfFullyFailingCodeunit(CALTestLine); 91 | end; 92 | end; 93 | 94 | local procedure TurnOnRunOnOnRunOfFullyFailingCodeunit(var CALTestLine: Record "CAL Test Line") 95 | var 96 | CALTestLine2: Record "CAL Test Line"; 97 | begin 98 | with CALTestLine do begin 99 | SetRange("Line Type", "Line Type"::"Codeunit"); 100 | if FindSet() then 101 | repeat 102 | CALTestLine2.SetRange("Test Codeunit", "Test Codeunit"); 103 | CALTestLine2.SetRange("Function", 'OnRun'); 104 | CALTestLine2.ModifyAll(Run, true); 105 | until Next() = 0; 106 | end; 107 | end; 108 | } -------------------------------------------------------------------------------- /CALTestTool/src/Page Extensions/Pag130401-Ext92000.CALTestToolPageExt.al: -------------------------------------------------------------------------------- 1 | pageextension 92000 "CAL Test Tool Page Ext" extends "CAL Test Tool" //130401 2 | { 3 | // (c) fluxxus.nl - https://github.com/fluxxus-nl/Test-Tool-Extension 4 | 5 | layout 6 | { 7 | modify(RunColumn) 8 | { 9 | trigger OnAfterValidate() 10 | begin 11 | Modify(); 12 | SetActionsEnabling(); 13 | end; 14 | } 15 | } 16 | 17 | actions 18 | { 19 | modify(DeleteLines) 20 | { 21 | trigger OnAfterAction() 22 | begin 23 | SetActionsEnabling(); 24 | end; 25 | } 26 | 27 | modify(GetTestCodeunits) 28 | { 29 | trigger OnAfterAction() 30 | begin 31 | SetActionsEnabling(); 32 | end; 33 | } 34 | 35 | modify(Run) 36 | { 37 | trigger OnAfterAction() 38 | begin 39 | SetActionsEnabling(); 40 | end; 41 | } 42 | 43 | modify(RunSelected) 44 | { 45 | ShortcutKey = 'Ctrl+F9'; 46 | 47 | trigger OnAfterAction() 48 | begin 49 | SetActionsEnabling(); 50 | end; 51 | } 52 | 53 | addafter("F&unctions") 54 | { 55 | group(Select) 56 | { 57 | Caption = '&Select Run'; 58 | 59 | action(SelectAll) 60 | { 61 | Caption = 'Select on All'; 62 | ToolTip = 'Select Run on all tests.'; 63 | ApplicationArea = All; 64 | Image = AllLines; 65 | Enabled = SelectAllEnabled; 66 | 67 | trigger OnAction() 68 | begin 69 | SetRunOnTests(0) // 0 = All 70 | end; 71 | } 72 | action(DeselectAll) 73 | { 74 | Caption = 'Deselect on All'; 75 | ToolTip = 'Deselect Run on all tests.'; 76 | ApplicationArea = All; 77 | Image = CancelAllLines; 78 | Enabled = DeselectAllEnabled; 79 | 80 | trigger OnAction() 81 | begin 82 | SetRunOnTests(1) // 1 = None 83 | end; 84 | } 85 | action(SelectFailures) 86 | { 87 | Caption = 'Select on Failures'; 88 | ToolTip = 'Select Run on all failing tests and deselect on all others.'; 89 | ApplicationArea = All; 90 | Image = EnableAllBreakpoints; 91 | Enabled = SelectFailuresEnabled; 92 | 93 | trigger OnAction() 94 | begin 95 | SetRunOnTests(2) // 2 = Failures 96 | end; 97 | } 98 | action(SelectNonFailures) 99 | { 100 | Caption = 'Select on Non Failures'; 101 | ToolTip = 'Deselect Run on all failing tests and select on all others.'; 102 | ApplicationArea = All; 103 | Image = DisableAllBreakpoints; 104 | Enabled = SelectNonFailuresEnabled; 105 | 106 | trigger OnAction() 107 | begin 108 | SetRunOnTests(3) // 3 = NonFailures 109 | end; 110 | } 111 | } 112 | } 113 | } 114 | var 115 | SelectAllEnabled: Boolean; 116 | DeselectAllEnabled: Boolean; 117 | SelectFailuresEnabled: Boolean; 118 | SelectNonFailuresEnabled: Boolean; 119 | 120 | trigger OnOpenPage() 121 | begin 122 | SetActionsEnabling(); 123 | end; 124 | 125 | local procedure SetRunOnTests(RunType: Option All,"Non",Failures,NonFailures) 126 | var 127 | SetRunOnTestTool: Codeunit "Set Run On Test Tool FLX"; 128 | begin 129 | SetRunOnTestTool.SetRun(Rec, RunType); 130 | SetActionsEnabling(); 131 | end; 132 | 133 | local procedure SetActionsEnabling() 134 | var 135 | ActionEnablingArguments: Record "Action Enabling Arguments FLX"; 136 | SetActionsEnablingForTestTool: Codeunit "Set Actions Enabling On TT FLX"; 137 | begin 138 | SetActionsEnablingForTestTool.SetActionsEnabling(Rec, ActionEnablingArguments); 139 | 140 | SelectAllEnabled := ActionEnablingArguments.SelectAllEnabled; 141 | DeselectAllEnabled := ActionEnablingArguments.DeselectAllEnabled; 142 | SelectFailuresEnabled := ActionEnablingArguments.SelectFailuresEnabled; 143 | SelectNonFailuresEnabled := ActionEnablingArguments.SelectNonFailuresEnabled; 144 | 145 | CurrPage.Update(false); 146 | end; 147 | } -------------------------------------------------------------------------------- /CALTestTool/src/Table Extensions/Tab130401-Ext92000.CALTestLineTableExt.al: -------------------------------------------------------------------------------- 1 | tableextension 92000 "CAL Test Line Table Ext" extends "CAL Test Line" //130401 2 | { 3 | // (c) fluxxus.nl - https://github.com/fluxxus-nl/Test-Tool-Extension 4 | 5 | procedure InitRecord(NewSuiteName: Code[10]; NewLineNo: Integer; NewLineType: Option "Group","Codeunit","Function"; NewCodeunitID: Integer; NewActive: Boolean) 6 | begin 7 | "Test Suite" := NewSuiteName; 8 | "Line No." := NewLineNo; 9 | "Test Codeunit" := NewCodeunitID; 10 | "Line Type" := NewLineType; 11 | Validate(Run, NewActive); 12 | end; 13 | } -------------------------------------------------------------------------------- /CALTestTool/src/Tables/Tab92000.ActionEnablingArgumentsFLX.al: -------------------------------------------------------------------------------- 1 | table 92000 "Action Enabling Arguments FLX" 2 | { 3 | // (c) fluxxus.nl - https://github.com/fluxxus-nl/Test-Tool-Extension 4 | 5 | fields 6 | { 7 | field(1; SelectAllEnabled; Boolean) { } 8 | field(2; DeselectAllEnabled; Boolean) { } 9 | field(3; SelectFailuresEnabled; Boolean) { } 10 | field(4; SelectNonFailuresEnabled; Boolean) { } 11 | } 12 | 13 | keys 14 | { 15 | key(PK; SelectAllEnabled) 16 | { 17 | Clustered = true; 18 | } 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /CALTestTool/test/Test Codeunits/Cod92050.RunonTestFunctionsFLX.al: -------------------------------------------------------------------------------- 1 | codeunit 92050 "Run on Test Functions FLX" 2 | { 3 | // (c) fluxxus.nl - https://github.com/fluxxus-nl/Test-Tool-Extension 4 | 5 | // [FEATURE] Run on Unfiltered Test Functions 6 | // [FEATURE] Run on Filtered Test Functions 7 | SubType = Test; 8 | 9 | [Test] 10 | [TransactionModel(TransactionModel::AutoRollback)] 11 | procedure EnableRunOnUnfilteredTestFunctionsAllDisabled() 12 | // [FEATURE] Run on Unfiltered Test Functions 13 | begin 14 | // [SCENARIO #0001] Enable Run on unfiltered test functions (all disabled) 15 | Initialize(); 16 | 17 | // [GIVEN] One disabled test codeunit with five disabled test functions 18 | CreateOneDisabledTestCodeunitWithFiveDisabledTestFunctions(); 19 | // [GIVEN] One disabled test codeunit with three disabled test functions 20 | CreateOneDisabledTestCodeunitWithThreeDisabledTestFunctions(); 21 | 22 | // [WHEN] Perform Select on All 23 | PerformSelectOnAll(NoFilterOnCodeunit()); 24 | 25 | // [THEN] Run is set on all test codeunits and functions 26 | VerifyRunIsSetOnAllTestCodeunitsAndFunctions(NoFilterOnCodeunit()); 27 | end; 28 | 29 | [Test] 30 | [TransactionModel(TransactionModel::AutoRollback)] 31 | procedure EnableRunOnUnfilteredTestFunctionsAllEnabled() 32 | // [FEATURE] Run on Unfiltered Test Functions 33 | begin 34 | // [SCENARIO #0002] Enable Run on unfiltered test functions (all enabled) 35 | Initialize(); 36 | 37 | // [GIVEN] One enabled test codeunit with five enabled test functions 38 | CreateOneEnabledTestCodeunitWithFiveEnabledTestFunctions(); 39 | // [GIVEN] One enabled test codeunit with three enabled test functions 40 | CreateOneEnabledTestCodeunitWithThreeEnabledTestFunctions(); 41 | 42 | // [WHEN] Perform Select on All 43 | PerformSelectOnAll(NoFilterOnCodeunit()); 44 | 45 | // [THEN] Run is set on all test codeunits and functions 46 | VerifyRunIsSetOnAllTestCodeunitsAndFunctions(NoFilterOnCodeunit()); 47 | end; 48 | 49 | [Test] 50 | [TransactionModel(TransactionModel::AutoRollback)] 51 | procedure DisableRunOnUnfilteredTestFunctionsAllEnabled() 52 | // [FEATURE] Run on Unfiltered Test Functions 53 | begin 54 | // [SCENARIO #0003] Disable Run on unfiltered test functions (all enabled) 55 | Initialize(); 56 | 57 | // [GIVEN] One enabled test codeunit with five enabled test functions 58 | CreateOneEnabledTestCodeunitWithFiveEnabledTestFunctions(); 59 | // [GIVEN] One enabled test codeunit with three enabled test functions 60 | CreateOneEnabledTestCodeunitWithThreeEnabledTestFunctions(); 61 | 62 | // [WHEN] Perform Deselect on All 63 | PerformDeselectOnAll(NoFilterOnCodeunit()); 64 | 65 | // [THEN] Run is not set on all test codeunits and functions 66 | VerifyRunIsNotSetOnAllTestCodeunitsAndFunctions(NoFilterOnCodeunit()); 67 | end; 68 | 69 | [Test] 70 | [TransactionModel(TransactionModel::AutoRollback)] 71 | procedure DisableRunOnUnfilteredTestFunctionsAllDisabled() 72 | // [FEATURE] Run on Unfiltered Test Functions 73 | begin 74 | // [SCENARIO #0004] Disable Run on unfiltered test functions (all disabled) 75 | Initialize(); 76 | 77 | // [GIVEN] One disabled test codeunit with five disabled test functions 78 | CreateOneDisabledTestCodeunitWithFiveDisabledTestFunctions(); 79 | // [GIVEN] One disabled test codeunit with three disabled test functions 80 | CreateOneDisabledTestCodeunitWithThreeDisabledTestFunctions(); 81 | 82 | // [WHEN] Perform Deselect on All 83 | PerformDeselectOnAll(NoFilterOnCodeunit()); 84 | 85 | // [THEN] Run is not set on all test codeunits and functions 86 | VerifyRunIsNotSetOnAllTestCodeunitsAndFunctions(NoFilterOnCodeunit()); 87 | end; 88 | 89 | [Test] 90 | [TransactionModel(TransactionModel::AutoRollback)] 91 | procedure EnableRunOnlyOnUnfilteredFailedTestFunctionsAllEnabled() 92 | // [FEATURE] Run on Unfiltered Test Functions 93 | begin 94 | // [SCENARIO #0005] Enable Run only on unfiltered failed test functions (all enabled) 95 | Initialize(); 96 | 97 | // [GIVEN] One enabled test codeunit with enabled test functions five successful 98 | CreateOneEnabledTestCodeunitWithEnabledTestFunctionsFiveSuccessful(); 99 | // [GIVEN] One enabled test codeunit with enabled test functions one successful and two failed 100 | CreateOneEnabledTestCodeunitWithEnabledTestFunctionsTwoSuccessfulAndTwoFailed(); 101 | // [GIVEN] One enabled test codeunit with enabled test functions two successful and one failed 102 | CreateOneEnabledTestCodeunitWithEnabledTestFunctionsTwoSuccessfulAndTwoFailed(); 103 | 104 | // [WHEN] Perform Select on Failures 105 | PerformSelectOnFailures(NoFilterOnCodeunit()); 106 | 107 | // [THEN] Run is set only on failed test codeunits and functions 108 | VerifyRunIsSetOnlyOnFailedTestCodeunitsAndFunctions(); 109 | end; 110 | 111 | [Test] 112 | [TransactionModel(TransactionModel::AutoRollback)] 113 | procedure EnableRunOnlyOnUnfilteredFailedTestFunctionsAllDisabled() 114 | // [FEATURE] Run on Unfiltered Test Functions 115 | begin 116 | // [SCENARIO #0006] Enable Run only on unfiltered failed test functions (all disabled) 117 | Initialize(); 118 | 119 | // [GIVEN] One disabled test codeunit with disabled test functions five successful 120 | CreateOneDisabledTestCodeunitWithDisabledTestFunctionsFiveSuccessful(); 121 | // [GIVEN] One disabled test codeunit with disabled test functions one successful and two failed 122 | CreateOneDisabledTestCodeunitWithDisabledTestFunctionsTwoSuccessfulAndTwoFailed(); 123 | // [GIVEN] One disabled test codeunit with disabled test functions two successful and one failed 124 | CreateOneDisabledTestCodeunitWithDisabledTestFunctionsTwoSuccessfulAndTwoFailed(); 125 | 126 | // [WHEN] Perform Select on Failures 127 | PerformSelectOnFailures(NoFilterOnCodeunit()); 128 | 129 | // [THEN] Run is set only on failed test codeunits and functions 130 | VerifyRunIsSetOnlyOnFailedTestCodeunitsAndFunctions(); 131 | end; 132 | 133 | [Test] 134 | [TransactionModel(TransactionModel::AutoRollback)] 135 | procedure EnableRunOnlyOnUnfilteredNonFailedTestFunctionsAllEnabled() 136 | // [FEATURE] Run on Unfiltered Test Functions 137 | begin 138 | // [SCENARIO #0007] Enable Run only on unfiltered non failed test functions (all enabled) 139 | Initialize(); 140 | 141 | // [GIVEN] One enabled test codeunit with enabled test functions five successful 142 | CreateOneEnabledTestCodeunitWithEnabledTestFunctionsFiveSuccessful(); 143 | // [GIVEN] One enabled test codeunit with enabled test functions one successful and two failed 144 | CreateOneEnabledTestCodeunitWithEnabledTestFunctionsTwoSuccessfulAndTwoFailed(); 145 | // [GIVEN] One enabled test codeunit with enabled test functions two successful and one failed 146 | CreateOneEnabledTestCodeunitWithEnabledTestFunctionsTwoSuccessfulAndTwoFailed(); 147 | 148 | // [WHEN] Perform Select on Non Failures 149 | PerformSelectOnNonFailures(NoFilterOnCodeunit()); 150 | 151 | // [THEN] Run is set only on non failed test codeunits and functions 152 | VerifyRunIsSetOnlyOnNonFailedTestCodeunitsAndFunctions(); 153 | end; 154 | 155 | [Test] 156 | [TransactionModel(TransactionModel::AutoRollback)] 157 | procedure EnableRunOnlyOnUnfilteredNonFailedTestFunctionsAllDisabled() 158 | // [FEATURE] Run on Unfiltered Test Functions 159 | begin 160 | // [SCENARIO #0008] Enable Run only on unfiltered non failed test functions (all disabled) 161 | Initialize(); 162 | 163 | // [GIVEN] One disabled test codeunit with disabled test functions five successful 164 | CreateOneDisabledTestCodeunitWithDisabledTestFunctionsFiveSuccessful(); 165 | // [GIVEN] One disabled test codeunit with disabled test functions one successful and two failed 166 | CreateOneDisabledTestCodeunitWithDisabledTestFunctionsTwoSuccessfulAndTwoFailed(); 167 | // [GIVEN] One disabled test codeunit with disabled test functions two successful and one failed 168 | CreateOneDisabledTestCodeunitWithDisabledTestFunctionsTwoSuccessfulAndTwoFailed(); 169 | 170 | // [WHEN] Perform Select on Non Failures 171 | PerformSelectOnNonFailures(NoFilterOnCodeunit()); 172 | 173 | // [THEN] Run is set only on non failed test codeunits and functions 174 | VerifyRunIsSetOnlyOnNonFailedTestCodeunitsAndFunctions(); 175 | end; 176 | 177 | [Test] 178 | [TransactionModel(TransactionModel::AutoRollback)] 179 | procedure EnableRunOnFilteredTestFunctionsAllDisabled() 180 | // [FEATURE] Run on Filtered Test Functions 181 | var 182 | SecondCodeunitID: Integer; 183 | begin 184 | // [SCENARIO #0009] Enable Run on filtered test functions (all disabled) 185 | Initialize(); 186 | 187 | // [GIVEN] One disabled test codeunit with five disabled test functions 188 | CreateOneDisabledTestCodeunitWithFiveDisabledTestFunctions(); 189 | // [GIVEN] One disabled test codeunit with three disabled test functions 190 | SecondCodeunitID := CreateOneDisabledTestCodeunitWithThreeDisabledTestFunctions(); 191 | // [GIVEN] Filter on second test codeunit 192 | // handled by Perform... task in [WHEN] part based on SecondCodeunitID 193 | 194 | // [WHEN] Perform Select on All 195 | PerformSelectOnAll(SetFilterOn(SecondCodeunitID)); 196 | 197 | // [THEN] Run is set only on second test codeunit and its functions 198 | VerifyRunIsSetOnlyOnSecondTestCodeunitAndItsFunctions(SecondCodeunitID); 199 | end; 200 | 201 | [Test] 202 | [TransactionModel(TransactionModel::AutoRollback)] 203 | procedure EnableRunOnFilteredTestFunctionsAllEnabled() 204 | // [FEATURE] Run on Filtered Test Functions 205 | var 206 | SecondCodeunitID: Integer; 207 | begin 208 | // [SCENARIO #0010] Enable Run on filtered test functions (all enabled) 209 | Initialize(); 210 | // [GIVEN] One enabled test codeunit with five enabled test functions 211 | CreateOneEnabledTestCodeunitWithFiveEnabledTestFunctions(); 212 | // [GIVEN] One enabled test codeunit with three enabled test functions 213 | SecondCodeunitID := CreateOneEnabledTestCodeunitWithThreeEnabledTestFunctions(); 214 | // [GIVEN] Filter on second test codeunit 215 | // handled by Perform... task in [WHEN] part based on SecondCodeunitID 216 | 217 | // [WHEN] Perform Select on All 218 | PerformSelectOnAll(SetFilterOn(SecondCodeunitID)); 219 | 220 | // [THEN] Run is set on all test codeunits and functions 221 | VerifyRunIsSetOnAllTestCodeunitsAndFunctions(SetFilterOn(SecondCodeunitID)); 222 | end; 223 | 224 | [Test] 225 | [TransactionModel(TransactionModel::AutoRollback)] 226 | procedure DisableRunOnFilteredTestFunctionsAllEnabled() 227 | // [FEATURE] Run on Filtered Test Functions 228 | var 229 | SecondCodeunitID: Integer; 230 | begin 231 | // [SCENARIO #0011] Disable Run on filtered test functions (all enabled) 232 | Initialize(); 233 | 234 | // [GIVEN] One enabled test codeunit with five enabled test functions 235 | CreateOneEnabledTestCodeunitWithFiveEnabledTestFunctions(); 236 | // [GIVEN] One enabled test codeunit with three enabled test functions 237 | SecondCodeunitID := CreateOneEnabledTestCodeunitWithThreeEnabledTestFunctions(); 238 | // [GIVEN] Filter on second test codeunit 239 | // handled by Perform... task in [WHEN] part based on SecondCodeunitID 240 | 241 | // [WHEN] Perform Deselect on All 242 | PerformDeselectOnAll(SetFilterOn(SecondCodeunitID)); 243 | 244 | // [THEN] Run is not set on second test codeunit and its functions 245 | VerifyRunIsNotSetOnSecondTestCodeunitAndItsFunctions(SecondCodeunitID); 246 | end; 247 | 248 | [Test] 249 | [TransactionModel(TransactionModel::AutoRollback)] 250 | procedure DisableRunOnFilteredTestFunctionsAllDisabled() 251 | // [FEATURE] Run on Filtered Test Functions 252 | var 253 | SecondCodeunitID: Integer; 254 | begin 255 | // [SCENARIO #0012] Disable Run on filtered test functions (all disabled) 256 | Initialize(); 257 | 258 | // [GIVEN] One disabled test codeunit with five disabled test functions 259 | CreateOneDisabledTestCodeunitWithFiveDisabledTestFunctions(); 260 | // [GIVEN] One disabled test codeunit with three disabled test functions 261 | SecondCodeunitID := CreateOneDisabledTestCodeunitWithThreeDisabledTestFunctions(); 262 | // [GIVEN] Filter on second test codeunit 263 | // handled by Perform... task in [WHEN] part based on SecondCodeunitID 264 | 265 | // [WHEN] Perform Deselect on All 266 | PerformDeselectOnAll(SetFilterOn(SecondCodeunitID)); 267 | 268 | // [THEN] Run is not set on all test codeunits and functions 269 | VerifyRunIsNotSetOnAllTestCodeunitsAndFunctions(SetFilterOn(SecondCodeunitID)); 270 | end; 271 | 272 | [Test] 273 | [TransactionModel(TransactionModel::AutoRollback)] 274 | procedure EnableRunOnlyOnFilteredFailedTestFunctionsAllEnabled() 275 | // [FEATURE] Run on Filtered Test Functions 276 | var 277 | SecondCodeunitID: Integer; 278 | begin 279 | // [SCENARIO #0013] Enable Run only on filtered failed test functions (all enabled) 280 | Initialize(); 281 | 282 | // [GIVEN] One enabled test codeunit with enabled test functions five successful 283 | CreateOneEnabledTestCodeunitWithEnabledTestFunctionsFiveSuccessful(); 284 | // [GIVEN] One enabled test codeunit with enabled test functions two successful and two failed 285 | SecondCodeunitID := CreateOneEnabledTestCodeunitWithEnabledTestFunctionsTwoSuccessfulAndTwoFailed(); 286 | // [GIVEN] One enabled test codeunit with enabled test functions two successful and two failed 287 | CreateOneEnabledTestCodeunitWithEnabledTestFunctionsTwoSuccessfulAndTwoFailed(); 288 | // [GIVEN] Filter on second test codeunit 289 | // handled by Perform... task in [WHEN] part based on SecondCodeunitID 290 | 291 | // [WHEN] Perform Select on Failures 292 | PerformSelectOnFailures(SetFilterOn(SecondCodeunitID)); 293 | 294 | // [THEN] Run is not set only on non failed functions of second test codeunit 295 | VerifyRunIsNotSetOnlyOnNonFailedFunctionsOfSecondTestCodeunit(SecondCodeunitID); 296 | end; 297 | 298 | [Test] 299 | [TransactionModel(TransactionModel::AutoRollback)] 300 | procedure EnableRunOnlyOnFilteredFailedTestFunctionsAllDisabled() 301 | // [FEATURE] Run on Filtered Test Functions 302 | var 303 | SecondCodeunitID: Integer; 304 | begin 305 | // [SCENARIO #0014] Enable Run only on filtered failed test functions (all disabled) 306 | Initialize(); 307 | 308 | // [GIVEN] One disabled test codeunit with disabled test functions five successful 309 | CreateOneDisabledTestCodeunitWithDisabledTestFunctionsFiveSuccessful(); 310 | // [GIVEN] One disabled test codeunit with disabled test functions two successful and two failed 311 | SecondCodeunitID := CreateOneDisabledTestCodeunitWithDisabledTestFunctionsTwoSuccessfulAndTwoFailed(); 312 | // [GIVEN] One disabled test codeunit with disabled test functions two successful and two failed 313 | CreateOneDisabledTestCodeunitWithDisabledTestFunctionsTwoSuccessfulAndTwoFailed(); 314 | // [GIVEN] Filter on second test codeunit 315 | // handled by Perform... task in [WHEN] part based on SecondCodeunitID 316 | 317 | // [WHEN] Perform Select on Failures 318 | PerformSelectOnFailures(SetFilterOn(SecondCodeunitID)); 319 | 320 | // [THEN] Run is set only on second test codeunit and its failed functions 321 | VerifyRunIsSetOnlyOnSecondTestCodeunitAndItsFailedFunctions(SecondCodeunitID); 322 | end; 323 | 324 | [Test] 325 | [TransactionModel(TransactionModel::AutoRollback)] 326 | procedure EnableRunOnlyOnFilteredNonFailedTestFunctionsAllEnabled() 327 | // [FEATURE] Run on Filtered Test Functions 328 | var 329 | SecondCodeunitID: Integer; 330 | begin 331 | // [SCENARIO #0015] Enable Run only on filtered non failed test functions (all enabled) 332 | Initialize(); 333 | 334 | // [GIVEN] One enabled test codeunit with enabled test functions five successful 335 | CreateOneEnabledTestCodeunitWithEnabledTestFunctionsFiveSuccessful(); 336 | // [GIVEN] One enabled test codeunit with enabled test functions two successful and two failed 337 | SecondCodeunitID := CreateOneEnabledTestCodeunitWithEnabledTestFunctionsTwoSuccessfulAndTwoFailed(); 338 | // [GIVEN] One enabled test codeunit with enabled test functions two successful and two failed 339 | CreateOneEnabledTestCodeunitWithEnabledTestFunctionsTwoSuccessfulAndTwoFailed(); 340 | // [GIVEN] Filter on second test codeunit 341 | // handled by Perform... task in [WHEN] part based on SecondCodeunitID 342 | 343 | // [WHEN] Perform Select on Non Failures 344 | PerformSelectOnNonFailures(SetFilterOn(SecondCodeunitID)); 345 | 346 | // [THEN] Run is not set only on failed functions of second test codeunit 347 | VerifyRunIsNotSetOnlyOnFailedFunctionsOfSecondTestCodeunit(SecondCodeunitID); 348 | end; 349 | 350 | [Test] 351 | [TransactionModel(TransactionModel::AutoRollback)] 352 | procedure EnableRunOnlyOnFilteredNonFailedTestFunctionsAllDisabled() 353 | // [FEATURE] Run on Filtered Test Functions 354 | var 355 | SecondCodeunitID: Integer; 356 | begin 357 | // [SCENARIO #0016] Enable Run only on filtered non failed test functions (all disabled) 358 | Initialize(); 359 | 360 | // [GIVEN] One disabled test codeunit with disabled test functions five successful 361 | CreateOneDisabledTestCodeunitWithDisabledTestFunctionsFiveSuccessful(); 362 | // [GIVEN] One disabled test codeunit with disabled test functions two successful and two failed 363 | SecondCodeunitID := CreateOneDisabledTestCodeunitWithDisabledTestFunctionsTwoSuccessfulAndTwoFailed(); 364 | // [GIVEN] One disabled test codeunit with disabled test functions two successful and two failed 365 | CreateOneDisabledTestCodeunitWithDisabledTestFunctionsTwoSuccessfulAndTwoFailed(); 366 | // [GIVEN] Filter on second test codeunit 367 | // handled by Perform... task in [WHEN] part based on SecondCodeunitID 368 | 369 | // [WHEN] Perform Select on Non Failures 370 | PerformSelectOnNonFailures(SetFilterOn(SecondCodeunitID)); 371 | 372 | // [THEN] Run is set only on second test codeunit and its non failed functions 373 | VerifyRunIsSetOnlyOnSecondTestCodeunitAndItsNonFailedFunctions(SecondCodeunitID); 374 | end; 375 | 376 | var 377 | Assert: Codeunit Assert; 378 | LibraryTestFunctions: Codeunit "Lib. - Test Function Lns FLX"; 379 | LibraryVerifyActions: Codeunit "Library - Verify Actions FLX"; 380 | LibraryPerformSelect: Codeunit "Library - Perform Select FLX"; 381 | 382 | TestSuiteName: Code[10]; 383 | 384 | local procedure Initialize() 385 | var 386 | LibraryTestInitialize: Codeunit "Library - Test Initialize"; 387 | LibraryUtility: Codeunit "Library - Utility"; 388 | begin 389 | LibraryTestInitialize.OnTestInitialize(Codeunit::"Run on Test Functions FLX"); 390 | 391 | TestSuiteName := LibraryUtility.GenerateGUID(); 392 | LibraryTestFunctions.CreateTestSuite(TestSuiteName); 393 | LibraryTestFunctions.SetCodeunitBaseID(-92000); 394 | end; 395 | 396 | local procedure CreateOneDisabledTestCodeunitWithDisabledTestFunctionsFiveSuccessful(): Integer 397 | begin 398 | with LibraryTestFunctions do begin 399 | CreateTestCodeunit(TestSuiteName, GetNextCodeunitID(), IsDisabled()); 400 | CreateTestFunctions(TestSuiteName, GetCurrentCodeunitID(), IsDisabled(), 5, 0); 401 | exit(GetCurrentCodeunitID()) 402 | end; 403 | end; 404 | 405 | local procedure CreateOneDisabledTestCodeunitWithDisabledTestFunctionsTwoSuccessfulAndTwoFailed(): Integer 406 | begin 407 | with LibraryTestFunctions do begin 408 | CreateTestCodeunit(TestSuiteName, GetNextCodeunitID(), IsDisabled()); 409 | CreateTestFunctions(TestSuiteName, GetCurrentCodeunitID(), IsDisabled(), 2, 2); 410 | exit(GetCurrentCodeunitID()) 411 | end; 412 | end; 413 | 414 | local procedure CreateOneDisabledTestCodeunitWithFiveDisabledTestFunctions(): Integer 415 | begin 416 | with LibraryTestFunctions do begin 417 | CreateTestCodeunit(TestSuiteName, GetNextCodeunitID(), IsDisabled()); 418 | CreateTestFunctions(TestSuiteName, GetCurrentCodeunitID(), IsDisabled(), 5, 0); 419 | exit(GetCurrentCodeunitID()) 420 | end; 421 | end; 422 | 423 | local procedure CreateOneDisabledTestCodeunitWithThreeDisabledTestFunctions(): Integer 424 | begin 425 | with LibraryTestFunctions do begin 426 | CreateTestCodeunit(TestSuiteName, GetNextCodeunitID(), IsDisabled()); 427 | CreateTestFunctions(TestSuiteName, GetCurrentCodeunitID(), IsDisabled(), 3, 0); 428 | exit(GetCurrentCodeunitID()) 429 | end; 430 | end; 431 | 432 | local procedure CreateOneEnabledTestCodeunitWithEnabledTestFunctionsFiveSuccessful(): Integer 433 | begin 434 | with LibraryTestFunctions do begin 435 | CreateTestCodeunit(TestSuiteName, GetNextCodeunitID(), IsEnabled()); 436 | CreateTestFunctions(TestSuiteName, GetCurrentCodeunitID(), IsEnabled(), 5, 0); 437 | exit(GetCurrentCodeunitID()) 438 | end; 439 | end; 440 | 441 | local procedure CreateOneEnabledTestCodeunitWithEnabledTestFunctionsTwoSuccessfulAndTwoFailed(): Integer 442 | begin 443 | with LibraryTestFunctions do begin 444 | CreateTestCodeunit(TestSuiteName, GetNextCodeunitID(), IsEnabled()); 445 | CreateTestFunctions(TestSuiteName, GetCurrentCodeunitID(), IsEnabled(), 2, 2); 446 | exit(GetCurrentCodeunitID()) 447 | end; 448 | end; 449 | 450 | local procedure CreateOneEnabledTestCodeunitWithFiveEnabledTestFunctions(): Integer 451 | begin 452 | with LibraryTestFunctions do begin 453 | CreateTestCodeunit(TestSuiteName, GetNextCodeunitID(), IsEnabled()); 454 | CreateTestFunctions(TestSuiteName, GetCurrentCodeunitID(), IsEnabled(), 5, 0); 455 | exit(GetCurrentCodeunitID()) 456 | end; 457 | end; 458 | 459 | local procedure CreateOneEnabledTestCodeunitWithThreeEnabledTestFunctions(): Integer 460 | begin 461 | with LibraryTestFunctions do begin 462 | CreateTestCodeunit(TestSuiteName, GetNextCodeunitID(), IsEnabled()); 463 | CreateTestFunctions(TestSuiteName, GetCurrentCodeunitID(), IsEnabled(), 3, 0); 464 | exit(GetCurrentCodeunitID()); 465 | end; 466 | end; 467 | 468 | local procedure PerformSelectOnAll(CodeunitID: Integer) 469 | begin 470 | LibraryPerformSelect.PerformSelectOnAll(TestSuiteName, CodeunitID) 471 | end; 472 | 473 | local procedure PerformDeselectOnAll(CodeunitID: Integer) 474 | begin 475 | LibraryPerformSelect.PerformDeselectOnAll(TestSuiteName, CodeunitID) 476 | end; 477 | 478 | local procedure PerformSelectOnFailures(CodeunitID: Integer) 479 | begin 480 | LibraryPerformSelect.PerformSelectOnFailures(TestSuiteName, CodeunitID) 481 | end; 482 | 483 | local procedure PerformSelectOnNonFailures(CodeunitID: Integer) 484 | begin 485 | LibraryPerformSelect.PerformSelectOnNonFailures(TestSuiteName, CodeunitID) 486 | end; 487 | 488 | local procedure NoFilterOnCodeunit(): Integer 489 | begin 490 | exit(0) 491 | end; 492 | 493 | local procedure SetFilterOn(CodeunitID: Integer): Integer 494 | begin 495 | exit(CodeunitID) 496 | end; 497 | 498 | local procedure IsEnabled(): Boolean 499 | begin 500 | exit(true) 501 | end; 502 | 503 | local procedure IsDisabled(): Boolean 504 | begin 505 | exit(false) 506 | end; 507 | 508 | local procedure VerifyRunIsSetOnAllTestCodeunitsAndFunctions(CodeunitID: Integer) 509 | begin 510 | LibraryVerifyActions.VerifyRunOnAll(TestSuiteName, CodeunitID, IsEnabled()) 511 | end; 512 | 513 | local procedure VerifyRunIsNotSetOnAllTestCodeunitsAndFunctions(CodeunitID: Integer) 514 | begin 515 | LibraryVerifyActions.VerifyRunOnAll(TestSuiteName, CodeunitID, IsDisabled()) 516 | end; 517 | 518 | local procedure VerifyRunIsSetOnlyOnFailedTestCodeunitsAndFunctions() 519 | var 520 | CALTestLine: Record "CAL Test Line"; 521 | NoOfEnabledLinesInTestSuite: Integer; 522 | NoOfFailedLinesInTestSuite: Integer; 523 | begin 524 | with CALTestLine do begin 525 | SetRange("Test Suite", TestSuiteName); 526 | SetRange(Run, true); 527 | NoOfEnabledLinesInTestSuite := Count(); 528 | SetRange(Run); 529 | SetRange(Result, Result::Failure); 530 | NoOfFailedLinesInTestSuite := Count(); 531 | Assert.AreEqual(NoOfFailedLinesInTestSuite, NoOfEnabledLinesInTestSuite, 'NoOfFailedLines <> NoOfEnabledLines'); 532 | end; 533 | end; 534 | 535 | local procedure VerifyRunIsSetOnlyOnNonFailedTestCodeunitsAndFunctions() 536 | var 537 | CALTestLine: Record "CAL Test Line"; 538 | NoOfEnabledLinesInTestSuite: Integer; 539 | NoOfNonFailedLinesInTestSuite: Integer; 540 | begin 541 | with CALTestLine do begin 542 | SetRange("Test Suite", TestSuiteName); 543 | SetRange(Run, true); 544 | NoOfEnabledLinesInTestSuite := Count(); 545 | SetRange(Run); 546 | SetFilter(Result, '<>%1', Result::Failure); 547 | NoOfNonFailedLinesInTestSuite := Count(); 548 | Assert.AreEqual(NoOfNonFailedLinesInTestSuite, NoOfEnabledLinesInTestSuite, 'NoOfNonFailedLines <> NoOfEnabledLines'); 549 | end; 550 | end; 551 | 552 | local procedure VerifyRunIsNotSetOnlyOnFailedFunctionsOfSecondTestCodeunit(CodeunitID: Integer) 553 | var 554 | CALTestLine: Record "CAL Test Line"; 555 | NoOfDisabledLinesInTestSuite: Integer; 556 | NoOfFailedLinesInTestCodeunit: Integer; 557 | begin 558 | with CALTestLine do begin 559 | SetRange("Test Suite", TestSuiteName); 560 | SetRange(Run, false); 561 | NoOfDisabledLinesInTestSuite := Count(); 562 | SetRange(Run); 563 | SetRange("Test Codeunit", CodeunitID); 564 | SetRange(Result, Result::Failure); 565 | SetRange("Line Type", "Line Type"::Function); 566 | NoOfFailedLinesInTestCodeunit := Count(); 567 | Assert.AreEqual(NoOfFailedLinesInTestCodeunit, NoOfDisabledLinesInTestSuite, 'NoOfFailedLines <> NoOfDisabledLines'); 568 | end; 569 | end; 570 | 571 | local procedure VerifyRunIsNotSetOnlyOnNonFailedFunctionsOfSecondTestCodeunit(CodeunitID: Integer) 572 | var 573 | CALTestLine: Record "CAL Test Line"; 574 | NoOfDisabledLinesInTestSuite: Integer; 575 | NoOfNonFailedLinesInTestCodeunit: Integer; 576 | begin 577 | with CALTestLine do begin 578 | SetRange("Test Suite", TestSuiteName); 579 | SetRange(Run, false); 580 | NoOfDisabledLinesInTestSuite := Count(); 581 | SetRange(Run); 582 | SetRange("Test Codeunit", CodeunitID); 583 | SetFilter(Result, '<>%1', Result::Failure); 584 | NoOfNonFailedLinesInTestCodeunit := Count(); 585 | Assert.AreEqual(NoOfNonFailedLinesInTestCodeunit, NoOfDisabledLinesInTestSuite, 'NoOfNonFailedLines <> NoOfDisabledLines'); 586 | end; 587 | end; 588 | 589 | local procedure VerifyRunIsNotSetOnSecondTestCodeunitAndItsFunctions(CodeunitID: Integer) 590 | var 591 | CALTestLine: Record "CAL Test Line"; 592 | NoOfDisabledLinesInTestSuite: Integer; 593 | NoOfLinesInTestCodeunit: Integer; 594 | begin 595 | with CALTestLine do begin 596 | SetRange("Test Suite", TestSuiteName); 597 | SetRange(Run, false); 598 | NoOfDisabledLinesInTestSuite := Count(); 599 | SetRange(Run); 600 | SetRange("Test Codeunit", CodeunitID); 601 | NoOfLinesInTestCodeunit := Count(); 602 | Assert.AreEqual(NoOfLinesInTestCodeunit, NoOfDisabledLinesInTestSuite, 'NoOfLinesInTestCodeunit <> NoOfDisabledLines'); 603 | end; 604 | end; 605 | 606 | local procedure VerifyRunIsSetOnlyOnSecondTestCodeunitAndItsFailedFunctions(CodeunitID: Integer) 607 | var 608 | CALTestLine: Record "CAL Test Line"; 609 | NoOfEnabledLinesInTestSuite: Integer; 610 | NoOfFailedLinesInTestCodeunit: Integer; 611 | begin 612 | with CALTestLine do begin 613 | SetRange("Test Suite", TestSuiteName); 614 | SetRange(Run, true); 615 | NoOfEnabledLinesInTestSuite := Count(); 616 | SetRange(Run); 617 | SetRange("Test Codeunit", CodeunitID); 618 | SetRange(Result, Result::Failure); 619 | NoOfFailedLinesInTestCodeunit := Count(); 620 | Assert.AreEqual(NoOfFailedLinesInTestCodeunit, NoOfEnabledLinesInTestSuite, 'NoOfFailedLines <> NoOfEnabledLines'); 621 | end; 622 | end; 623 | 624 | local procedure VerifyRunIsSetOnlyOnSecondTestCodeunitAndItsFunctions(CodeunitID: Integer) 625 | var 626 | CALTestLine: Record "CAL Test Line"; 627 | NoOfEnabledLinesInTestSuite: Integer; 628 | NoOfEnabledLinesInTestCodeunit: Integer; 629 | begin 630 | with CALTestLine do begin 631 | SetRange("Test Suite", TestSuiteName); 632 | SetRange(Run, true); 633 | NoOfEnabledLinesInTestSuite := Count(); 634 | SetRange(Run); 635 | SetRange("Test Codeunit", CodeunitID); 636 | NoOfEnabledLinesInTestCodeunit := Count(); 637 | Assert.AreEqual(NoOfEnabledLinesInTestCodeunit, NoOfEnabledLinesInTestSuite, 'NoOfEnabledLinesInTestCodeunit <> NoOfEnabledLines'); 638 | end; 639 | end; 640 | 641 | local procedure VerifyRunIsSetOnlyOnSecondTestCodeunitAndItsNonFailedFunctions(CodeunitID: Integer) 642 | var 643 | CALTestLine: Record "CAL Test Line"; 644 | NoOfEnabledLinesInTestSuite: Integer; 645 | NoOfNonFailedLinesInTestCodeunit: Integer; 646 | begin 647 | with CALTestLine do begin 648 | SetRange("Test Suite", TestSuiteName); 649 | SetRange(Run, true); 650 | NoOfEnabledLinesInTestSuite := Count(); 651 | SetRange(Run); 652 | SetRange("Test Codeunit", CodeunitID); 653 | SetFilter(Result, '<>%1', Result::Failure); 654 | NoOfNonFailedLinesInTestCodeunit := Count(); 655 | Assert.AreEqual(NoOfNonFailedLinesInTestCodeunit, NoOfEnabledLinesInTestSuite, 'NoOfNonFailedLines <> NoOfEnabledLines'); 656 | end; 657 | end; 658 | } -------------------------------------------------------------------------------- /CALTestTool/test/Test Codeunits/Cod92051.EnablActnsSelectOnAllFLX.al: -------------------------------------------------------------------------------- 1 | codeunit 92051 "Enabl. Actns Select On All FLX" 2 | { 3 | // (c) fluxxus.nl - https://github.com/fluxxus-nl/Test-Tool-Extension 4 | 5 | // [FEATURE] Enabling Actions Select/Deselect on All Unfiltered 6 | // [FEATURE] Enabling Actions Select/Deselect on All Filtered 7 | SubType = Test; 8 | 9 | [Test] 10 | procedure UnfilteredDisabledTestFunctions() 11 | // [FEATURE] Enabling Actions Select/Deselect on All Unfiltered 12 | begin 13 | // [SCENARIO #0001] Unfiltered disabled test functions 14 | Initialize(); 15 | 16 | // [GIVEN] One disabled test codeunit with five disabled test functions 17 | CreateOneDisabledTestCodeunitWithFiveDisabledTestFunctions(); 18 | // [GIVEN] One disabled test codeunit with three disabled test functions 19 | CreateOneDisabledTestCodeunitWithThreeDisabledTestFunctions(); 20 | 21 | // [WHEN] Do nothing 22 | DoNothing(); 23 | 24 | // [THEN] Select on All is enabled 25 | VerifySelectOnAllIsEnabled(NoFilterOnCodeunit()); 26 | // [THEN] Deselect on All is disabled 27 | VerifyDeselectOnAllIsDisabled(NoFilterOnCodeunit()); 28 | end; 29 | 30 | [Test] 31 | procedure UnfilteredEnabledTestFunctions() 32 | // [FEATURE] Enabling Actions Select/Deselect on All Unfiltered 33 | begin 34 | // [SCENARIO #0002] Unfiltered enabled test functions 35 | Initialize(); 36 | 37 | // [GIVEN] One enabled test codeunit with five enabled test functions 38 | CreateOneEnabledTestCodeunitWithFiveEnabledTestFunctions(); 39 | // [GIVEN] One enabled test codeunit with three enabled test functions 40 | CreateOneEnabledTestCodeunitWithThreeEnabledTestFunctions(); 41 | 42 | // [WHEN] Do nothing 43 | DoNothing(); 44 | 45 | // [THEN] Select on All is disabled 46 | VerifySelectOnAllIsDisabled(NoFilterOnCodeunit()); 47 | // [THEN] Deselect on All is enabled 48 | VerifyDeselectOnAllIsEnabled(NoFilterOnCodeunit()); 49 | end; 50 | 51 | [Test] 52 | procedure UnfilteredEnabledAndDisbledTestFunctions() 53 | // [FEATURE] Enabling Actions Select/Deselect on All Unfiltered 54 | begin 55 | // [SCENARIO #0003] Unfiltered enabled and disbled test functions 56 | Initialize(); 57 | 58 | // [GIVEN] One enabled test codeunit with five enabled test functions 59 | CreateOneEnabledTestCodeunitWithFiveEnabledTestFunctions(); 60 | // [GIVEN] One disabled test codeunit with three disabled test functions 61 | CreateOneDisabledTestCodeunitWithThreeDisabledTestFunctions(); 62 | 63 | // [WHEN] Do nothing 64 | DoNothing(); 65 | 66 | // [THEN] Select on All is enabled 67 | VerifySelectOnAllIsEnabled(NoFilterOnCodeunit()); 68 | // [THEN] Deselect on All is enabled 69 | VerifyDeselectOnAllIsEnabled(NoFilterOnCodeunit()); 70 | end; 71 | 72 | [Test] 73 | procedure EnableRunOnUnfilteredSuccessfulTestFunctions() 74 | // [FEATURE] Enabling Actions Select/Deselect on All Unfiltered 75 | begin 76 | // [SCENARIO #0004] Enable Run on unfiltered successful test functions 77 | Initialize(); 78 | 79 | // [GIVEN] One disabled test codeunit with five disabled successful test functions 80 | CreateOneDisabledTestCodeunitWithFiveDisabledSuccessfulTestFunctions(); 81 | // [GIVEN] One disabled test codeunit with three disabled successful test functions 82 | CreateOneDisabledTestCodeunitWithThreeDisabledSuccessfulTestFunctions(); 83 | 84 | // [WHEN] Perform Select on All 85 | PerformSelectOnAll(NoFilterOnCodeunit()); 86 | 87 | // [THEN] Run is set on all test codeunits and functions 88 | VerifyRunIsSetOnAllTestCodeunitsAndFunctions(); 89 | // [THEN] Select on All is disabled 90 | VerifySelectOnAllIsDisabled(NoFilterOnCodeunit()); 91 | // [THEN] Deselect on All is enabled 92 | VerifyDeselectOnAllIsEnabled(NoFilterOnCodeunit()); 93 | end; 94 | 95 | [Test] 96 | procedure DisableRunOnUnfilteredSuccessfulTestFunctions() 97 | // [FEATURE] Enabling Actions Select/Deselect on All Unfiltered 98 | begin 99 | // [SCENARIO #0005] Disable Run on unfiltered successful test functions 100 | Initialize(); 101 | 102 | // [GIVEN] One enabled test codeunit with five enabled successful test functions 103 | CreateOneEnabledTestCodeunitWithFiveEnabledSuccessfulTestFunctions(); 104 | // [GIVEN] One enabled test codeunit with three enabled successful test functions 105 | CreateOneEnabledTestCodeunitWithThreeEnabledSuccessfulTestFunctions(); 106 | 107 | // [WHEN] Perform Deselect on All 108 | PerformDeselectOnAll(NoFilterOnCodeunit()); 109 | 110 | // [THEN] Run is not set on all test codeunits and functions 111 | VerifyRunIsNotSetOnAllTestCodeunitsAndFunctions(); 112 | // [THEN] Select on All is enabled 113 | VerifySelectOnAllIsEnabled(NoFilterOnCodeunit()); 114 | // [THEN] Deselect on All is disabled 115 | VerifyDeselectOnAllIsDisabled(NoFilterOnCodeunit()); 116 | end; 117 | 118 | [Test] 119 | procedure FilteredDisabledTestFunctions() 120 | // [FEATURE] Enabling Actions Select/Deselect on All Filtered 121 | var 122 | SecondCodeunitID: Integer; 123 | begin 124 | // [SCENARIO #0006] Filtered disabled test functions 125 | Initialize(); 126 | 127 | // [GIVEN] One disabled test codeunit with five disabled test functions 128 | CreateOneDisabledTestCodeunitWithFiveDisabledTestFunctions(); 129 | // [GIVEN] One disabled test codeunit with three disabled test functions 130 | SecondCodeunitID := CreateOneDisabledTestCodeunitWithThreeDisabledTestFunctions(); 131 | 132 | // [WHEN] Set filter on second test codeunit 133 | // handled by Verify... task in [THEN] part based on SecondCodeunitID 134 | 135 | // [THEN] Select on All is enabled 136 | VerifySelectOnAllIsEnabled(SetFilterOn(SecondCodeunitID)); 137 | // [THEN] Deselect on All is disabled 138 | VerifyDeselectOnAllIsDisabled(SetFilterOn(SecondCodeunitID)); 139 | end; 140 | 141 | [Test] 142 | procedure FilteredEnabledTestFunctions() 143 | // [FEATURE] Enabling Actions Select/Deselect on All Filtered 144 | var 145 | SecondCodeunitID: Integer; 146 | begin 147 | // [SCENARIO #0007] Filtered enabled test functions 148 | Initialize(); 149 | 150 | // [GIVEN] One enabled test codeunit with five enabled test functions 151 | CreateOneEnabledTestCodeunitWithFiveEnabledTestFunctions(); 152 | // [GIVEN] One enabled test codeunit with three enabled test functions 153 | SecondCodeunitID := CreateOneEnabledTestCodeunitWithThreeEnabledTestFunctions(); 154 | 155 | // [WHEN] Set filter on second test codeunit 156 | // handled by Verify... task in [THEN] part based on SecondCodeunitID 157 | 158 | // [THEN] Select on All is disabled 159 | VerifySelectOnAllIsDisabled(SetFilterOn(SecondCodeunitID)); 160 | // [THEN] Deselect on All is enabled 161 | VerifyDeselectOnAllIsEnabled(SetFilterOn(SecondCodeunitID)); 162 | end; 163 | 164 | [Test] 165 | procedure FilteredEnabledAndDisbledTestFunctions() 166 | // [FEATURE] Enabling Actions Select/Deselect on All Filtered 167 | var 168 | SecondCodeunitID: Integer; 169 | begin 170 | // [SCENARIO #0008] Filtered enabled and disabled test functions 171 | Initialize(); 172 | 173 | // [GIVEN] One enabled test codeunit with five enabled test functions 174 | CreateOneEnabledTestCodeunitWithFiveEnabledTestFunctions(); 175 | // [GIVEN] One disabled test codeunit with three disabled test functions 176 | SecondCodeunitID := CreateOneDisabledTestCodeunitWithThreeDisabledTestFunctions(); 177 | 178 | // [WHEN] Set filter on second test codeunit 179 | // handled by Verify... task in [THEN] part based on SecondCodeunitID 180 | 181 | 182 | // [THEN] Select on All is enabled 183 | VerifySelectOnAllIsEnabled(SetFilterOn(SecondCodeunitID)); 184 | // [THEN] Deselect on All is enabled 185 | VerifyDeselectOnAllIsDisabled(SetFilterOn(SecondCodeunitID)); 186 | end; 187 | 188 | [Test] 189 | procedure EnableRunOnFilteredSuccessfulTestFunctions() 190 | // [FEATURE] Enabling Actions Select/Deselect on All Filtered 191 | var 192 | SecondCodeunitID: Integer; 193 | begin 194 | // [SCENARIO #0009] Enable Run on filtered successful test functions 195 | Initialize(); 196 | 197 | // [GIVEN] One disabled test codeunit with five disabled successful test functions 198 | CreateOneDisabledTestCodeunitWithFiveDisabledSuccessfulTestFunctions(); 199 | // [GIVEN] One disabled test codeunit with three disabled successful test functions 200 | SecondCodeunitID := CreateOneDisabledTestCodeunitWithThreeDisabledSuccessfulTestFunctions(); 201 | // [GIVEN] Filter on second test codeunit 202 | // handled by Perform... task in [WHEN] part based on SecondCodeunitID 203 | 204 | // [WHEN] Perform Select on All 205 | PerformSelectOnAll(SetFilterOn(SecondCodeunitID)); 206 | 207 | // [THEN] Run is set on second test codeunit and functions 208 | VerifyRunIsSetOnSecondTestCodeunitsAndFunctions(SetFilterOn(SecondCodeunitID)); 209 | // [THEN] Select on All is disabled 210 | VerifySelectOnAllIsDisabled(SetFilterOn(SecondCodeunitID)); 211 | // [THEN] Deselect on All is enabled 212 | VerifyDeselectOnAllIsEnabled(SetFilterOn(SecondCodeunitID)); 213 | end; 214 | 215 | [Test] 216 | procedure DisableRunOnFilteredSuccessfulTestFunctions() 217 | // [FEATURE] Enabling Actions Select/Deselect on All Filtered 218 | var 219 | SecondCodeunitID: Integer; 220 | begin 221 | // [SCENARIO #0010] Disable Run on filtered successful test functions 222 | Initialize(); 223 | 224 | // [GIVEN] One enabled test codeunit with five enabled successful test functions 225 | CreateOneEnabledTestCodeunitWithFiveEnabledSuccessfulTestFunctions(); 226 | // [GIVEN] One enabled test codeunit with three enabled successful test functions 227 | SecondCodeunitID := CreateOneEnabledTestCodeunitWithThreeEnabledSuccessfulTestFunctions(); 228 | // [GIVEN] Filter on second test codeunit 229 | // handled by Perform... task in [WHEN] part based on SecondCodeunitID 230 | 231 | // [WHEN] Perform Deselect on All 232 | PerformDeselectOnAll(SetFilterOn(SecondCodeunitID)); 233 | 234 | // [THEN] Run is not set on second test codeunit and functions 235 | VerifyRunIsNotSetOnSecondTestCodeunitsAndFunctions(SetFilterOn(SecondCodeunitID)); 236 | // [THEN] Select on All is enabled 237 | VerifySelectOnAllIsEnabled(SetFilterOn(SecondCodeunitID)); 238 | // [THEN] Deselect on All is disabled 239 | VerifyDeselectOnAllIsDisabled(SetFilterOn(SecondCodeunitID)); 240 | end; 241 | 242 | var 243 | Assert: Codeunit Assert; 244 | LibraryTestFunctions: Codeunit "Lib. - Test Function Lns FLX"; 245 | LibraryVerifyActions: Codeunit "Library - Verify Actions FLX"; 246 | TestSuiteName: Code[10]; 247 | 248 | local procedure Initialize() 249 | var 250 | LibraryTestInitialize: Codeunit "Library - Test Initialize"; 251 | LibraryUtility: Codeunit "Library - Utility"; 252 | begin 253 | LibraryTestInitialize.OnTestInitialize(Codeunit::"Enabl. Actns Select On All FLX"); 254 | 255 | TestSuiteName := LibraryUtility.GenerateGUID(); 256 | LibraryTestFunctions.CreateTestSuite(TestSuiteName); 257 | LibraryTestFunctions.SetCodeunitBaseID(-Codeunit::"Enabl. Actns Select On All FLX"); 258 | end; 259 | 260 | local procedure CreateFilterOnSecondTestCodeunit() 261 | begin 262 | end; 263 | 264 | local procedure CreateOneDisabledTestCodeunitWithFiveDisabledSuccessfulTestFunctions(): Integer 265 | begin 266 | with LibraryTestFunctions do begin 267 | CreateTestCodeunit(TestSuiteName, GetNextCodeunitID(), IsDisabled()); 268 | CreateTestFunctions(TestSuiteName, GetCurrentCodeunitID(), IsDisabled(), 5, 0); 269 | exit(GetCurrentCodeunitID()); 270 | end; 271 | end; 272 | 273 | local procedure CreateOneDisabledTestCodeunitWithFiveDisabledTestFunctions(): Integer 274 | begin 275 | CreateOneDisabledTestCodeunitWithFiveDisabledSuccessfulTestFunctions() 276 | end; 277 | 278 | local procedure CreateOneDisabledTestCodeunitWithThreeDisabledSuccessfulTestFunctions(): Integer 279 | begin 280 | with LibraryTestFunctions do begin 281 | CreateTestCodeunit(TestSuiteName, GetNextCodeunitID(), IsDisabled()); 282 | CreateTestFunctions(TestSuiteName, GetCurrentCodeunitID(), IsDisabled(), 3, 0); 283 | exit(GetCurrentCodeunitID()); 284 | end; 285 | end; 286 | 287 | local procedure CreateOneDisabledTestCodeunitWithThreeDisabledTestFunctions(): Integer 288 | begin 289 | exit(CreateOneDisabledTestCodeunitWithThreeDisabledSuccessfulTestFunctions()) 290 | end; 291 | 292 | local procedure CreateOneEnabledTestCodeunitWithFiveEnabledSuccessfulTestFunctions(): Integer 293 | begin 294 | with LibraryTestFunctions do begin 295 | CreateTestCodeunit(TestSuiteName, GetNextCodeunitID(), IsDisabled()); 296 | CreateTestFunctions(TestSuiteName, GetCurrentCodeunitID(), IsEnabled(), 5, 0); 297 | exit(GetCurrentCodeunitID()); 298 | end; 299 | end; 300 | 301 | local procedure CreateOneEnabledTestCodeunitWithFiveEnabledTestFunctions(): Integer 302 | begin 303 | exit(CreateOneEnabledTestCodeunitWithFiveEnabledSuccessfulTestFunctions()) 304 | end; 305 | 306 | local procedure CreateOneEnabledTestCodeunitWithThreeEnabledSuccessfulTestFunctions(): Integer 307 | begin 308 | with LibraryTestFunctions do begin 309 | CreateTestCodeunit(TestSuiteName, GetNextCodeunitID(), IsDisabled()); 310 | CreateTestFunctions(TestSuiteName, GetCurrentCodeunitID(), IsEnabled(), 3, 0); 311 | exit(GetCurrentCodeunitID()); 312 | end; 313 | end; 314 | 315 | local procedure CreateOneEnabledTestCodeunitWithThreeEnabledTestFunctions(): Integer 316 | begin 317 | exit(CreateOneEnabledTestCodeunitWithThreeEnabledSuccessfulTestFunctions()) 318 | end; 319 | 320 | // local procedure CreateTestFunctions(NewSuiteName: Code[10]; NewCodeunitID: Integer; NewEnabled: Boolean; NoOfSuccesfull: Integer; NoOfFailed: Integer) 321 | // var 322 | // i: Integer; 323 | // begin 324 | // for i := 1 to NoOfSuccesfull do 325 | // CreateTestFunction(NewSuiteName, NewCodeunitID, NewEnabled, true); 326 | 327 | // for i := 1 to NoOfFailed do 328 | // CreateTestFunction(NewSuiteName, NewCodeunitID, NewEnabled, false); 329 | // end; 330 | 331 | local procedure DoNothing() 332 | begin 333 | end; 334 | 335 | local procedure PerformDeselectOnAll(CodeunitID: Integer) 336 | begin 337 | SetRun(CodeunitID, 2) // 2 = Failures 338 | end; 339 | 340 | local procedure PerformSelectOnAll(CodeunitID: Integer) 341 | begin 342 | SetRun(CodeunitID, 0) // 0 = All 343 | end; 344 | 345 | local procedure SetRun(CodeunitID: Integer; RunType: Option All,"Non",Failures,NonFailures) 346 | var 347 | CALTestLine: Record "CAL Test Line"; 348 | SetRunOnTestTool: Codeunit "Set Run On Test Tool FLX"; 349 | begin 350 | SetFilterOnCALTestLine(CALTestLine, CodeunitID); 351 | SetRunOnTestTool.SetRun(CALTestLine, RunType) 352 | end; 353 | 354 | local procedure NoFilterOnCodeunit(): Integer 355 | begin 356 | exit(0) 357 | end; 358 | 359 | local procedure SetFilterOn(CodeunitID: Integer): Integer 360 | begin 361 | exit(CodeunitID) 362 | end; 363 | 364 | local procedure IsEnabled(): Boolean 365 | begin 366 | exit(true) 367 | end; 368 | 369 | local procedure IsDisabled(): Boolean 370 | begin 371 | exit(false) 372 | end; 373 | 374 | local procedure VerifySelectOnAllIsDisabled(CodeunitID: Integer) 375 | begin 376 | LibraryVerifyActions.VerifySelectOnAllIsDisabled(TestSuiteName, CodeunitID); 377 | end; 378 | 379 | local procedure VerifySelectOnAllIsEnabled(CodeunitID: Integer) 380 | begin 381 | LibraryVerifyActions.VerifySelectOnAllIsEnabled(TestSuiteName, CodeunitID); 382 | end; 383 | 384 | local procedure VerifyDeselectOnAllIsDisabled(CodeunitID: Integer) 385 | begin 386 | LibraryVerifyActions.VerifyDeselectOnAllIsDisabled(TestSuiteName, CodeunitID); 387 | end; 388 | 389 | local procedure VerifyDeselectOnAllIsEnabled(CodeunitID: Integer) 390 | begin 391 | LibraryVerifyActions.VerifyDeselectOnAllIsEnabled(TestSuiteName, CodeunitID); 392 | end; 393 | 394 | local procedure VerifyRunIsNotSetOnAllTestCodeunitsAndFunctions() 395 | begin 396 | VerifyRunOn(NoFilterOnCodeunit(), IsDisabled()) 397 | end; 398 | 399 | local procedure VerifyRunIsSetOnAllTestCodeunitsAndFunctions() 400 | begin 401 | VerifyRunOn(NoFilterOnCodeunit(), IsEnabled()) 402 | end; 403 | 404 | local procedure VerifyRunIsNotSetOnSecondTestCodeunitsAndFunctions(CodeunitID: Integer) 405 | begin 406 | VerifyRunOn(CodeunitID, IsDisabled()) 407 | end; 408 | 409 | local procedure VerifyRunIsSetOnSecondTestCodeunitsAndFunctions(CodeunitID: Integer) 410 | begin 411 | VerifyRunOn(CodeunitID, IsEnabled()) 412 | end; 413 | 414 | local procedure VerifyRunOn(CodeunitID: Integer; Enabled: Boolean) 415 | var 416 | CALTestLine: Record "CAL Test Line"; 417 | NoOfAllLinesInTestSuite: Integer; 418 | NoOfEnabledLinesInTestSuite: Integer; 419 | begin 420 | with CALTestLine do begin 421 | SetFilterOnCALTestLine(CALTestLine, CodeunitID); 422 | NoOfAllLinesInTestSuite := Count(); 423 | SetRange(Run, Enabled); 424 | NoOfEnabledLinesInTestSuite := Count(); 425 | Assert.AreEqual(NoOfAllLinesInTestSuite, NoOfEnabledLinesInTestSuite, 'NoOfAllLines <> NoOfEnabledLines'); 426 | end; 427 | end; 428 | 429 | local procedure SetFilterOnCALTestLine(var CALTestLine: Record "CAL Test Line"; CodeunitID: Integer) 430 | begin 431 | LibraryVerifyActions.SetFilterOnCALTestLine(CALTestLine, TestSuiteName, CodeunitID); 432 | end; 433 | } -------------------------------------------------------------------------------- /CALTestTool/test/Test Codeunits/Cod92052.EnablingActionsSelectDeselectOnFailuresScenarios.al: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluxxus-nl/Test-Tool-Extension/d2169d2ba3c2f048533636b8e8e38069ff69926b/CALTestTool/test/Test Codeunits/Cod92052.EnablingActionsSelectDeselectOnFailuresScenarios.al -------------------------------------------------------------------------------- /CALTestTool/test/Test Codeunits/Cod92053.EnablingActionsSelectDeselectOnNonFailuresScenarios.al: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluxxus-nl/Test-Tool-Extension/d2169d2ba3c2f048533636b8e8e38069ff69926b/CALTestTool/test/Test Codeunits/Cod92053.EnablingActionsSelectDeselectOnNonFailuresScenarios.al -------------------------------------------------------------------------------- /CALTestTool/test/Test Libraries/Cod92060.LibTestFunctionLnsFLX.al: -------------------------------------------------------------------------------- 1 | codeunit 92060 "Lib. - Test Function Lns FLX" 2 | { 3 | // (c) fluxxus.nl - https://github.com/fluxxus-nl/Test-Tool-Extension 4 | 5 | var 6 | BaseCodeunitID: Integer; 7 | CurrentCodeunitID: Integer; 8 | 9 | procedure CreateTestSuite(NewName: Code[10]) 10 | var 11 | CALTestSuite: Record "CAL Test Suite"; 12 | begin 13 | with CALTestSuite do 14 | if not Get(NewName) then begin 15 | Name := NewName; 16 | Insert(); 17 | end; 18 | end; 19 | 20 | procedure CreateTestCodeunit(TestSuiteName: Code[10]; TestCodeunitID: Integer; Enabled: Boolean) 21 | var 22 | CALTestLine: Record "CAL Test Line"; 23 | begin 24 | with CALTestLine do 25 | CreateCALTestLine(CALTestLine, TestSuiteName, "Line Type"::"Codeunit", TestCodeunitID, Enabled); 26 | end; 27 | 28 | procedure SetTestCodeunitResult(TestSuiteName: Code[10]; TestCodeunitID: Integer) 29 | var 30 | CALTestCodeunitLine: Record "CAL Test Line"; 31 | CALTestFunctionLine: Record "CAL Test Line"; 32 | begin 33 | GetTestCodeunitLine(CALTestCodeunitLine, TestSuiteName, TestCodeunitID); 34 | 35 | with CALTestFunctionLine do begin 36 | SetRange("Test Suite", TestSuiteName); 37 | SetRange("Test Codeunit", TestCodeunitID); 38 | SetRange("Line Type", "Line Type"::Function); 39 | SetRange(Result, Result::Failure); 40 | if FindFirst() then begin 41 | CALTestCodeunitLine.Result := Result::Failure; 42 | CALTestCodeunitLine."First Error" := "First Error"; 43 | end else begin 44 | SetRange(Result); 45 | if FindFirst() then begin 46 | CALTestCodeunitLine.Result := CALTestFunctionLine.Result; 47 | CALTestCodeunitLine."First Error" := "First Error"; 48 | end; 49 | end; 50 | CALTestCodeunitLine.Modify(); 51 | end; 52 | end; 53 | 54 | procedure GetTestCodeunitLine(var CALTestLine: Record "CAL Test Line"; TestSuiteName: Code[10]; TestCodeunitID: Integer) 55 | begin 56 | with CALTestLine do begin 57 | SetRange("Test Suite", TestSuiteName); 58 | SetRange("Test Codeunit", TestCodeunitID); 59 | SetRange("Line Type", "Line Type"::Codeunit); 60 | FindFirst(); 61 | end; 62 | end; 63 | 64 | procedure CreateTestFunction(TestSuiteName: Code[10]; TestCodeunitID: Integer; Enabled: Boolean; Succesfull: Boolean) 65 | var 66 | CALTestLine: Record "CAL Test Line"; 67 | begin 68 | with CALTestLine do begin 69 | CreateCALTestLine(CALTestLine, TestSuiteName, "Line Type"::"Function", TestCodeunitID, Enabled); 70 | if Succesfull then 71 | Result := Result::Success 72 | else 73 | Result := Result::Failure; 74 | Modify(); 75 | end; 76 | end; 77 | 78 | procedure CreateTestFunctions(NewSuiteName: Code[10]; NewCodeunitID: Integer; NewEnabled: Boolean; NoOfSuccesfull: Integer; NoOfFailed: Integer) 79 | var 80 | i: Integer; 81 | begin 82 | for i := 1 to NoOfSuccesfull do 83 | CreateTestFunction(NewSuiteName, NewCodeunitID, NewEnabled, true); 84 | 85 | for i := 1 to NoOfFailed do 86 | CreateTestFunction(NewSuiteName, NewCodeunitID, NewEnabled, false); 87 | end; 88 | 89 | procedure CreateCALTestLine(var CALTestLine: Record "CAL Test Line"; NewSuiteName: Code[10]; NewLineType: Option "Group","Codeunit","Function"; NewCodeunitID: Integer; NewEnabled: Boolean) 90 | var 91 | LineNo: Integer; 92 | begin 93 | with CALTestLine do begin 94 | LineNo := GetLastCALTestLineNo(NewSuiteName) + 10000; 95 | InitRecord(NewSuiteName, LineNo, NewLineType, NewCodeunitID, NewEnabled); 96 | Name := CopyStr(StrSubstNo('%1 %2 %3', Format(NewLineType), NewCodeunitID, LineNo), 1, MaxStrLen(Name)); 97 | "Function" := Name; 98 | Insert(); 99 | end; 100 | end; 101 | 102 | procedure SetCodeunitBaseID(CodeunitBaseID: Integer) 103 | begin 104 | BaseCodeunitID := CodeunitBaseID; 105 | end; 106 | 107 | procedure GetNextCodeunitID(): Integer 108 | begin 109 | if CurrentCodeunitID = 0 then 110 | CurrentCodeunitID := BaseCodeunitID; 111 | CurrentCodeunitID := CurrentCodeunitID + 1; 112 | exit(CurrentCodeunitID); 113 | end; 114 | 115 | procedure GetCurrentCodeunitID(): Integer 116 | begin 117 | exit(CurrentCodeunitID); 118 | end; 119 | 120 | local procedure GetLastCALTestLineNo(TestSuiteName: Code[10]): Integer 121 | var 122 | CALTestLine: Record "CAL Test Line"; 123 | begin 124 | with CALTestLine do begin 125 | SetRange("Test Suite", TestSuiteName); 126 | if FindLast() then; 127 | exit("Line No."); 128 | end; 129 | end; 130 | } -------------------------------------------------------------------------------- /CALTestTool/test/Test Libraries/Cod92061.LibraryVerifyActionsFLX.al: -------------------------------------------------------------------------------- 1 | codeunit 92061 "Library - Verify Actions FLX" 2 | { 3 | // (c) fluxxus.nl - https://github.com/fluxxus-nl/Test-Tool-Extension 4 | 5 | var 6 | Assert: Codeunit Assert; 7 | 8 | procedure VerifySelectOnAllIsDisabled(TestSuiteName: Code[10]; CodeunitID: Integer) 9 | var 10 | CALTestLine: Record "CAL Test Line"; 11 | ActionEnablingArguments: Record "Action Enabling Arguments FLX"; 12 | SetActionsEnablingOnTestTool: Codeunit "Set Actions Enabling On TT FLX"; 13 | begin 14 | SetFilterOnCALTestLine(CALTestLine, TestSuiteName, CodeunitID); 15 | SetActionsEnablingOnTestTool.SetActionsEnabling(CALTestLine, ActionEnablingArguments); 16 | Assert.IsFalse(ActionEnablingArguments.SelectAllEnabled, 'Select on All is not disabled'); 17 | end; 18 | 19 | procedure VerifySelectOnAllIsEnabled(TestSuiteName: Code[10]; CodeunitID: Integer) 20 | var 21 | CALTestLine: Record "CAL Test Line"; 22 | ActionEnablingArguments: Record "Action Enabling Arguments FLX"; 23 | SetActionsEnablingOnTestTool: Codeunit "Set Actions Enabling On TT FLX"; 24 | begin 25 | SetFilterOnCALTestLine(CALTestLine, TestSuiteName, CodeunitID); 26 | SetActionsEnablingOnTestTool.SetActionsEnabling(CALTestLine, ActionEnablingArguments); 27 | Assert.IsTrue(ActionEnablingArguments.SelectAllEnabled, 'Select on All is not enabled'); 28 | end; 29 | 30 | procedure VerifyDeselectOnAllIsDisabled(TestSuiteName: Code[10]; CodeunitID: Integer) 31 | var 32 | CALTestLine: Record "CAL Test Line"; 33 | ActionEnablingArguments: Record "Action Enabling Arguments FLX"; 34 | SetActionsEnablingOnTestTool: Codeunit "Set Actions Enabling On TT FLX"; 35 | begin 36 | SetFilterOnCALTestLine(CALTestLine, TestSuiteName, CodeunitID); 37 | SetActionsEnablingOnTestTool.SetActionsEnabling(CALTestLine, ActionEnablingArguments); 38 | Assert.IsFalse(ActionEnablingArguments.DeselectAllEnabled, 'Deselect on All is not disabled'); 39 | end; 40 | 41 | procedure VerifyDeselectOnAllIsEnabled(TestSuiteName: Code[10]; CodeunitID: Integer) 42 | var 43 | CALTestLine: Record "CAL Test Line"; 44 | ActionEnablingArguments: Record "Action Enabling Arguments FLX"; 45 | SetActionsEnablingOnTestTool: Codeunit "Set Actions Enabling On TT FLX"; 46 | begin 47 | SetFilterOnCALTestLine(CALTestLine, TestSuiteName, CodeunitID); 48 | SetActionsEnablingOnTestTool.SetActionsEnabling(CALTestLine, ActionEnablingArguments); 49 | Assert.IsTrue(ActionEnablingArguments.DeselectAllEnabled, 'Deselect on All is not enabled'); 50 | end; 51 | 52 | procedure VerifySelectOnFailuresIsDisabled(TestSuiteName: Code[10]; CodeunitID: Integer) 53 | var 54 | CALTestLine: Record "CAL Test Line"; 55 | ActionEnablingArguments: Record "Action Enabling Arguments FLX"; 56 | SetActionsEnablingOnTestTool: Codeunit "Set Actions Enabling On TT FLX"; 57 | begin 58 | SetFilterOnCALTestLine(CALTestLine, TestSuiteName, CodeunitID); 59 | SetActionsEnablingOnTestTool.SetActionsEnabling(CALTestLine, ActionEnablingArguments); 60 | Assert.IsFalse(ActionEnablingArguments.SelectFailuresEnabled, 'Select on Failures is not disabled'); 61 | end; 62 | 63 | procedure VerifySelectOnFailuresIsEnabled(TestSuiteName: Code[10]; CodeunitID: Integer) 64 | var 65 | CALTestLine: Record "CAL Test Line"; 66 | ActionEnablingArguments: Record "Action Enabling Arguments FLX"; 67 | SetActionsEnablingOnTestTool: Codeunit "Set Actions Enabling On TT FLX"; 68 | begin 69 | SetFilterOnCALTestLine(CALTestLine, TestSuiteName, CodeunitID); 70 | SetActionsEnablingOnTestTool.SetActionsEnabling(CALTestLine, ActionEnablingArguments); 71 | Assert.IsTrue(ActionEnablingArguments.SelectFailuresEnabled, 'Select on Failures is not enabled'); 72 | end; 73 | 74 | procedure VerifySelectOnNonFailuresIsDisabled(TestSuiteName: Code[10]; CodeunitID: Integer) 75 | var 76 | CALTestLine: Record "CAL Test Line"; 77 | ActionEnablingArguments: Record "Action Enabling Arguments FLX"; 78 | SetActionsEnablingOnTestTool: Codeunit "Set Actions Enabling On TT FLX"; 79 | begin 80 | SetFilterOnCALTestLine(CALTestLine, TestSuiteName, CodeunitID); 81 | SetActionsEnablingOnTestTool.SetActionsEnabling(CALTestLine, ActionEnablingArguments); 82 | Assert.IsFalse(ActionEnablingArguments.SelectNonFailuresEnabled, 'Select on Non Failures is not disabled'); 83 | end; 84 | 85 | procedure VerifySelectOnNonFailuresIsEnabled(TestSuiteName: Code[10]; CodeunitID: Integer) 86 | var 87 | CALTestLine: Record "CAL Test Line"; 88 | ActionEnablingArguments: Record "Action Enabling Arguments FLX"; 89 | SetActionsEnablingOnTestTool: Codeunit "Set Actions Enabling On TT FLX"; 90 | begin 91 | SetFilterOnCALTestLine(CALTestLine, TestSuiteName, CodeunitID); 92 | SetActionsEnablingOnTestTool.SetActionsEnabling(CALTestLine, ActionEnablingArguments); 93 | Assert.IsTrue(ActionEnablingArguments.SelectNonFailuresEnabled, 'Select on Non Failures is not denabled'); 94 | end; 95 | 96 | procedure SetFilterOnCALTestLine(var CALTestLine: Record "CAL Test Line"; TestSuiteName: Code[10]; CodeunitID: Integer) 97 | begin 98 | with CALTestLine do begin 99 | SetRange("Test Suite", TestSuiteName); 100 | if CodeunitID <> 0 then 101 | SetRange("Test Codeunit", CodeunitID); 102 | end; 103 | end; 104 | 105 | procedure VerifyRunOnAll(TestSuiteName: Code[10]; CodeunitID: Integer; Enabled: Boolean) 106 | var 107 | CALTestLine: Record "CAL Test Line"; 108 | NoOfAllLinesInTestSuite: Integer; 109 | NoOfEnabledLinesInTestSuite: Integer; 110 | begin 111 | with CALTestLine do begin 112 | SetFilterOnCALTestLine(CALTestLine, TestSuiteName, CodeunitID); 113 | NoOfAllLinesInTestSuite := Count(); 114 | SetRange(Run, Enabled); 115 | NoOfEnabledLinesInTestSuite := Count(); 116 | Assert.AreEqual(NoOfAllLinesInTestSuite, NoOfEnabledLinesInTestSuite, 'NoOfAllLines <> NoOfEnabledLines'); 117 | end; 118 | end; 119 | } -------------------------------------------------------------------------------- /CALTestTool/test/Test Libraries/Cod92062.LibraryPerformSelectFLX.al: -------------------------------------------------------------------------------- 1 | codeunit 92062 "Library - Perform Select FLX" 2 | { 3 | // (c) fluxxus.nl - https://github.com/fluxxus-nl/Test-Tool-Extension 4 | 5 | procedure PerformSelectOnAll(TestSuiteName: Code[10]; CodeunitID: Integer) 6 | begin 7 | SetRun(TestSuiteName, CodeunitID, 0) // 0 = All 8 | end; 9 | 10 | procedure PerformDeselectOnAll(TestSuiteName: Code[10]; CodeunitID: Integer) 11 | begin 12 | SetRun(TestSuiteName, CodeunitID, 1) // 1 = None 13 | end; 14 | 15 | procedure PerformSelectOnFailures(TestSuiteName: Code[10]; CodeunitID: Integer) 16 | begin 17 | SetRun(TestSuiteName, CodeunitID, 2) // 2 = Failures 18 | end; 19 | 20 | procedure PerformSelectOnNonFailures(TestSuiteName: Code[10]; CodeunitID: Integer) 21 | begin 22 | SetRun(TestSuiteName, CodeunitID, 3) // 3 = NonFailures 23 | end; 24 | 25 | local procedure SetRun(TestSuiteName: Code[10]; CodeunitID: Integer; RunType: Option All,"Non",Failures,NonFailures) 26 | var 27 | CALTestLine: Record "CAL Test Line"; 28 | SetRunOnTestTool: Codeunit "Set Run On Test Tool FLX"; 29 | begin 30 | CALTestLine."Test Suite" := TestSuiteName; 31 | if CodeunitID <> 0 then 32 | CALTestLine.SetRange("Test Codeunit", CodeunitID); 33 | SetRunOnTestTool.SetRun(CALTestLine, RunType) 34 | end; 35 | 36 | } -------------------------------------------------------------------------------- /Images/AL Test Tool Extension Actions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluxxus-nl/Test-Tool-Extension/d2169d2ba3c2f048533636b8e8e38069ff69926b/Images/AL Test Tool Extension Actions.png -------------------------------------------------------------------------------- /Images/Test Tool Extension Actions (Web Client).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluxxus-nl/Test-Tool-Extension/d2169d2ba3c2f048533636b8e8e38069ff69926b/Images/Test Tool Extension Actions (Web Client).png -------------------------------------------------------------------------------- /Images/Test Tool Extension Actions (Windows Client).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluxxus-nl/Test-Tool-Extension/d2169d2ba3c2f048533636b8e8e38069ff69926b/Images/Test Tool Extension Actions (Windows Client).png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 fluxxus.nl 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CAL Test Tool Extension 2 | 3 | The CAL Test Tool Extension extends the _CAL Test Tool_ in Microsoft Dynamics 365 Business Central with the following features. 4 | 5 | - Select the Run field for: 6 | - all tests 7 | - only failing tests and thus disabling all others 8 | - non failing tests, thus disabling failing tests 9 | - Deselect the Run field for all tests, thus disabling all tests 10 | - ShortcutKey = 'Ctrl+F9' on "Run Selected" 11 | 12 | ![Windows Client](https://github.com/fluxxus-nl/Test-Tool-Extension/blob/master/Images/Test%20Tool%20Extension%20Actions%20(Windows%20Client).png) 13 | 14 | ![Web Client](https://github.com/fluxxus-nl/Test-Tool-Extension/blob/master/Images/Test%20Tool%20Extension%20Actions%20(Web%20Client).png) 15 | 16 | You might have come here via my new book [Automated Testing in Microsoft Dynamics 365 Business Central](https://www.packtpub.com/business/automated-testing-microsoft-dynamics-365-business-central), published by, Packt. Feel free to use the extension and source to your own need. Would be fantastic if any adjustments you think are useful are shared be reporting it ad an issue here. 17 | 18 | You also might want to read me [blog post](https://dynamicsuser.net/nav/b/vanvugt/posts/test-tool-extension) on the subject. 19 | 20 | # AL Test Tool Extension 21 | 22 | With BC16 MS has released a new test tool called _AL Test Tool_, which no longer is part of the application, but resides in it's own extension. The Al Test Tool Extension extends this in the same matter as the CAL Test Tool Extension extends the _CAL Test Tool_. 23 | 24 | ![Web Client](https://github.com/fluxxus-nl/Test-Tool-Extension/blob/master/Images/AL%20Test%20Tool%20Extension%20Actions.png) 25 | 26 | [Azure DevOps pipelines](https://dev.azure.com/fluxxus-nl/Test-Tool-Extension) have been setup for the AL version of this project. 27 | --------------------------------------------------------------------------------