From f3af93a3e764839b20fc7ba1c45ecf478bbf8cda Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Tue, 23 Apr 2024 08:13:20 +0200 Subject: [PATCH] Add more versions to test (#3469) Co-authored-by: freddydk --- Tests/GetAndRunTests (latest).Tests.ps1 | 50 +++++++++++++++++++++ Tests/GetAndRunTests (version 22).Tests.ps1 | 50 +++++++++++++++++++++ Tests/GetAndRunTests (version 23).Tests.ps1 | 50 +++++++++++++++++++++ Tests/GetAndRunTests (version 24).Tests.ps1 | 50 +++++++++++++++++++++ 4 files changed, 200 insertions(+) create mode 100644 Tests/GetAndRunTests (latest).Tests.ps1 create mode 100644 Tests/GetAndRunTests (version 22).Tests.ps1 create mode 100644 Tests/GetAndRunTests (version 23).Tests.ps1 create mode 100644 Tests/GetAndRunTests (version 24).Tests.ps1 diff --git a/Tests/GetAndRunTests (latest).Tests.ps1 b/Tests/GetAndRunTests (latest).Tests.ps1 new file mode 100644 index 000000000..53e78b394 --- /dev/null +++ b/Tests/GetAndRunTests (latest).Tests.ps1 @@ -0,0 +1,50 @@ +Param( + [string] $licenseFile, + [string] $buildlicenseFile +) + +BeforeAll { + . (Join-Path $PSScriptRoot '_TestHelperFunctions.ps1') + $appPublisher = "Cronus Denmark A/S" + $appName = "Hello ÆØÅ" + $appVersion = "1.0.0.0" + $bcAppId = "cb99d78b-f9db-4a1e-822a-0c9c444535df" + $runTestsInVersion = 24 + $bcContainerName = "bcserver" +} + +AfterAll { + . (Join-Path $PSScriptRoot '_RemoveBcContainer.ps1') +} + +Describe 'AppHandling' { + + It 'Get/RunTests' { + $artifactUrl = Get-BCArtifactUrl -type Sandbox -version "$runTestsInVersion" -country "w1" -select Latest + New-BcContainer -accept_eula ` + -accept_outdated ` + -containerName $bcContainerName ` + -artifactUrl $artifactUrl ` + -auth NavUserPassword ` + -Credential $credential ` + -updateHosts ` + -includeTestToolkit + + $tests = (Get-TestsFromBCContainer -containerName $bcContainerName -credential $credential -extensionId "fa3e2564-a39e-417f-9be6-c0dbe3d94069") | Where-Object { $_.id -eq 134006 -or $_.id -eq 134007 } + $tests.Count | Should -be 2 + + $first = $true + $resultsFile = Join-Path $bcContainerHelperConfig.hostHelperFolder "Extensions\$bcContainerName\result.xml" + $tests | ForEach-Object { + Run-TestsInBcContainer -containerName $bcContainerName ` + -credential $credential ` + -XUnitResultFileName $resultsFile ` + -AppendToXUnitResultFile:(!$first) ` + -detailed ` + -testCodeunit $_.Id ` + -returnTrueIfAllPassed | Out-Null + $first = $false + } + $resultsFile | Should -Exist + } +} \ No newline at end of file diff --git a/Tests/GetAndRunTests (version 22).Tests.ps1 b/Tests/GetAndRunTests (version 22).Tests.ps1 new file mode 100644 index 000000000..65bd56314 --- /dev/null +++ b/Tests/GetAndRunTests (version 22).Tests.ps1 @@ -0,0 +1,50 @@ +Param( + [string] $licenseFile, + [string] $buildlicenseFile +) + +BeforeAll { + . (Join-Path $PSScriptRoot '_TestHelperFunctions.ps1') + $appPublisher = "Cronus Denmark A/S" + $appName = "Hello ÆØÅ" + $appVersion = "1.0.0.0" + $bcAppId = "cb99d78b-f9db-4a1e-822a-0c9c444535df" + $runTestsInVersion = 22 + $bcContainerName = "bcserver" +} + +AfterAll { + . (Join-Path $PSScriptRoot '_RemoveBcContainer.ps1') +} + +Describe 'AppHandling' { + + It 'Get/RunTests' { + $artifactUrl = Get-BCArtifactUrl -type OnPrem -version "$runTestsInVersion" -country "w1" -select Latest + New-BcContainer -accept_eula ` + -accept_outdated ` + -containerName $bcContainerName ` + -artifactUrl $artifactUrl ` + -auth NavUserPassword ` + -Credential $credential ` + -updateHosts ` + -includeTestToolkit + + $tests = (Get-TestsFromBCContainer -containerName $bcContainerName -credential $credential -extensionId "fa3e2564-a39e-417f-9be6-c0dbe3d94069") | Where-Object { $_.id -eq 134006 -or $_.id -eq 134007 } + $tests.Count | Should -be 2 + + $first = $true + $resultsFile = Join-Path $bcContainerHelperConfig.hostHelperFolder "Extensions\$bcContainerName\result.xml" + $tests | ForEach-Object { + Run-TestsInBcContainer -containerName $bcContainerName ` + -credential $credential ` + -XUnitResultFileName $resultsFile ` + -AppendToXUnitResultFile:(!$first) ` + -detailed ` + -testCodeunit $_.Id ` + -returnTrueIfAllPassed | Out-Null + $first = $false + } + $resultsFile | Should -Exist + } +} \ No newline at end of file diff --git a/Tests/GetAndRunTests (version 23).Tests.ps1 b/Tests/GetAndRunTests (version 23).Tests.ps1 new file mode 100644 index 000000000..ae668e51d --- /dev/null +++ b/Tests/GetAndRunTests (version 23).Tests.ps1 @@ -0,0 +1,50 @@ +Param( + [string] $licenseFile, + [string] $buildlicenseFile +) + +BeforeAll { + . (Join-Path $PSScriptRoot '_TestHelperFunctions.ps1') + $appPublisher = "Cronus Denmark A/S" + $appName = "Hello ÆØÅ" + $appVersion = "1.0.0.0" + $bcAppId = "cb99d78b-f9db-4a1e-822a-0c9c444535df" + $runTestsInVersion = 23 + $bcContainerName = "bcserver" +} + +AfterAll { + . (Join-Path $PSScriptRoot '_RemoveBcContainer.ps1') +} + +Describe 'AppHandling' { + + It 'Get/RunTests' { + $artifactUrl = Get-BCArtifactUrl -type OnPrem -version "$runTestsInVersion" -country "w1" -select Latest + New-BcContainer -accept_eula ` + -accept_outdated ` + -containerName $bcContainerName ` + -artifactUrl $artifactUrl ` + -auth NavUserPassword ` + -Credential $credential ` + -updateHosts ` + -includeTestToolkit + + $tests = (Get-TestsFromBCContainer -containerName $bcContainerName -credential $credential -extensionId "fa3e2564-a39e-417f-9be6-c0dbe3d94069") | Where-Object { $_.id -eq 134006 -or $_.id -eq 134007 } + $tests.Count | Should -be 2 + + $first = $true + $resultsFile = Join-Path $bcContainerHelperConfig.hostHelperFolder "Extensions\$bcContainerName\result.xml" + $tests | ForEach-Object { + Run-TestsInBcContainer -containerName $bcContainerName ` + -credential $credential ` + -XUnitResultFileName $resultsFile ` + -AppendToXUnitResultFile:(!$first) ` + -detailed ` + -testCodeunit $_.Id ` + -returnTrueIfAllPassed | Out-Null + $first = $false + } + $resultsFile | Should -Exist + } +} \ No newline at end of file diff --git a/Tests/GetAndRunTests (version 24).Tests.ps1 b/Tests/GetAndRunTests (version 24).Tests.ps1 new file mode 100644 index 000000000..8b7115094 --- /dev/null +++ b/Tests/GetAndRunTests (version 24).Tests.ps1 @@ -0,0 +1,50 @@ +Param( + [string] $licenseFile, + [string] $buildlicenseFile +) + +BeforeAll { + . (Join-Path $PSScriptRoot '_TestHelperFunctions.ps1') + $appPublisher = "Cronus Denmark A/S" + $appName = "Hello ÆØÅ" + $appVersion = "1.0.0.0" + $bcAppId = "cb99d78b-f9db-4a1e-822a-0c9c444535df" + $runTestsInVersion = 24 + $bcContainerName = "bcserver" +} + +AfterAll { + . (Join-Path $PSScriptRoot '_RemoveBcContainer.ps1') +} + +Describe 'AppHandling' { + + It 'Get/RunTests' { + $artifactUrl = Get-BCArtifactUrl -type OnPrem -version "$runTestsInVersion" -country "w1" -select Latest + New-BcContainer -accept_eula ` + -accept_outdated ` + -containerName $bcContainerName ` + -artifactUrl $artifactUrl ` + -auth NavUserPassword ` + -Credential $credential ` + -updateHosts ` + -includeTestToolkit + + $tests = (Get-TestsFromBCContainer -containerName $bcContainerName -credential $credential -extensionId "fa3e2564-a39e-417f-9be6-c0dbe3d94069") | Where-Object { $_.id -eq 134006 -or $_.id -eq 134007 } + $tests.Count | Should -be 2 + + $first = $true + $resultsFile = Join-Path $bcContainerHelperConfig.hostHelperFolder "Extensions\$bcContainerName\result.xml" + $tests | ForEach-Object { + Run-TestsInBcContainer -containerName $bcContainerName ` + -credential $credential ` + -XUnitResultFileName $resultsFile ` + -AppendToXUnitResultFile:(!$first) ` + -detailed ` + -testCodeunit $_.Id ` + -returnTrueIfAllPassed | Out-Null + $first = $false + } + $resultsFile | Should -Exist + } +} \ No newline at end of file