Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'New Performance Test App (PegBoardPerformanceTest)' #14

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions PegBoardPerformanceTest/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"version": "0.2.0",
"configurations": [
]
}
45 changes: 45 additions & 0 deletions PegBoardPerformanceTest/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"id": "c344963d-3020-4883-8f53-15287b285390",
"name": "PegBoardPerformanceTest",
"publisher": "Morten Seifert",
"version": "1.0.0.0",
"brief": "Performance Toolkit Samples (US)",
"description": "This extension provides tests that simulate business processes, such as creating sales orders, for the Business Central Performance Toolkit. Developers can use these to test for performance regressions during development.",
"platform": "23.0.0.0",
"application": "23.2.0.0",
"runtime": "12.0",
"logo": "",
"url": "",
"EULA": "",
"privacyStatement": "",
"help": "",
"target": "Cloud",
"screenshots": [],
"dependencies": [
{
"id": "75f1590f-55c5-4501-ae63-bada5534e852",
"publisher": "Microsoft",
"name": "Performance Toolkit",
"version": "23.2.0.0"
}
],
"idRanges": [
{
"from": 50800,
"to": 50899
}
],
"features": [
"TranslationFile",
"GenerateCaptions"
],
"resourceExposurePolicy": {
"allowDebugging": true,
"allowDownloadingSource": true,
"includeSourceInSymbolFile": true
},
"source": {},
"build": {},
"internalsVisibleTo": [],
"keyVaultUrls": []
}
54 changes: 54 additions & 0 deletions PegBoardPerformanceTest/bcptSuite.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"code": "10UserTest",
"description": "10 User Test",
"durationInMinutes": 5,
"defaultMinimumUserDelayInMilliSeconds": 120,
"oneDayCorrespondsToInMinutes": 10,
"tag": "10UserTest",
"bcptSuiteLines": [
{
"codeunitID": 50807,
"numberOfSessions": 1,
"description": "BCPT Detail Trial Bal. Report",
"minimumUserDelay": 100,
"maximumUserDelay": 1000,
"delayBetweenIterations": 10,
"delayType": "Fixed",
"runInForeground": false
},
{
"codeunitID": 50803,
"numberOfSessions": 1,
"description": "BCPT Create PO with N Lines",
"minimumUserDelay": 100,
"maximumUserDelay": 1000,
"delayBetweenIterations": 5,
"delayType": "Fixed",
"runInForeground": false,
"parameters": "Lines=10"
},
{
"codeunitID": 50805,
"numberOfSessions": 1,
"description": "BCPT Create SQ with N Lines",
"minimumUserDelay": 100,
"maximumUserDelay": 1000,
"delayBetweenIterations": 5,
"delayType": "Fixed",
"runInForeground": false,
"parameters": "Lines=10"
},
{
"codeunitID": 50804,
"numberOfSessions": 1,
"description": "BCPT Create SO with N Lines",
"minimumUserDelay": 100,
"maximumUserDelay": 1000,
"delayBetweenIterations": 5,
"delayType": "Fixed",
"runInForeground": false,
"parameters": "Lines=10"
}
]
}

21 changes: 21 additions & 0 deletions PegBoardPerformanceTest/src/BCPTAdjustCostItemEntries.Codeunit.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace System.Test.Tooling;

using Microsoft.Inventory.Costing;

codeunit 50823 "BCPT Adjust Cost Item Entries"
{
trigger OnRun()
begin
AdjusCostItemEntries();
end;

local procedure AdjusCostItemEntries()
var
AdjustCostItemEntries: Report "Adjust Cost - Item Entries";
begin
//Adjust and post to GL
AdjustCostItemEntries.SetPostToGL(true);
AdjustCostItemEntries.UseRequestPage(false);
AdjustCostItemEntries.Run();
end;
}
25 changes: 25 additions & 0 deletions PegBoardPerformanceTest/src/BCPTCalculatePlanWorksheet.Codeunit.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
namespace System.Test.Tooling;

using Microsoft.Manufacturing.Planning;

codeunit 50824 "BCPT Calculate Plan Worksheet"
{
trigger OnRun()
begin
CalculatePlan();
end;

local procedure CalculatePlan()
var
CalculatePlanPlanWksh: Report "Calculate Plan - Plan. Wksh.";
StartingDate: Date;
EndingDate: Date;
begin
//Start Calculate regenerative plan of the current month
StartingDate := CalcDate('<-CM>', WorkDate());
EndingDate := CalcDate('<CM>', WorkDate());
CalculatePlanPlanWksh.UseRequestPage(false);
CalculatePlanPlanWksh.InitializeRequest(StartingDate, EndingDate, true);
CalculatePlanPlanWksh.Run();
end;
}
119 changes: 119 additions & 0 deletions PegBoardPerformanceTest/src/BCPTCreatePOWithNLines.Codeunit.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
namespace System.Test.Tooling;

