-
Notifications
You must be signed in to change notification settings - Fork 13
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
Maintain Pester Tests to run on v5.2.2 #132
Labels
Milestone
Comments
ddemeyer
pushed a commit
that referenced
this issue
Sep 10, 2021
…werShell use `Invoke-Pester -Output Detailed` ... Session is done, now do all cmdlets alphabetically
Write-Warning ("Migrating from Pester 3.4.0 to 5.3.0...")
foreach ($file in (Get-ChildItem -Filter *.Tests.ps1))
{
Write-Warning ("Processing $file")
$content = $file | Get-Content -Raw
$content = $content.Replace('Write-Host ("`r`nLoading ISHRemote.PesterSetup.ps1 for MyCommand[" + $MyInvocation.MyCommand + "]...")', 'BeforeAll {')
$content = $content.Replace('. (Join-Path (Split-Path -Parent $MyInvocation.MyCommand.Path) "..\..\ISHRemote.PesterSetup.ps1")', '')
$content = $content.Replace('"'+"`r`n"+'try {', ('"'+"`r`n"+' Write-Host ("`r`nLoading ISHRemote.PesterSetup.ps1 over BeforeAll-block for MyCommand[" + $cmdletName + "]...")'+"`r`n"+' . (Join-Path (Split-Path -Parent $PSCommandPath) "\..\..\ISHRemote.PesterSetup.ps1")'+"`r`n`r`n"+' Write-Host ("Running "+$cmdletName+" Test Data and Variables initialization")'+"`r`n"+'}'))
$content = $content.Replace("`r`n"+'$cmdletName = ', (' $cmdletName = '))
$content = $content.Replace(' Write-Host "Initializing Test Data and Variables"'+"`r`n",'')
$content = $content.Replace('Should Not BeNullOrEmpty', 'Should -Not -BeNullOrEmpty')
$content = $content.Replace('Should Not Throw', 'Should -Not -Throw')
$content = $content.Replace('Should Not Be', 'Should -Not -Be')
$content = $content.Replace('Should BeExactly', 'Should -BeExactly')
$content = $content.Replace('Should MatchExactly', 'Should -MatchExactly')
$content = $content.Replace('Should Throw', 'Should -Throw')
$content = $content.Replace('Should Not', 'Should -Not')
$content = $content.Replace('Should Be', 'Should -Be')
$content = $content.Replace('} finally {', 'AfterAll {')
$content = $content.Replace('Write-Host "Cleaning Test Data and Variables"', 'Write-Host ("Running "+$cmdletName+" Test Data and Variables cleanup")')
$content | Set-Content $file
}
Write-Warning ("Still to do:")
Write-Warning ("* Encapsulate code in Describe block with BeforeAll {...}")
Write-Warning ("* Some -BeExactly on arrays don't compare the first element but the array size") |
ddemeyer
pushed a commit
that referenced
this issue
Sep 11, 2021
…avy lifting (see github issue)... Completed: Session, Annotation
ddemeyer
pushed a commit
that referenced
this issue
Sep 12, 2021
…avy lifting (see github issue)... Completed: Session, Annotation, Application, BackgroundTask, Baseline, DocumentObj plus a positive MetadataSize check
ddemeyer
pushed a commit
that referenced
this issue
Sep 12, 2021
…avy lifting (see github issue)... Completed: Session, Annotation, Application, BackgroundTask, Baseline, DocumentObj, (EDT), EventMonitor, (Feature), Field, FileProcessor, Folder, ListOfValues, OutputFormat, PublicationOutput, Settings, User, UserGroup, UserRole
ddemeyer
pushed a commit
that referenced
this issue
Sep 12, 2021
…ned up old compiling/debuggin references of VS2015 etc
|
4 tasks
ddemeyer
pushed a commit
that referenced
this issue
Sep 28, 2021
…step away from WCF proxy usage in tests... more resilient time ranges to cover timezones
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Windows 10/2019 comes with Pester 3.4.0 out of the box, so historically the
*.Tests.ps1
file are written 3.4.0 compatibility. Pester did some great improvements like running on .NET (Core) or Visual Studio Code integrations.This issue is about transforming the Pester tests to run on a higher version of Pester. As we are looking into Github Actions, we are inspired by their default version, see https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md
In turn these revised Pester tests are a building block to litterally copy
*.Tests.ps1
files between main branch (ISHRemotev0.*
) that runs on Windows PowerShell and Milestone PowerShell Core #115 (ISHRemotev7.*
) branch.*.Tests.ps1
Should Not BeNullOrEmpty
toShould -Not -BeNullOrEmpty
Should Not Throw
toShould -Not -Throw
Should Not Be
toShould -Not -Be
Should BeExactly
toShould -BeExactly
Should Throw
toShould -Throw
Should Not
toShould -Not
Should Be
toShould -Be
readme.md
to indicate prerequisitesSome rules and guidance by Pester contributor https://jakubjares.com and breaking changes in v5
Get-Command Invoke-Pester
version test to make sure you are not running with Windows 10 default installed Pester 3.4.0 which evidently is no longer compatible.Invoke-Pester -Path .\NewIshSession.Tests.ps1 -Output Detailed
Describe
level-Tag
usageDescribe
level-Skip:(!$IsLinux)
or-Skip:(!$IsWindows)
usage. Could also be boolean logic including WCF-SOAP vs ASMX-SOAP vs OpenAPI-REST.** -Skip:(-Not $isISHRemoteWindowsAuthentication) and -Skip:(-Not $isISHRemoteWcf)
The text was updated successfully, but these errors were encountered: