generated from microsoft/AL-Go-PTE
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New Performance Test App (Peg Board PerformanceTest)
- Loading branch information
1 parent
6ed5533
commit 8e72e6a
Showing
35 changed files
with
2,861 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"id": "0dd946b2-f463-47b6-8c9b-eb6f1e91a93d", | ||
"name": "Peg Board PerformanceTest", | ||
"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": "25.0.0.0", | ||
"application": "25.0.0.0", | ||
"runtime": "14.0", | ||
"logo": "", | ||
"url": "", | ||
"EULA": "", | ||
"privacyStatement": "", | ||
"help": "", | ||
"target": "Cloud", | ||
"screenshots": [], | ||
"dependencies": [ | ||
{ | ||
"id": "75f1590f-55c5-4501-ae63-bada5534e852", | ||
"publisher": "Microsoft", | ||
"name": "Performance Toolkit", | ||
"version": "25.0.0.0" | ||
}, | ||
{ | ||
"id": "5d86850b-0d76-4eca-bd7b-951ad998e997", | ||
"publisher": "Microsoft", | ||
"name": "Tests-TestLibraries", | ||
"version": "25.0.0.0" | ||
} | ||
], | ||
"idRanges": [ | ||
{ | ||
"from": 50800, | ||
"to": 50899 | ||
} | ||
], | ||
"features": [ | ||
"TranslationFile", | ||
"GenerateCaptions" | ||
], | ||
"resourceExposurePolicy": { | ||
"allowDebugging": true, | ||
"allowDownloadingSource": true, | ||
"includeSourceInSymbolFile": true | ||
}, | ||
"source": { | ||
"repositoryUrl": "https://github.com/microsoft/BCApps", | ||
"commit": "de3b663d4c9ecd6b92b7ecaf5f23935a47d5634c" | ||
}, | ||
"build": {}, | ||
"internalsVisibleTo": [], | ||
"keyVaultUrls": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
21
Peg Board PerformanceTest/src/BCPTAdjustCostItemEntries.Codeunit.al
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
25
Peg Board PerformanceTest/src/BCPTCalculatePlanWorksheet.Codeunit.al
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
154 changes: 154 additions & 0 deletions
154
Peg Board PerformanceTest/src/BCPTCreateCustomer.Codeunit.al
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
namespace System.Test.Tooling; | ||
|
||
using System.Tooling; | ||
using Microsoft.Sales.Setup; | ||
using Microsoft.Foundation.NoSeries; | ||
using Microsoft.Sales.Customer; | ||
using Microsoft.CRM.BusinessRelation; | ||
using Microsoft.Finance.GeneralLedger.Setup; | ||
using Microsoft.Finance.VAT.Setup; | ||
using Microsoft.Foundation.PaymentTerms; | ||
using Microsoft.Bank.BankAccount; | ||
|
||
codeunit 50826 "BCPT Create Customer" implements "BCPT Test Param. Provider" | ||
{ | ||
trigger OnRun() | ||
begin | ||
InitTest(); | ||
CreateCustomer(); | ||
end; | ||
|
||
var | ||
BCPTTestContext: Codeunit "BCPT Test Context"; | ||
CustomerTemplateToUse: Code[20]; | ||
CustomerTemplateParamLbl: Label 'Customer Template'; | ||
ParamValidationErr: Label 'Parameter is not defined in the correct format. The expected format is "%1"', Comment = '%1 = Default Parameter'; | ||
|
||
local procedure InitTest() | ||
var | ||
SalesReceivablesSetup: Record "Sales & Receivables Setup"; | ||
NoSeriesLine: Record "No. Series Line"; | ||
RecordModified: Boolean; | ||
begin | ||
SalesReceivablesSetup.Get(); | ||
SalesReceivablesSetup.TestField("Customer Nos."); | ||
NoSeriesLine.SetRange("Series Code", SalesReceivablesSetup."Customer Nos."); | ||
NoSeriesLine.FindSet(true); | ||
repeat | ||
if NoSeriesLine."Ending No." <> '' then begin | ||
NoSeriesLine."Ending No." := ''; | ||
NoSeriesLine.Validate(Implementation, NoSeriesLine.Implementation::Sequence); | ||
NoSeriesLine.Modify(true); | ||
RecordModified := true; | ||
end; | ||
until NoSeriesLine.Next() = 0; | ||
|
||
if RecordModified then | ||
Commit(); //Commit to avoid deadlocks | ||
|
||
if Evaluate(CustomerTemplateToUse, BCPTTestContext.GetParameter(CustomerTemplateParamLbl)) then; | ||
end; | ||
|
||
local procedure CreateCustomer() | ||
var | ||
Customer: Record Customer; | ||
CustomerTempl: Record "Customer Templ."; | ||
CustContUpdate: Codeunit "CustCont-Update"; | ||
CustomerTemplMgt: Codeunit "Customer Templ. Mgt."; | ||
begin | ||
Clear(Customer); | ||
Customer.Insert(true); | ||
Customer.Validate(Name, Customer."No."); | ||
|
||
if CustomerTemplateToUse <> '' then begin | ||
CustomerTempl.Get(CustomerTemplateToUse); | ||
CustomerTemplMgt.ApplyCustomerTemplate(Customer, CustomerTempl) | ||
end else begin | ||
Customer.Validate("Gen. Bus. Posting Group", LookUpGenBusPostingGroup()); | ||
Customer.Validate("VAT Bus. Posting Group", FindVATPostingSetup()); | ||
Customer.Validate("Customer Posting Group", FindCustomerPostingGroup()); | ||
Customer.Validate("Payment Terms Code", FindPaymentTermsCode()); | ||
Customer.Validate("Payment Method Code", FindPaymentMethod()); | ||
Customer.Modify(true); | ||
end; | ||
Commit(); //Commit to avoid deadlocks | ||
CustContUpdate.OnModify(Customer); | ||
|
||
OnAfterCreateCustomer(Customer); | ||
Commit(); //Commit to avoid deadlocks | ||
end; | ||
|
||
local procedure LookUpGenBusPostingGroup(): Code[20] | ||
var | ||
GeneralPostingSetup: Record "General Posting Setup"; | ||
begin | ||
GeneralPostingSetup.Reset(); | ||
GeneralPostingSetup.SetFilter("Gen. Prod. Posting Group", '<>%1', ''); | ||
GeneralPostingSetup.SetFilter("Purch. Account", '<>%1', ''); | ||
if GeneralPostingSetup.FindFirst() then | ||
exit(GeneralPostingSetup."Gen. Bus. Posting Group"); | ||
end; | ||
|
||
local procedure FindCustomerPostingGroup(): Code[20] | ||
var | ||
CustomerPostingGroup: Record "Customer Posting Group"; | ||
begin | ||
CustomerPostingGroup.SetFilter("Receivables Account", '<>%1', ''); | ||
if CustomerPostingGroup.FindFirst() then | ||
exit(CustomerPostingGroup.Code); | ||
end; | ||
|
||
local procedure FindVATPostingSetup(): Code[20] | ||
var | ||
VATPostingSetup: Record "VAT Posting Setup"; | ||
begin | ||
VATPostingSetup.SetFilter("VAT Prod. Posting Group", '<>%1', ''); | ||
VATPostingSetup.SetFilter("VAT %", '<>%1', 0); | ||
VATPostingSetup.SetRange("VAT Calculation Type", VATPostingSetup."VAT Calculation Type"::"Normal VAT"); | ||
VATPostingSetup.SetFilter("Sales VAT Account", '<>%1', ''); | ||
if VATPostingSetup.FindFirst() then | ||
exit(VATPostingSetup."VAT Bus. Posting Group"); | ||
end; | ||
|
||
local procedure FindPaymentTermsCode(): Code[10] | ||
var | ||
PaymentTerms: Record "Payment Terms"; | ||
DateFormular_0D: DateFormula; | ||
begin | ||
Evaluate(DateFormular_0D, '<0D>'); | ||
|
||
if PaymentTerms.FieldActive("Due Date Calculation") then | ||
PaymentTerms.SetRange("Due Date Calculation", DateFormular_0D); | ||
if PaymentTerms.FindFirst() then | ||
exit(PaymentTerms.Code); | ||
end; | ||
|
||
local procedure FindPaymentMethod(): Code[10] | ||
var | ||
PaymentMethod: Record "Payment Method"; | ||
begin | ||
PaymentMethod.SetRange("Bal. Account No.", ''); | ||
if PaymentMethod.FindFirst() then | ||
exit(PaymentMethod.Code) | ||
end; | ||
|
||
procedure GetDefaultParameters(): Text[1000] | ||
begin | ||
exit(CopyStr(CustomerTemplateParamLbl + '=', 1, 1000)); | ||
end; | ||
|
||
procedure ValidateParameters(Parameters: Text[1000]) | ||
begin | ||
if StrPos(Parameters, CustomerTemplateParamLbl) > 0 then begin | ||
Parameters := DelStr(Parameters, 1, StrLen(CustomerTemplateParamLbl + '=')); | ||
if Evaluate(CustomerTemplateToUse, Parameters) then | ||
exit; | ||
end; | ||
Error(ParamValidationErr, GetDefaultParameters()); | ||
end; | ||
|
||
[IntegrationEvent(false, false)] | ||
local procedure OnAfterCreateCustomer(var Customer: Record Customer) | ||
begin | ||
end; | ||
} |
Oops, something went wrong.