using Microsoft.Foundation.NoSeries;
using Microsoft.Inventory.Item;
using Microsoft.Purchases.Document;
using Microsoft.Purchases.Setup;
using Microsoft.Purchases.Vendor;
using System.Tooling;

codeunit 50803 "BCPT Create PO with N Lines" implements "BCPT Test Param. Provider"
{
SingleInstance = true;

trigger OnRun();
begin
if not IsInitialized or true then begin
InitTest();
IsInitialized := true;
end;
CreatePurchaseOrder(GlobalBCPTTestContext);
end;

var
GlobalBCPTTestContext: Codeunit "BCPT Test Context";
IsInitialized: Boolean;
NoOfLinesParamLbl: Label 'Lines';
ParamValidationErr: Label 'Parameter is not defined in the correct format. The expected format is "%1"', Comment = '%1 = a string';
NoOfLinesToCreate: Integer;


local procedure InitTest();
var
PurchaseSetup: Record "Purchases & Payables Setup";
NoSeriesLine: Record "No. Series Line";
begin
PurchaseSetup.Get();
PurchaseSetup.TestField("Order Nos.");
NoSeriesLine.SetRange("Series Code", PurchaseSetup."Order Nos.");
NoSeriesLine.FindSet(true);
repeat
if NoSeriesLine."Ending No." <> '' then begin
NoSeriesLine."Ending No." := '';
NoSeriesLine.Validate("Allow Gaps in Nos.", true);
NoSeriesLine.Modify(true);
end;
until NoSeriesLine.Next() = 0;
commit();

if Evaluate(NoOfLinesToCreate, GlobalBCPTTestContext.GetParameter(NoOfLinesParamLbl)) then;
end;

local procedure CreatePurchaseOrder(var BCPTTestContext: Codeunit "BCPT Test Context")
var
Vendor: Record Vendor;
Item: Record Item;
PurchaseHeader: Record "Purchase Header";
PurchaseLine: Record "Purchase Line";
i: Integer;
begin
if not Vendor.get('10000') then
Vendor.FindFirst();
if not Item.get('70000') then
Item.FindFirst();
if NoOfLinesToCreate < 0 then
NoOfLinesToCreate := 0;
if NoOfLinesToCreate > 10000 then
NoOfLinesToCreate := 10000;
BCPTTestContext.StartScenario('Add Order');
PurchaseHeader.init();
PurchaseHeader."Document Type" := PurchaseHeader."Document Type"::Order;
PurchaseHeader.Insert(true);
BCPTTestContext.EndScenario('Add Order');
BCPTTestContext.UserWait();
BCPTTestContext.StartScenario('Enter Account No.');
PurchaseHeader.Validate("Buy-from Vendor No.", Vendor."No.");
PurchaseHeader.Modify(true);
Commit();
BCPTTestContext.EndScenario('Enter Account No.');
BCPTTestContext.UserWait();
PurchaseLine."Document Type" := PurchaseHeader."Document Type";
PurchaseLine."Document No." := PurchaseHeader."No.";
for i := 1 to NoOfLinesToCreate do begin
PurchaseLine."Line No." += 10000;
PurchaseLine.Init();
PurchaseLine.Validate(Type, PurchaseLine.Type::Item);
PurchaseLine.Insert(true);
BCPTTestContext.UserWait();
if i = 10 then
BCPTTestContext.StartScenario('Enter Line Item No.');
PurchaseLine.Validate("No.", Item."No.");
if i = 10 then
BCPTTestContext.EndScenario('Enter Line Item No.');
BCPTTestContext.UserWait();
if i = 10 then
BCPTTestContext.StartScenario('Enter Line Quantity');
PurchaseLine.Validate(Quantity, 1);
if i = 10 then
BCPTTestContext.EndScenario('Enter Line Quantity');
PurchaseLine.Modify(true);
Commit();
BCPTTestContext.UserWait();
end;
end;

procedure GetDefaultParameters(): Text[1000]
begin
exit(copystr(NoOfLinesParamLbl + '=' + Format(10), 1, 1000));
end;

procedure ValidateParameters(Parameters: Text[1000])
begin
if StrPos(Parameters, NoOfLinesParamLbl) > 0 then begin
Parameters := DelStr(Parameters, 1, StrLen(NoOfLinesParamLbl + '='));
if Evaluate(NoOfLinesToCreate, Parameters) then
exit;
end;
Error(ParamValidationErr, GetDefaultParameters());
end;
}
124 changes: 124 additions & 0 deletions PegBoardPerformanceTest/src/BCPTCreateSOWithNLines.Codeunit.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
namespace System.Test.Tooling;

