From 09df974e95e9c7db7aeb25fe44dcb5d8b4152c1f Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Wed, 22 Oct 2025 15:33:21 +0200 Subject: [PATCH 1/4] 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 2/4] 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 3/4] 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 4/4] 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