From 8cb7fdd2206924c4f696d86487f94b6b762ea5a2 Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Wed, 22 Oct 2025 15:07:25 +0200 Subject: [PATCH 01/21] Switch to setup data --- build/scripts/ImportTestDataInBcContainer.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/scripts/ImportTestDataInBcContainer.ps1 b/build/scripts/ImportTestDataInBcContainer.ps1 index 4cad98967f..7f32f234c6 100644 --- a/build/scripts/ImportTestDataInBcContainer.ps1 +++ b/build/scripts/ImportTestDataInBcContainer.ps1 @@ -8,7 +8,7 @@ function Invoke-ContosoDemoTool() { param( [string]$ContainerName, [string]$CompanyName = (Get-NavDefaultCompanyName -ContainerName $ContainerName), - [switch]$SetupData = $false + [switch]$SetupData ) Write-Host "Initializing company in container $ContainerName" Invoke-NavContainerCodeunit -Codeunitid 2 -containerName $ContainerName -CompanyName $CompanyName @@ -64,4 +64,4 @@ foreach ($app in (Get-BcContainerAppInfo -containerName $ContainerName -tenantSp } # Generate demo data in the container -Invoke-ContosoDemoTool -ContainerName $parameters.ContainerName +Invoke-ContosoDemoTool -ContainerName $parameters.ContainerName -SetupData From 09df974e95e9c7db7aeb25fe44dcb5d8b4152c1f Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Wed, 22 Oct 2025 15:33:21 +0200 Subject: [PATCH 02/21] Add unittests job --- build/projects/Apps (W1)/.AL-Go/settings.json | 11 ++++++++++- build/scripts/ImportTestDataInBcContainer.ps1 | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/build/projects/Apps (W1)/.AL-Go/settings.json b/build/projects/Apps (W1)/.AL-Go/settings.json index ac527b6fe4..163a92bb56 100644 --- a/build/projects/Apps (W1)/.AL-Go/settings.json +++ b/build/projects/Apps (W1)/.AL-Go/settings.json @@ -37,7 +37,8 @@ "NO", "NZ", "SE", - "US" + "US", + "UnitTests" ], "ConditionalSettings": [ { @@ -224,6 +225,14 @@ "doNotPublishApps": true } }, + { + "buildModes": [ + "UnitTests" + ], + "settings": { + "doNotImportTestData": true + } + }, { "branches": [ "releases/*.[0-5]" diff --git a/build/scripts/ImportTestDataInBcContainer.ps1 b/build/scripts/ImportTestDataInBcContainer.ps1 index 4cad98967f..28ed8f9447 100644 --- a/build/scripts/ImportTestDataInBcContainer.ps1 +++ b/build/scripts/ImportTestDataInBcContainer.ps1 @@ -63,5 +63,23 @@ foreach ($app in (Get-BcContainerAppInfo -containerName $ContainerName -tenantSp Write-Host "App: $($app.Name) ($($app.Version)) - Scope: $($app.Scope) - $($app.IsInstalled) / $($app.IsPublished)" } +if ($null -ne $env:settings) { + Write-Host "AL-Go settings found in environment variable" + $alGoSettings = $env:settings | ConvertFrom-Json + if ($alGoSettings.PSObject.Properties.Name -contains "doNotImportTestData") { + if ($alGoSettings.doNotImportTestData -eq $true) { + Write-Host "Skipping demo data generation as doNotImportTestData is set to true in AL-Go settings" + return + } else { + Write-Host "doNotImportTestData is set to false in AL-Go settings. Proceeding with demo data generation." + } + } else { + Write-Host "doNotImportTestData not found in AL-Go settings. Proceeding with demo data generation." + } +} else { + Write-Host "No AL-Go settings found in environment variable. Proceeding with demo data generation." +} + + # Generate demo data in the container Invoke-ContosoDemoTool -ContainerName $parameters.ContainerName From 82b4fd2068d6bdd9f76b663eba40b351427fafeb Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Wed, 22 Oct 2025 17:09:33 +0200 Subject: [PATCH 03/21] UnitTest --- .../Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 b/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 index 1637222d85..3a1fe7b776 100644 --- a/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 +++ b/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 @@ -2,5 +2,23 @@ Param( [Hashtable]$parameters ) + +if ($null -ne $env:settings) { + Write-Host "AL-Go settings found in environment variable" + $alGoSettings = $env:settings | ConvertFrom-Json + if ($alGoSettings.PSObject.Properties.Name -contains "doNotImportTestData") { + if ($alGoSettings.doNotImportTestData -eq $true) { + Write-Host "Using test type UnitTest as doNotImportTestData is set to true in AL-Go settings" + $parameters["testType"] = "UnitTest" + } else { + Write-Host "doNotImportTestData is set to false in AL-Go settings. Using default test type." + } + } else { + Write-Host "doNotImportTestData not found in AL-Go settings. Using default test type." + } +} else { + Write-Host "No AL-Go settings found in environment variable. Using default test type." +} + $script = Join-Path $PSScriptRoot "../../../scripts/RunTestsInBcContainer.ps1" -Resolve . $script -parameters $parameters \ No newline at end of file From 9cf6bd828aca924734e0c209d383578f5cbdbac5 Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Wed, 22 Oct 2025 19:16:36 +0200 Subject: [PATCH 04/21] Update scripts --- .../Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 | 13 ++++--------- build/scripts/ImportTestDataInBcContainer.ps1 | 13 ++++--------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 b/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 index 3a1fe7b776..a46910c714 100644 --- a/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 +++ b/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 @@ -4,17 +4,12 @@ Param( if ($null -ne $env:settings) { - Write-Host "AL-Go settings found in environment variable" $alGoSettings = $env:settings | ConvertFrom-Json - if ($alGoSettings.PSObject.Properties.Name -contains "doNotImportTestData") { - if ($alGoSettings.doNotImportTestData -eq $true) { - Write-Host "Using test type UnitTest as doNotImportTestData is set to true in AL-Go settings" - $parameters["testType"] = "UnitTest" - } else { - Write-Host "doNotImportTestData is set to false in AL-Go settings. Using default test type." - } + if (($alGoSettings.PSObject.Properties.Name -contains "doNotImportTestData") -and ($alGoSettings.doNotImportTestData -eq $true)) { + Write-Host "Using test type UnitTest as doNotImportTestData is set to true in AL-Go settings" + $parameters["testType"] = "UnitTest" } else { - Write-Host "doNotImportTestData not found in AL-Go settings. Using default test type." + Write-Host "doNotImportTestData not found in AL-Go settings or is set to false. Using default test type." } } else { Write-Host "No AL-Go settings found in environment variable. Using default test type." diff --git a/build/scripts/ImportTestDataInBcContainer.ps1 b/build/scripts/ImportTestDataInBcContainer.ps1 index 28ed8f9447..bf283a4bce 100644 --- a/build/scripts/ImportTestDataInBcContainer.ps1 +++ b/build/scripts/ImportTestDataInBcContainer.ps1 @@ -64,17 +64,12 @@ foreach ($app in (Get-BcContainerAppInfo -containerName $ContainerName -tenantSp } if ($null -ne $env:settings) { - Write-Host "AL-Go settings found in environment variable" $alGoSettings = $env:settings | ConvertFrom-Json - if ($alGoSettings.PSObject.Properties.Name -contains "doNotImportTestData") { - if ($alGoSettings.doNotImportTestData -eq $true) { - Write-Host "Skipping demo data generation as doNotImportTestData is set to true in AL-Go settings" - return - } else { - Write-Host "doNotImportTestData is set to false in AL-Go settings. Proceeding with demo data generation." - } + if (($alGoSettings.PSObject.Properties.Name -contains "doNotImportTestData") -and ($alGoSettings.doNotImportTestData -eq $true)) { + Write-Host "Skipping demo data generation as doNotImportTestData is set to true in AL-Go settings" + return } else { - Write-Host "doNotImportTestData not found in AL-Go settings. Proceeding with demo data generation." + Write-Host "doNotImportTestData not found in AL-Go settings or is set to false. Proceeding with demo data generation." } } else { Write-Host "No AL-Go settings found in environment variable. Proceeding with demo data generation." From 6cbfc70e2f5f7f09513c9d0d0b4bc57aa31dab63 Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Wed, 22 Oct 2025 19:17:32 +0200 Subject: [PATCH 05/21] Disable E-Doc unit tests --- .../DisabledTests/EDocPOMatchingUnitTests.DisabledTest.json | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/Apps/W1/EDocument/Test/DisabledTests/EDocPOMatchingUnitTests.DisabledTest.json diff --git a/src/Apps/W1/EDocument/Test/DisabledTests/EDocPOMatchingUnitTests.DisabledTest.json b/src/Apps/W1/EDocument/Test/DisabledTests/EDocPOMatchingUnitTests.DisabledTest.json new file mode 100644 index 0000000000..3c564abe2d --- /dev/null +++ b/src/Apps/W1/EDocument/Test/DisabledTests/EDocPOMatchingUnitTests.DisabledTest.json @@ -0,0 +1,6 @@ +{ + "codeunitId": 133508, + "codeunitName": "E-Doc. PO Matching Unit Tests", + "method": "*", + "bug": "610664" +} \ No newline at end of file From d1f2406e2c3353b234c336cef4c6d24e7c3722db Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Thu, 23 Oct 2025 11:45:27 +0200 Subject: [PATCH 06/21] Run as integration tests --- .../.AL-Go/RunTestsInBcContainer.ps1 | 13 ---------- build/projects/Apps (W1)/.AL-Go/settings.json | 11 +++++++- build/scripts/ImportTestDataInBcContainer.ps1 | 25 +++++++++++-------- build/scripts/RunTestsInBcContainer.ps1 | 8 ++++++ 4 files changed, 33 insertions(+), 24 deletions(-) diff --git a/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 b/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 index a46910c714..1637222d85 100644 --- a/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 +++ b/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 @@ -2,18 +2,5 @@ Param( [Hashtable]$parameters ) - -if ($null -ne $env:settings) { - $alGoSettings = $env:settings | ConvertFrom-Json - if (($alGoSettings.PSObject.Properties.Name -contains "doNotImportTestData") -and ($alGoSettings.doNotImportTestData -eq $true)) { - Write-Host "Using test type UnitTest as doNotImportTestData is set to true in AL-Go settings" - $parameters["testType"] = "UnitTest" - } else { - Write-Host "doNotImportTestData not found in AL-Go settings or is set to false. Using default test type." - } -} else { - Write-Host "No AL-Go settings found in environment variable. Using default test type." -} - $script = Join-Path $PSScriptRoot "../../../scripts/RunTestsInBcContainer.ps1" -Resolve . $script -parameters $parameters \ No newline at end of file diff --git a/build/projects/Apps (W1)/.AL-Go/settings.json b/build/projects/Apps (W1)/.AL-Go/settings.json index 163a92bb56..44ecdc593e 100644 --- a/build/projects/Apps (W1)/.AL-Go/settings.json +++ b/build/projects/Apps (W1)/.AL-Go/settings.json @@ -16,6 +16,7 @@ "installOnlyReferencedApps": false, "doNotRunPageScriptingTests": true, "doNotRunBcptTests": true, + "testType": "IntegrationTest", "buildModes": [ "AT", "AU", @@ -230,7 +231,15 @@ "UnitTests" ], "settings": { - "doNotImportTestData": true + "testType": "UnitTest" + } + }, + { + "buildModes": [ + "UncategorizedTests" + ], + "settings": { + "testType": "Uncategorized" } }, { diff --git a/build/scripts/ImportTestDataInBcContainer.ps1 b/build/scripts/ImportTestDataInBcContainer.ps1 index 6cff01784d..f3f2808745 100644 --- a/build/scripts/ImportTestDataInBcContainer.ps1 +++ b/build/scripts/ImportTestDataInBcContainer.ps1 @@ -65,16 +65,21 @@ foreach ($app in (Get-BcContainerAppInfo -containerName $ContainerName -tenantSp if ($null -ne $env:settings) { $alGoSettings = $env:settings | ConvertFrom-Json - if (($alGoSettings.PSObject.Properties.Name -contains "doNotImportTestData") -and ($alGoSettings.doNotImportTestData -eq $true)) { - Write-Host "Skipping demo data generation as doNotImportTestData is set to true in AL-Go settings" - return - } else { - Write-Host "doNotImportTestData not found in AL-Go settings or is set to false. Proceeding with demo data generation." + if ($alGoSettings.PSObject.Properties.Name -contains "testType") { + if ($alGoSettings.testType -eq "UnitTest") { + Write-Host "Skipping demo data generation as test type is set to UnitTest in AL-Go settings" + return + } elseif( $alGoSettings.testType -eq "IntegrationTest" ) { + Write-Host "Proceeding with demo data generation (SetupData) as test type is set to IntegrationTest in AL-Go settings" + Invoke-ContosoDemoTool -ContainerName $parameters.ContainerName -SetupData + } elseif( $alGoSettings.testType -eq "Uncategorized" ) { + Write-Host "Proceeding with full demo data generation as test type is set to E2ETest in AL-Go settings" + Invoke-ContosoDemoTool -ContainerName $parameters.ContainerName + } else { + throw "Unknown test type $($alGoSettings.testType) in AL-Go settings." + } } } else { - Write-Host "No AL-Go settings found in environment variable. Proceeding with demo data generation." + Write-Host "No Test Type found in AL-Go settings. Setting up SetupData." + Invoke-ContosoDemoTool -ContainerName $parameters.ContainerName -SetupData } - - -# Generate demo data in the container -Invoke-ContosoDemoTool -ContainerName $parameters.ContainerName -SetupData diff --git a/build/scripts/RunTestsInBcContainer.ps1 b/build/scripts/RunTestsInBcContainer.ps1 index abd996e219..d10c2b31b1 100644 --- a/build/scripts/RunTestsInBcContainer.ps1 +++ b/build/scripts/RunTestsInBcContainer.ps1 @@ -58,6 +58,14 @@ if ($DisableTestIsolation) $parameters["testRunnerCodeunitId"] = "130451" # Test Runner with disabled test isolation } +if ($null -ne $env:settings) { + $alGoSettings = $env:settings | ConvertFrom-Json + if ($alGoSettings.PSObject.Properties.Name -contains "testType") { + Write-Host "Using test type $($alGoSettings.testType)" + $parameters["testType"] = $alGoSettings.testType + } +} + $parameters["disabledTests"] = @(Get-DisabledTests) # Add disabled tests to parameters $parameters["renewClientContextBetweenTests"] = $true From cf5105fb5432557198ba4bc7286d8bd5dbe5fc51 Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Thu, 23 Oct 2025 11:57:30 +0200 Subject: [PATCH 07/21] Add UncategorizedTests build mode --- build/projects/Apps (W1)/.AL-Go/settings.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/projects/Apps (W1)/.AL-Go/settings.json b/build/projects/Apps (W1)/.AL-Go/settings.json index 44ecdc593e..3d036e05f0 100644 --- a/build/projects/Apps (W1)/.AL-Go/settings.json +++ b/build/projects/Apps (W1)/.AL-Go/settings.json @@ -39,7 +39,8 @@ "NZ", "SE", "US", - "UnitTests" + "UnitTests", + "UncategorizedTests" ], "ConditionalSettings": [ { From 78b9f442441232fafd74cbe0d9fa53517278861a Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Thu, 23 Oct 2025 15:58:50 +0200 Subject: [PATCH 08/21] Enable tests in all countries except DK and CZ --- build/projects/Apps (W1)/.AL-Go/settings.json | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/build/projects/Apps (W1)/.AL-Go/settings.json b/build/projects/Apps (W1)/.AL-Go/settings.json index 3d036e05f0..2e422330dd 100644 --- a/build/projects/Apps (W1)/.AL-Go/settings.json +++ b/build/projects/Apps (W1)/.AL-Go/settings.json @@ -56,8 +56,7 @@ "AU" ], "settings": { - "country": "au", - "doNotRunTests": true + "country": "au" } }, { @@ -73,8 +72,7 @@ "CA" ], "settings": { - "country": "ca", - "doNotRunTests": true + "country": "ca" } }, { @@ -164,8 +162,7 @@ "IT" ], "settings": { - "country": "it", - "doNotRunTests": true + "country": "it" } }, { @@ -213,8 +210,7 @@ "US" ], "settings": { - "country": "us", - "doNotRunTests": true + "country": "us" } }, { From 96b0d110950b6bdd187332a740f7f24a1c798a78 Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Fri, 24 Oct 2025 09:01:09 +0200 Subject: [PATCH 09/21] Small refactor --- build/scripts/EnlistmentHelperFunctions.psm1 | 25 ++++++++++ build/scripts/ImportTestDataInBcContainer.ps1 | 46 +++++++++++-------- build/scripts/RunTestsInBcContainer.ps1 | 10 ++-- 3 files changed, 55 insertions(+), 26 deletions(-) diff --git a/build/scripts/EnlistmentHelperFunctions.psm1 b/build/scripts/EnlistmentHelperFunctions.psm1 index e159282a19..6b5edb1bcb 100644 --- a/build/scripts/EnlistmentHelperFunctions.psm1 +++ b/build/scripts/EnlistmentHelperFunctions.psm1 @@ -611,5 +611,30 @@ function Get-AppsInFolder() { return $apps } +<# + .SYNOPSIS + Gets a setting from the AL-Go settings environment variable set during GitHub Actions runs. + .DESCRIPTION + This function retrieves a setting from the AL-Go settings stored in the environment variable 'settings'. + It returns the value of the specified key, or $null if the key does not exist. + .PARAMETER Key + The key of the setting to retrieve. + .OUTPUTS + The value of the specified setting key, or $null if the key does not exist. +#> +function Get-ALGoSetting() { + param( + [Parameter(Mandatory=$true)] + [string] $Key + ) + if ($null -ne $env:settings) { + $alGoSettings = $env:settings | ConvertFrom-Json + if ($alGoSettings.PSObject.Properties.Name -contains $Key) { + return $alGoSettings.$Key + } + } + return $null +} + Export-ModuleMember -Function *-* Export-ModuleMember -Function RunAndCheck diff --git a/build/scripts/ImportTestDataInBcContainer.ps1 b/build/scripts/ImportTestDataInBcContainer.ps1 index f3f2808745..34460dc3cf 100644 --- a/build/scripts/ImportTestDataInBcContainer.ps1 +++ b/build/scripts/ImportTestDataInBcContainer.ps1 @@ -3,6 +3,7 @@ Param( ) Import-Module $PSScriptRoot\AppExtensionsHelper.psm1 +Import-Module $PSScriptRoot\EnlistmentHelperFunctions.psm1 function Invoke-ContosoDemoTool() { param( @@ -45,6 +46,30 @@ function Get-NavDefaultCompanyName throw "No Cronus company found in container $ContainerName.." } +function Invoke-DemoDataGeneration +{ + param( + [Parameter(Mandatory=$true)] + [string]$ContainerName, + [Parameter(Mandatory=$true)] + [ValidateSet("UnitTest","IntegrationTest","Uncategorized")] + [string]$TestType + ) + if ($TestType -eq "UnitTest") { + Write-Host "Skipping demo data generation as test type is set to UnitTest" + return + } elseif( $TestType -eq "IntegrationTest" ) { + Write-Host "Proceeding with demo data generation (SetupData) as test type is set to IntegrationTest" + Invoke-ContosoDemoTool -ContainerName $ContainerName -SetupData + } elseif( $TestType -eq "Uncategorized" ) { + Write-Host "Proceeding with full demo data generation as test type is set to Uncategorized" + Invoke-ContosoDemoTool -ContainerName $ContainerName + } else { + throw "Unknown test type $TestType." + } + +} + # Reinstall all the uninstalled apps in the container # This is needed to ensure that the various Demo Data apps are installed in the container when we generate demo data $allUninstalledApps = Get-BcContainerAppInfo -containerName $parameters.ContainerName -tenantSpecificProperties -sort DependenciesFirst | Where-Object { $_.IsInstalled -eq $false } @@ -63,23 +88,4 @@ foreach ($app in (Get-BcContainerAppInfo -containerName $ContainerName -tenantSp Write-Host "App: $($app.Name) ($($app.Version)) - Scope: $($app.Scope) - $($app.IsInstalled) / $($app.IsPublished)" } -if ($null -ne $env:settings) { - $alGoSettings = $env:settings | ConvertFrom-Json - if ($alGoSettings.PSObject.Properties.Name -contains "testType") { - if ($alGoSettings.testType -eq "UnitTest") { - Write-Host "Skipping demo data generation as test type is set to UnitTest in AL-Go settings" - return - } elseif( $alGoSettings.testType -eq "IntegrationTest" ) { - Write-Host "Proceeding with demo data generation (SetupData) as test type is set to IntegrationTest in AL-Go settings" - Invoke-ContosoDemoTool -ContainerName $parameters.ContainerName -SetupData - } elseif( $alGoSettings.testType -eq "Uncategorized" ) { - Write-Host "Proceeding with full demo data generation as test type is set to E2ETest in AL-Go settings" - Invoke-ContosoDemoTool -ContainerName $parameters.ContainerName - } else { - throw "Unknown test type $($alGoSettings.testType) in AL-Go settings." - } - } -} else { - Write-Host "No Test Type found in AL-Go settings. Setting up SetupData." - Invoke-ContosoDemoTool -ContainerName $parameters.ContainerName -SetupData -} +Invoke-DemoDataGeneration -ContainerName $parameters.ContainerName -TestType (Get-ALGoSetting -Key "testType") \ No newline at end of file diff --git a/build/scripts/RunTestsInBcContainer.ps1 b/build/scripts/RunTestsInBcContainer.ps1 index d10c2b31b1..7739f4686d 100644 --- a/build/scripts/RunTestsInBcContainer.ps1 +++ b/build/scripts/RunTestsInBcContainer.ps1 @@ -58,12 +58,10 @@ if ($DisableTestIsolation) $parameters["testRunnerCodeunitId"] = "130451" # Test Runner with disabled test isolation } -if ($null -ne $env:settings) { - $alGoSettings = $env:settings | ConvertFrom-Json - if ($alGoSettings.PSObject.Properties.Name -contains "testType") { - Write-Host "Using test type $($alGoSettings.testType)" - $parameters["testType"] = $alGoSettings.testType - } +$testType = Get-ALGoSetting -Key "testType" +if ($null -ne $testType) { + Write-Host "Using test type $testType" + $parameters["testType"] = $testType } $parameters["disabledTests"] = @(Get-DisabledTests) # Add disabled tests to parameters From 766187233902fe57834fa1903b0d4d4c07106f32 Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Fri, 24 Oct 2025 10:08:31 +0200 Subject: [PATCH 10/21] psscriptanalyzer --- build/scripts/ImportTestDataInBcContainer.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/scripts/ImportTestDataInBcContainer.ps1 b/build/scripts/ImportTestDataInBcContainer.ps1 index 34460dc3cf..c14bdb14c2 100644 --- a/build/scripts/ImportTestDataInBcContainer.ps1 +++ b/build/scripts/ImportTestDataInBcContainer.ps1 @@ -51,7 +51,7 @@ function Invoke-DemoDataGeneration param( [Parameter(Mandatory=$true)] [string]$ContainerName, - [Parameter(Mandatory=$true)] + [Parameter(Mandatory=$true)] [ValidateSet("UnitTest","IntegrationTest","Uncategorized")] [string]$TestType ) From 24625332cbcd9c7d40f187f36a88243b60cdad90 Mon Sep 17 00:00:00 2001 From: Alexander Holstrup <117829001+aholstrup1@users.noreply.github.com> Date: Fri, 24 Oct 2025 12:54:47 +0200 Subject: [PATCH 11/21] Update build/scripts/ImportTestDataInBcContainer.ps1 Co-authored-by: Sun Haoran --- build/scripts/ImportTestDataInBcContainer.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/scripts/ImportTestDataInBcContainer.ps1 b/build/scripts/ImportTestDataInBcContainer.ps1 index c14bdb14c2..57cb53e4ab 100644 --- a/build/scripts/ImportTestDataInBcContainer.ps1 +++ b/build/scripts/ImportTestDataInBcContainer.ps1 @@ -56,7 +56,7 @@ function Invoke-DemoDataGeneration [string]$TestType ) if ($TestType -eq "UnitTest") { - Write-Host "Skipping demo data generation as test type is set to UnitTest" + Write-Host "UnitTest shouldn't have dependency on any Demo Data, skipping demo data generation" return } elseif( $TestType -eq "IntegrationTest" ) { Write-Host "Proceeding with demo data generation (SetupData) as test type is set to IntegrationTest" From 1a191fbfce5f70cb29c7b9767e0328d6fea517c9 Mon Sep 17 00:00:00 2001 From: Alexander Holstrup <117829001+aholstrup1@users.noreply.github.com> Date: Fri, 24 Oct 2025 16:02:46 +0200 Subject: [PATCH 12/21] Enhance RunTestsInBcContainer.ps1 for test isolation Added functionality to run tests with and without isolation. --- .../Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 b/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 index 1637222d85..937bdbd8df 100644 --- a/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 +++ b/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 @@ -2,5 +2,13 @@ Param( [Hashtable]$parameters ) +$parameters["testType"] = "UnitTest" +$parameters["returnTrueIfAllPassed"] = $true + $script = Join-Path $PSScriptRoot "../../../scripts/RunTestsInBcContainer.ps1" -Resolve -. $script -parameters $parameters \ No newline at end of file +$AllTestsPassed = (. $script -parameters $parameters) + +# run test codeunits with RequiredTestIsolation set to Disabled +$AllTestsPassedIsolation = (. $script -parameters $parameters -DisableTestIsolation) + +return $AllTestsPassed -and $AllTestsPassedIsolation From 5bdc3a50ab482a9076ad30099bca6eb13c660a97 Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Sat, 25 Oct 2025 09:10:43 +0200 Subject: [PATCH 13/21] remove testtype --- build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 b/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 index 937bdbd8df..8b21568832 100644 --- a/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 +++ b/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 @@ -2,7 +2,6 @@ Param( [Hashtable]$parameters ) -$parameters["testType"] = "UnitTest" $parameters["returnTrueIfAllPassed"] = $true $script = Join-Path $PSScriptRoot "../../../scripts/RunTestsInBcContainer.ps1" -Resolve From 3e4a9aa26ec9fa083cb787bc2b8d28f1b6a3e052 Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Sun, 26 Oct 2025 08:49:18 +0100 Subject: [PATCH 14/21] test --- .../Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 | 9 ++++++--- .../.AL-Go/RunTestsInBcContainer.ps1 | 11 +++++++---- .../System Application Tests/.AL-Go/settings.json | 3 ++- build/scripts/RunTestsInBcContainer.ps1 | 11 ++++++----- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 b/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 index 8b21568832..9219e33518 100644 --- a/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 +++ b/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 @@ -1,13 +1,16 @@ Param( [Hashtable]$parameters ) +Import-Module (Join-Path $PSScriptRoot "../../../scripts/EnlistmentHelperFunctions.psm1" -Resolve) +$testType = Get-ALGoSetting -Key "testType" $parameters["returnTrueIfAllPassed"] = $true +# Run test codeunits with specified TestType $script = Join-Path $PSScriptRoot "../../../scripts/RunTestsInBcContainer.ps1" -Resolve -$AllTestsPassed = (. $script -parameters $parameters) +$AllTestsPassed = (. $script -parameters $parameters -TestType $testType) -# run test codeunits with RequiredTestIsolation set to Disabled -$AllTestsPassedIsolation = (. $script -parameters $parameters -DisableTestIsolation) +# Run test codeunits with RequiredTestIsolation set to Disabled +$AllTestsPassedIsolation = (. $script -parameters $parameters -DisableTestIsolation -TestType $testType) return $AllTestsPassed -and $AllTestsPassedIsolation diff --git a/build/projects/System Application Tests/.AL-Go/RunTestsInBcContainer.ps1 b/build/projects/System Application Tests/.AL-Go/RunTestsInBcContainer.ps1 index 55494c5669..55c85d6a07 100644 --- a/build/projects/System Application Tests/.AL-Go/RunTestsInBcContainer.ps1 +++ b/build/projects/System Application Tests/.AL-Go/RunTestsInBcContainer.ps1 @@ -2,13 +2,16 @@ Param( [Hashtable]$parameters ) -$parameters["testType"] = "UnitTest" +Import-Module (Join-Path $PSScriptRoot "../../../scripts/EnlistmentHelperFunctions.psm1" -Resolve) +$testType = Get-ALGoSetting -Key "testType" + $parameters["returnTrueIfAllPassed"] = $true +# run test codeunits with specified TestType $script = Join-Path $PSScriptRoot "../../../scripts/RunTestsInBcContainer.ps1" -Resolve -$AllTestsPassed = (. $script -parameters $parameters) +$AllTestsPassed = (. $script -parameters $parameters -TestType $testType) -# run test codeunits with RequiredTestIsolation set to Disabled -$AllTestsPassedIsolation = (. $script -parameters $parameters -DisableTestIsolation) +# Run test codeunits with RequiredTestIsolation set to Disabled +$AllTestsPassedIsolation = (. $script -parameters $parameters -DisableTestIsolation -TestType $testType) return $AllTestsPassed -and $AllTestsPassedIsolation \ No newline at end of file diff --git a/build/projects/System Application Tests/.AL-Go/settings.json b/build/projects/System Application Tests/.AL-Go/settings.json index 2f422c07f7..80bef059d5 100644 --- a/build/projects/System Application Tests/.AL-Go/settings.json +++ b/build/projects/System Application Tests/.AL-Go/settings.json @@ -4,5 +4,6 @@ "testFolders": [ "../../../src/System Application/Test", "../../../src/System Application/Partner Test" - ] + ], + "testType": "UnitTest" } diff --git a/build/scripts/RunTestsInBcContainer.ps1 b/build/scripts/RunTestsInBcContainer.ps1 index 7739f4686d..0d10cc6072 100644 --- a/build/scripts/RunTestsInBcContainer.ps1 +++ b/build/scripts/RunTestsInBcContainer.ps1 @@ -1,6 +1,8 @@ Param( [Hashtable] $parameters, - [switch] $DisableTestIsolation + [switch] $DisableTestIsolation, + [validateSet("UnitTest","IntegrationTest", "Uncategorized")] + [string] $TestType ) Import-Module $PSScriptRoot\EnlistmentHelperFunctions.psm1 @@ -58,10 +60,9 @@ if ($DisableTestIsolation) $parameters["testRunnerCodeunitId"] = "130451" # Test Runner with disabled test isolation } -$testType = Get-ALGoSetting -Key "testType" -if ($null -ne $testType) { - Write-Host "Using test type $testType" - $parameters["testType"] = $testType +if ($null -ne $TestType) { + Write-Host "Using test type $TestType" + $parameters["testType"] = $TestType } $parameters["disabledTests"] = @(Get-DisabledTests) # Add disabled tests to parameters From 61a229fccdcf72ded4dd0f18c7596a3ba58dbe9f Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Sun, 26 Oct 2025 20:40:40 +0100 Subject: [PATCH 15/21] only run for unit tests --- build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 b/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 index 9219e33518..64a55b3885 100644 --- a/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 +++ b/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 @@ -10,6 +10,11 @@ $parameters["returnTrueIfAllPassed"] = $true $script = Join-Path $PSScriptRoot "../../../scripts/RunTestsInBcContainer.ps1" -Resolve $AllTestsPassed = (. $script -parameters $parameters -TestType $testType) +# TODO: For now only run disabled test isolation for unit tests +if ($testType -ne "UnitTest") { + return $AllTestsPassed +} + # Run test codeunits with RequiredTestIsolation set to Disabled $AllTestsPassedIsolation = (. $script -parameters $parameters -DisableTestIsolation -TestType $testType) From c3e793dc6d948e8ee517c99ce0611563f7d6a001 Mon Sep 17 00:00:00 2001 From: Sun Haoran Date: Mon, 27 Oct 2025 09:00:01 +0100 Subject: [PATCH 16/21] Log RequiredTestIsolation in build and be specific in the comments (#5301) #### Summary Reading through the logs, I think the build scripts are correct. Adding more comments and logs so it's more obvious what's happening. I believe things are currently failed might be due to side effects of the tests. When a test has `RequiredTestIsolation = Disabled`, it will leave traces in the database, which could then cause the follow up tests to fail #### Work Item(s) Fixes # --- build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 | 7 +------ build/scripts/RunTestsInBcContainer.ps1 | 1 + 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 b/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 index 64a55b3885..4e5b5187f7 100644 --- a/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 +++ b/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 @@ -6,15 +6,10 @@ $testType = Get-ALGoSetting -Key "testType" $parameters["returnTrueIfAllPassed"] = $true -# Run test codeunits with specified TestType +# Run test codeunits with specified TestType, RequiredTestIsolation set to None or Codeunit $script = Join-Path $PSScriptRoot "../../../scripts/RunTestsInBcContainer.ps1" -Resolve $AllTestsPassed = (. $script -parameters $parameters -TestType $testType) -# TODO: For now only run disabled test isolation for unit tests -if ($testType -ne "UnitTest") { - return $AllTestsPassed -} - # Run test codeunits with RequiredTestIsolation set to Disabled $AllTestsPassedIsolation = (. $script -parameters $parameters -DisableTestIsolation -TestType $testType) diff --git a/build/scripts/RunTestsInBcContainer.ps1 b/build/scripts/RunTestsInBcContainer.ps1 index 0d10cc6072..db3863f1e4 100644 --- a/build/scripts/RunTestsInBcContainer.ps1 +++ b/build/scripts/RunTestsInBcContainer.ps1 @@ -56,6 +56,7 @@ function Invoke-TestsWithReruns { if ($DisableTestIsolation) { + Write-Host "Using RequiredTestIsolation: Disabled" $parameters["requiredTestIsolation"] = "Disabled" # filtering on tests that require Disabled Test Isolation $parameters["testRunnerCodeunitId"] = "130451" # Test Runner with disabled test isolation } From 5b70f93d9a24e5e0f0f1611fc215d4f854d67027 Mon Sep 17 00:00:00 2001 From: Sun Haoran Date: Mon, 27 Oct 2025 09:32:14 +0100 Subject: [PATCH 17/21] Do not re-run for RequiredTestIsolation = Disabled tests (#5302) #### Summary Do not retry for Isolation Disabled tests, as they leave traces in the DB. Re-run might just leave more things in DB and greater chances to fail follow up tests. --- build/scripts/RunTestsInBcContainer.ps1 | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/build/scripts/RunTestsInBcContainer.ps1 b/build/scripts/RunTestsInBcContainer.ps1 index db3863f1e4..44dba024b2 100644 --- a/build/scripts/RunTestsInBcContainer.ps1 +++ b/build/scripts/RunTestsInBcContainer.ps1 @@ -44,7 +44,7 @@ function Invoke-TestsWithReruns { } else { $attempt++ $parameters["ReRun"] = $true - if ($attempt -gt $maxReruns) { + if ($attempt -ge $maxReruns) { Write-Host "Tests failed after $maxReruns attempts." return $false } else { @@ -54,13 +54,6 @@ function Invoke-TestsWithReruns { } } -if ($DisableTestIsolation) -{ - Write-Host "Using RequiredTestIsolation: Disabled" - $parameters["requiredTestIsolation"] = "Disabled" # filtering on tests that require Disabled Test Isolation - $parameters["testRunnerCodeunitId"] = "130451" # Test Runner with disabled test isolation -} - if ($null -ne $TestType) { Write-Host "Using test type $TestType" $parameters["testType"] = $TestType @@ -69,4 +62,13 @@ if ($null -ne $TestType) { $parameters["disabledTests"] = @(Get-DisabledTests) # Add disabled tests to parameters $parameters["renewClientContextBetweenTests"] = $true +if ($DisableTestIsolation) +{ + Write-Host "Using RequiredTestIsolation: Disabled" + $parameters["requiredTestIsolation"] = "Disabled" # filtering on tests that require Disabled Test Isolation + $parameters["testRunnerCodeunitId"] = "130451" # Test Runner with disabled test isolation + + return Invoke-TestsWithReruns -parameters $parameters -maxReruns 1 # do not retry for Isolation Disabled tests, as they leave traces in the DB +} + return Invoke-TestsWithReruns -parameters $parameters From 57edf10d6edd9f63d8d57478955bc9ad35224454 Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Mon, 27 Oct 2025 13:55:26 +0100 Subject: [PATCH 18/21] Only run -DisableTestIsolation for unit tests --- build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 b/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 index 4e5b5187f7..139254859c 100644 --- a/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 +++ b/build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1 @@ -10,6 +10,11 @@ $parameters["returnTrueIfAllPassed"] = $true $script = Join-Path $PSScriptRoot "../../../scripts/RunTestsInBcContainer.ps1" -Resolve $AllTestsPassed = (. $script -parameters $parameters -TestType $testType) +# TODO: For now only run disabled test isolation for unit tests +if ($testType -ne "UnitTest") { + return $AllTestsPassed +} + # Run test codeunits with RequiredTestIsolation set to Disabled $AllTestsPassedIsolation = (. $script -parameters $parameters -DisableTestIsolation -TestType $testType) From a0eaa6b98c90fc129da784cb7b70bf1356a962d1 Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Tue, 28 Oct 2025 11:22:52 +0100 Subject: [PATCH 19/21] Enable DK --- build/projects/Apps (W1)/.AL-Go/settings.json | 3 +-- .../W1/EDocument/Test/DisabledTests/EDocEmailTests.json | 8 ++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 src/Apps/W1/EDocument/Test/DisabledTests/EDocEmailTests.json diff --git a/build/projects/Apps (W1)/.AL-Go/settings.json b/build/projects/Apps (W1)/.AL-Go/settings.json index 2e422330dd..d4642af59e 100644 --- a/build/projects/Apps (W1)/.AL-Go/settings.json +++ b/build/projects/Apps (W1)/.AL-Go/settings.json @@ -105,8 +105,7 @@ "DK" ], "settings": { - "country": "dk", - "doNotRunTests": true + "country": "dk" } }, { diff --git a/src/Apps/W1/EDocument/Test/DisabledTests/EDocEmailTests.json b/src/Apps/W1/EDocument/Test/DisabledTests/EDocEmailTests.json new file mode 100644 index 0000000000..9039a1b04d --- /dev/null +++ b/src/Apps/W1/EDocument/Test/DisabledTests/EDocEmailTests.json @@ -0,0 +1,8 @@ +[ + { + "bug": "Not Provided", + "codeunitId": 139746, + "codeunitName": "E-Doc. Email Tests", + "method": "TestSendFromPostedSalesInvoice" + } +] \ No newline at end of file From 89130b8ff145dd81ad81c3cd8e9a0e3e33a23cab Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Wed, 29 Oct 2025 10:09:08 +0100 Subject: [PATCH 20/21] disable uptake bugs --- .../Test/DisabledTests/ShpfyGiftCardsTest.json | 8 ++++++++ .../Test/DisabledTests/ShpfyShippingTest.json | 14 ++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/Apps/W1/Shopify/Test/DisabledTests/ShpfyGiftCardsTest.json create mode 100644 src/Apps/W1/Shopify/Test/DisabledTests/ShpfyShippingTest.json diff --git a/src/Apps/W1/Shopify/Test/DisabledTests/ShpfyGiftCardsTest.json b/src/Apps/W1/Shopify/Test/DisabledTests/ShpfyGiftCardsTest.json new file mode 100644 index 0000000000..1242789dcc --- /dev/null +++ b/src/Apps/W1/Shopify/Test/DisabledTests/ShpfyGiftCardsTest.json @@ -0,0 +1,8 @@ +[ + { + "bug": "Not Provided", + "codeunitId": 139570, + "CodeunitName": "Shpfy Gift Cards Test", + "Method": "UnitTestAddSoldGiftCards" + } +] \ No newline at end of file diff --git a/src/Apps/W1/Shopify/Test/DisabledTests/ShpfyShippingTest.json b/src/Apps/W1/Shopify/Test/DisabledTests/ShpfyShippingTest.json new file mode 100644 index 0000000000..4910f66c2d --- /dev/null +++ b/src/Apps/W1/Shopify/Test/DisabledTests/ShpfyShippingTest.json @@ -0,0 +1,14 @@ +[ + { + "bug": "611333", + "codeunitId": 139570, + "CodeunitName": "Shpfy Shipping Test", + "Method": "UnitTestExportShipment" + }, + { + "bug": "611333", + "codeunitId": 139570, + "CodeunitName": "Shpfy Shipping Test", + "Method": "UnitTestExportFulfillmentServiceShipment" + } +] \ No newline at end of file From 8abedd1b28d6acaa0689b8af1ca5459105366809 Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Wed, 29 Oct 2025 15:30:29 +0100 Subject: [PATCH 21/21] wrong codeunitId + one more test --- .../Shopify/Test/DisabledTests/ShpfyShippingTest.json | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Apps/W1/Shopify/Test/DisabledTests/ShpfyShippingTest.json b/src/Apps/W1/Shopify/Test/DisabledTests/ShpfyShippingTest.json index 4910f66c2d..a05eae7004 100644 --- a/src/Apps/W1/Shopify/Test/DisabledTests/ShpfyShippingTest.json +++ b/src/Apps/W1/Shopify/Test/DisabledTests/ShpfyShippingTest.json @@ -1,14 +1,20 @@ [ { "bug": "611333", - "codeunitId": 139570, + "codeunitId": 139606, "CodeunitName": "Shpfy Shipping Test", "Method": "UnitTestExportShipment" }, { "bug": "611333", - "codeunitId": 139570, + "codeunitId": 139606, "CodeunitName": "Shpfy Shipping Test", "Method": "UnitTestExportFulfillmentServiceShipment" + }, + { + "bug": "611333", + "codeunitId": 139606, + "CodeunitName": "Shpfy Shipping Test", + "Method": "UnitTestExportShipment250Lines" } ] \ No newline at end of file