using Microsoft.Foundation.NoSeries;
using Microsoft.Inventory.Item;
using Microsoft.Sales.Customer;
using Microsoft.Sales.Document;
using Microsoft.Sales.Setup;
using System.Tooling;

codeunit 50804 "BCPT Create SO with N Lines" implements "BCPT Test Param. Provider"
{
SingleInstance = true;

trigger OnRun();
begin
if not IsInitialized then begin
InitTest();
IsInitialized := true;
end;
CreateSalesOrder(GlobalBCPTTestContext);
end;

var
GlobalBCPTTestContext: Codeunit "BCPT Test Context";
IsInitialized: Boolean;
NoOfLinesToCreate: Integer;
NoOfLinesParamLbl: Label 'Lines';
ParamValidationErr: Label 'Parameter is not defined in the correct format. The expected format is "%1"', Comment = '%1 = a string';


local procedure InitTest();
var
SalesSetup: Record "Sales & Receivables Setup";
NoSeriesLine: Record "No. Series Line";
begin
SalesSetup.Get();
SalesSetup.TestField("Order Nos.");
NoSeriesLine.SetRange("Series Code", SalesSetup."Order Nos.");
NoSeriesLine.FindSet(true);
repeat
if NoSeriesLine."Ending No." <> '' then begin
NoSeriesLine."Ending No." := '';
NoSeriesLine.Validate("Allow Gaps in Nos.", true);
NoSeriesLine.Modify(true);
end;
until NoSeriesLine.Next() = 0;
commit();

if Evaluate(NoOfLinesToCreate, GlobalBCPTTestContext.GetParameter(NoOfLinesParamLbl)) then;
end;

local procedure CreateSalesOrder(var BCPTTestContext: Codeunit "BCPT Test Context")
var
Customer: Record Customer;
Item: Record Item;
SalesHeader: Record "Sales Header";
SalesLine: Record "Sales Line";
i: Integer;
begin
if not Customer.get('10000') then
Customer.FindFirst();
if not item.get('70000') then
Item.FindSet();
if NoOfLinesToCreate < 0 then
NoOfLinesToCreate := 0;
if NoOfLinesToCreate > 10000 then
NoOfLinesToCreate := 10000;
BCPTTestContext.StartScenario('Add Order');
SalesHeader.Init();
SalesHeader."Document Type" := SalesHeader."Document Type"::Order;
SalesHeader.Insert(true);
Commit();
BCPTTestContext.EndScenario('Add Order');
BCPTTestContext.UserWait();
BCPTTestContext.StartScenario('Enter Account No.');
SalesHeader.Validate("Sell-to Customer No.", Customer."No.");
SalesHeader.Modify(true);
Commit();
BCPTTestContext.EndScenario('Enter Account No.');
BCPTTestContext.UserWait();
SalesLine."Document Type" := SalesHeader."Document Type";
SalesLine."Document No." := SalesHeader."No.";
for i := 1 to NoOfLinesToCreate do begin
SalesLine."Line No." += 10000;
SalesLine.Init();
SalesLine.Validate(Type, SalesLine.Type::Item);
SalesLine.Insert(true);
BCPTTestContext.UserWait();
if i = 1 then
BCPTTestContext.StartScenario('Enter Line Item No.');
SalesLine.Validate("No.", Item."No.");
if i = 1 then
BCPTTestContext.EndScenario('Enter Line Item No.');
BCPTTestContext.UserWait();
if i = 1 then
BCPTTestContext.StartScenario('Enter Line Quantity');
SalesLine.Validate(Quantity, 1);
SalesLine.Modify(true);
if i = 1 then
BCPTTestContext.EndScenario('Enter Line Quantity');
BCPTTestContext.UserWait();
if i mod 2 = 0 then
if Item.Next() = 0 then
#pragma warning disable AA0181, AA0175
Item.FindSet();
#pragma warning restore AA0181, AA0175
end;
end;

procedure GetDefaultParameters(): Text[1000]
begin
exit(copystr(NoOfLinesParamLbl + '=' + Format(10), 1, 1000));
end;

procedure ValidateParameters(Parameters: Text[1000])
begin
if StrPos(Parameters, NoOfLinesParamLbl) > 0 then begin
Parameters := DelStr(Parameters, 1, StrLen(NoOfLinesParamLbl + '='));
if Evaluate(NoOfLinesToCreate, Parameters) then
exit;
end;
Error(ParamValidationErr, GetDefaultParameters());
end;
}
Loading