Downloads:
320,534
Downloads of v 4.10.2-beta1:
99
Last Update:
29 May 2021
Package Maintainer(s):
Software Author(s):
- Pester Team
Tags:
powershell unit testing bdd tdd mocking admin- Software Specific:
- Software Site
- Software License
- Package Specific:
- Possible Package Source
- Package outdated?
- Package broken?
- Contact Maintainers
- Contact Site Admins
- Software Vendor?
- Report Abuse
- Download
Pester
This is a prerelease version of Pester.
- 1
- 2
- 3
4.10.2-beta1 | Updated: 29 May 2021
- Software Specific:
- Software Site
- Software License
- Package Specific:
- Possible Package Source
- Package outdated?
- Package broken?
- Contact Maintainers
- Contact Site Admins
- Software Vendor?
- Report Abuse
- Download
Downloads:
320,534
Downloads of v 4.10.2-beta1:
99
Software Author(s):
- Pester Team
Pester 4.10.2-beta1
This is a prerelease version of Pester.
Legal Disclaimer: Neither this package nor Chocolatey Software, Inc. are affiliated with or endorsed by Pester Team. The inclusion of Pester Team trademark(s), if any, upon this webpage is solely to identify Pester Team goods or services and not for commercial purposes.
- 1
- 2
- 3
All Checks are Passing
3 Passing Tests
Deployment Method: Individual Install, Upgrade, & Uninstall
To install Pester, run the following command from the command line or from PowerShell:
To upgrade Pester, run the following command from the command line or from PowerShell:
To uninstall Pester, run the following command from the command line or from PowerShell:
Deployment Method:
This applies to both open source and commercial editions of Chocolatey.
1. Enter Your Internal Repository Url
(this should look similar to https://community.chocolatey.org/api/v2/)
2. Setup Your Environment
1. Ensure you are set for organizational deployment
Please see the organizational deployment guide
2. Get the package into your environment
Option 1: Cached Package (Unreliable, Requires Internet - Same As Community)-
Open Source or Commercial:
- Proxy Repository - Create a proxy nuget repository on Nexus, Artifactory Pro, or a proxy Chocolatey repository on ProGet. Point your upstream to https://community.chocolatey.org/api/v2/. Packages cache on first access automatically. Make sure your choco clients are using your proxy repository as a source and NOT the default community repository. See source command for more information.
- You can also just download the package and push it to a repository Download
-
Open Source
-
Download the package:
Download - Follow manual internalization instructions
-
-
Package Internalizer (C4B)
-
Run: (additional options)
choco download pester --internalize --version=4.10.2-beta1 --pre --source=https://community.chocolatey.org/api/v2/
-
For package and dependencies run:
choco push --source="'INTERNAL REPO URL'"
- Automate package internalization
-
Run: (additional options)
3. Copy Your Script
choco upgrade pester -y --source="'INTERNAL REPO URL'" --version="'4.10.2-beta1'" --prerelease [other options]
See options you can pass to upgrade.
See best practices for scripting.
Add this to a PowerShell script or use a Batch script with tools and in places where you are calling directly to Chocolatey. If you are integrating, keep in mind enhanced exit codes.
If you do use a PowerShell script, use the following to ensure bad exit codes are shown as failures:
choco upgrade pester -y --source="'INTERNAL REPO URL'" --version="'4.10.2-beta1'" --prerelease
$exitCode = $LASTEXITCODE
Write-Verbose "Exit code was $exitCode"
$validExitCodes = @(0, 1605, 1614, 1641, 3010)
if ($validExitCodes -contains $exitCode) {
Exit 0
}
Exit $exitCode
- name: Install pester
win_chocolatey:
name: pester
version: '4.10.2-beta1'
source: INTERNAL REPO URL
state: present
allow_prerelease: yes
See docs at https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html.
chocolatey_package 'pester' do
action :install
source 'INTERNAL REPO URL'
version '4.10.2-beta1'
options '--prerelease'
end
See docs at https://docs.chef.io/resource_chocolatey_package.html.
cChocoPackageInstaller pester
{
Name = "pester"
Version = "4.10.2-beta1"
Source = "INTERNAL REPO URL"
chocoParams = "--prerelease"
}
Requires cChoco DSC Resource. See docs at https://github.com/chocolatey/cChoco.
package { 'pester':
ensure => '4.10.2-beta1',
install_options => ['--prerelease'],
provider => 'chocolatey',
source => 'INTERNAL REPO URL',
}
Requires Puppet Chocolatey Provider module. See docs at https://forge.puppet.com/puppetlabs/chocolatey.
4. If applicable - Chocolatey configuration/installation
See infrastructure management matrix for Chocolatey configuration elements and examples.
This package was approved as a trusted package on 29 May 2021.
Pester is testing framework for PowerShell, written in PowerShell.
@echo off
SET DIR=%~dp0%
SET ARGS=%*
if NOT '%1'=='' SET ARGS=%ARGS:"=\"%
if '%1'=='/?' goto usage
if '%1'=='-?' goto usage
if '%1'=='?' goto usage
if '%1'=='/help' goto usage
if '%1'=='help' goto usage
@PowerShell -NonInteractive -NoProfile -ExecutionPolicy Bypass -Command ^
"& Import-Module '%DIR%..\Pester.psm1'; & { Invoke-Pester -EnableExit %ARGS%}"
goto finish
:usage
if NOT '%2'=='' goto help
echo To run pester for tests, just call pester or runtests with no arguments
echo.
echo Example: pester
echo.
echo For Detailed help information, call pester help with a help topic. See
echo help topic about_Pester for a list of all topics at the end
echo.
echo Example: pester help about_Pester
echo.
goto finish
:help
@PowerShell -NonInteractive -NoProfile -ExecutionPolicy Bypass -Command ^
"& Import-Module '%DIR%..\Pester.psm1'; & { Get-Help %2}"
:finish
exit /B %errorlevel%
. $PSScriptRoot\Verify-Equal.ps1
. $PSScriptRoot\Verify-True.ps1
. $PSScriptRoot\Verify-False.ps1
. $PSScriptRoot\Verify-Null.ps1
. $PSScriptRoot\Verify-NotNull.ps1
. $PSScriptRoot\Verify-Same.ps1
. $PSScriptRoot\Verify-NotSame.ps1
. $PSScriptRoot\Verify-Throw.ps1
. $PSScriptRoot\Verify-Type.ps1
. $PSScriptRoot\Verify-AssertionFailed.ps1
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUKx2uYj0MytXdHO5iRpoT7ty7
# NaagghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAw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deNdiwl1sefD+ZN/BAm
# oLqwLTw/fQyCt9fT2HhrZ8IC0Pv1fkbVz6m5jCMXpUZ/qA==
# SIG # End signature block
function Verify-AssertionFailed {
param (
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
[ScriptBlock]$ScriptBlock
)
$assertionExceptionThrown = $false
$err = $null
try {
$null = & $ScriptBlock
}
catch [Exception] {
$assertionExceptionThrown = ($_.FullyQualifiedErrorId -eq 'PesterAssertionFailed')
$err = $_
$err
}
if (-not $assertionExceptionThrown) {
$result = if ($null -eq $err) {
"no assertion failure error was thrown!"
}
else {
"other error was thrown! $($err | Format-List -Force * | Out-String)"
}
throw [Exception]"Expected the script block { $ScriptBlock } to fail in Pester assertion, but $result"
}
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUc2TN0NaxHrK8KJf2TIetW/R4
# 5nWgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQQDExdEaWdpQ2VydCBUaW1lc3RhbXAgMjAyMTCCASIwDQYJKoZIhvcN
# AQEBBQADggEPADCCAQoCggEBAMLmYYRnxYr1DQikRcpja1HXOhFCvQp1dU2UtAxQ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NwXVjOOy0iAa3vQTs7Lq8g23ykc6L7OHH0Au4VcSanqz5Cd47EOCzJr8W
# sYZQwyO1myvVTarw+jXO2VmmYLiikaahuE0i/ZOlFKk663TKCXiUBFsexiFZacdC
# aGoF9foCkLsf0Z6YldfizDS8FCRTwBaqYUfCmobZuHMtfytK53mKogkO54uxa6GC
# AjAwggIsBgkqhkiG9w0BCQYxggIdMIICGQIBATCBhjByMQswCQYDVQQGEwJVUzEV
# MBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29t
# MTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgVGltZXN0YW1waW5n
# IENBAhANQkrgvjqI/2BAIc4UAPDdMA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODAwWjAv
# BgkqhkiG9w0BCQQxIgQgjarzPOCCDEuoqps+6pSZBmUgSD4IjJkzpsGMtdYyvjsw
# DQYJKoZIhvcNAQEBBQAEggEAhJzluhZjtdA6D2QJMrrh+lvUHMMdGjqIM5Qo9UAF
# m0y1aOJJPvMTL1THuST0fvX+lhQ3vzV55ImlzOsiYModD/JazCW1/vWM4xbfrugy
# TUgUocaiY7iuWR7BkNQH4ow1pV//5xh2rMyCTTZsHoxyXoXicY0qGG1+wPT0e37T
# BSG8aXy0JkUZ8DKbRqJQhFP7gYRldQlMJcVVmV5RCVbXZCimVUlNB6nuChJGqTBY
# r00iG6Gu7CFRpF+6yprpo4QOdUgHLQgmADSy+AaDrNEHc53SHC9eCL1CWgtaIwyO
# gaAxAXcuUrwtNzFX0E0FY6ssYq6Q1LyO4mbgUscmhnNGIA==
# SIG # End signature block
function Verify-Equal {
param (
[Parameter(ValueFromPipeline = $true)]
$Actual,
[Parameter(Mandatory = $true, Position = 0)]
$Expected
)
if ($Expected -ne $Actual) {
$message = "Expected and actual values differ!`n" +
"Expected: '$Expected'`n" +
"Actual : '$Actual'"
if ($Expected -is [string] -and $Actual -is [string]) {
$message += "`nExpected length: $($Expected.Length)`nActual length: $($Actual.Length)"
}
throw [Exception]$message
}
$Actual
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUAoDWcUTjSqrV7GQmvwRt2KVt
# isigghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQQDExdEaWdpQ2VydCBUaW1lc3RhbXAgMjAyMTCCASIwDQYJKoZIhvcN
# AQEBBQADggEPADCCAQoCggEBAMLmYYRnxYr1DQikRcpja1HXOhFCvQp1dU2UtAxQ
# tSYQ/h3Ib5FrDJbnGlxI70Tlv5thzRWRYlq4/2cLnGP9NmqB+in43Stwhd4CGPN4
# bbx9+cdtCT2+anaH6Yq9+IRdHnbJ5MZ2djpT0dHTWjaPxqPhLxs6t2HWc+xObTOK
# fF1FLUuxUOZBOjdWhtyTI433UCXoZObd048vV7WHIOsOjizVI9r0TXhG4wODMSlK
# XAwxikqMiMX3MFr5FK8VX2xDSQn9JiNT9o1j6BqrW7EdMMKbaYK02/xWVLwfoYer
# vnpbCiA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lcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29t
# MTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgVGltZXN0YW1waW5n
# IENBAhANQkrgvjqI/2BAIc4UAPDdMA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODAwWjAv
# BgkqhkiG9w0BCQQxIgQgF3UbAPpLA7mB+aG47aUcWqJXMKM5cGlwVJ+zc+Z9MjAw
# DQYJKoZIhvcNAQEBBQAEggEAvLQUpsiIjdwajERYuX+sO56xtKax/l+FRRvi23vL
# zqNusnNI34KYpC86GlIEk1KBglhViqie11ksPO0VhP+bUuLkZvB0EhhXfB0hqqce
# VGnIHPma02MS83+gL0wCUDGeUATZZoL3/SLIoW0XI2d7a+SGGH5fWCTCyIKQGsfV
# +vvuLtB/EK7GKPtFHtgOmz0LUVhGWcQ6MYhp4FKieN9A5g7BAWmaLbEVGJC8G4vY
# jNLZriKAePY7c49GFFlrqAYMNrzzFgAgeV4XXu7NwB2mn41PZgMdxVeu//OMYTnX
# AzefbqxDdPagvv4tiWQQYyWRiRqObowPIlzpUDRn1R1vXg==
# SIG # End signature block
function Verify-False {
param (
[Parameter(ValueFromPipeline = $true)]
$Actual
)
if ($Actual) {
throw [Exception]"Expected `$false but got '$Actual'."
}
$Actual
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUExhsFHPLHbCUjGxFFITYdg0N
# 8gCgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYD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ukp
# RBXfmgPK84CcLs+RyxcFSnP0ERUjlg+My6qoDiMhMtU2DtxYmmvuEXSu57DsIVS4
# sWfUUev/tJlImSvNSAFd7p/rAYRJhb0aZTEPu6CtryEvxXLGkAIHP1E9OTk9Q88L
# 5NLaehGp/cKpw/IyreQqwk7WtpOlUUkQ+Mhse8PbIzemHUXf7xsgnSriDcri/S+4
# WIHGnEU7tj4vkjPErqKSuHRCf6HfdISOiNOXRXnbJdVBsg==
# SIG # End signature block
function Verify-NotNull {
param (
[Parameter(ValueFromPipeline = $true)]
$Actual
)
if ($null -eq $Actual) {
throw [Exception]"Expected not `$null but got `$null."
}
$Actual
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUjgXz6ehnXGouh0ybLRSjxIxU
# FdCgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQQDExdEaWdpQ2VydCBUaW1lc3RhbXAgMjAyMTCCASIwDQYJKoZIhvcN
# AQEBBQADggEPADCCAQoCggEBAMLmYYRnxYr1DQikRcpja1HXOhFCvQp1dU2UtAxQ
# tSYQ/h3Ib5FrDJbnGlxI70Tlv5thzRWRYlq4/2cLnG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
# wvsRXbXfzPhzUUGH7PPcuJY1WpWDU7y05k6OgxfsqehTAAeseFqisVP52zf7Gej3
# OroH8q38o5xqNzJ6y/SftUqiTpvIa8Dpv06QddFkoKwFjhR4j6oVQ31pneCX0KGC
# AjAwggIsBgkqhkiG9w0BCQYxggIdMIICGQIBATCBhjByMQswCQYDVQQGEwJVUzEV
# MBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29t
# MTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgVGltZXN0YW1waW5n
# IENBAhANQkrgvjqI/2BAIc4UAPDdMA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODAwWjAv
# BgkqhkiG9w0BCQQxIgQgDXTrgo0yZT08W6WrjlCzF7zdmvJd/VmKQxhjuk7hm8Iw
# DQYJKoZIhvcNAQEBBQAEggEAtxJv3cglog8lXwrbbSanM4M4bcujojYBe6oSAYjM
# Vh+7puykIeU9Hka8rtlQlq/S7hkK/DrXFmkP9+2tks5fSro58cTgMFoHIGQHrzqO
# ykEg95wBQfh1a68ML1H9o2cmd2N0YOkExjU98xWbTDRwqr7ifQIhHiBB9yfOHs2J
# 7MX5Os6bUq27TIU/z6LYANeCG/wdaX37JrcZU8IbDQIWOqzzzH+TJz7LsyyD/iTz
# vh0qZTwPjFeBV/PMAdLwaNNjAKUN4eGnMjPtsJTY2BZMXiu4elcpHOoMgCQSc58p
# 9MJVJ90fiC65tWQZSbE0tOEP+XrfGDMNJy/BSJw+RH/b+g==
# SIG # End signature block
function Verify-NotSame {
param (
[Parameter(ValueFromPipeline = $true)]
$Actual,
[Parameter(Mandatory = $true, Position = 0)]
$Expected
)
if ([object]::ReferenceEquals($Expected, $Actual)) {
throw [Exception]"Expected the objects to be different instance but they were the same instance."
}
$Actual
}
# SIG # Begin signature block
#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GSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODAwWjAv
# BgkqhkiG9w0BCQQxIgQg0ZnbGME00SbxJ2HDBPOEAyJE9Y9ie7ZqXX8S+RfL/b4w
# DQYJKoZIhvcNAQEBBQAEggEAFqOwU92zwkpqP3s19ebfL5RTAfSXdbsG8zMIgQbY
# KZjBZ31ZR6xrsPJ3/db6btLms5oY7VFzGdn1yUTcVHXCiTwjMZLLGIgyJKpAdl+N
# mfY6jaDbP8ylAMdEZmUTVcr0aWRBLxl6x8NoB9vyd8JhDC7m5yZMOyznw7ltxOjc
# Do0W2KJmhakOs2fNXac3tOo+Psdc/ZY1G9NunzVMa65C51gL+JytUBqLfY6z4Y+D
# kX2xqHua2uumMysWUi/E3Nnt5K/hZ7hhAihflC8mcO7CiMNZT60mBQFXy3K25YHy
# lbn8gyi+2FjxwRiQIdkIWS16je1xtzqkKht8LanKQbY6+A==
# SIG # End signature block
function Verify-Null {
param (
[Parameter(ValueFromPipeline = $true)]
$Actual
)
if ($null -ne $Actual) {
throw [Exception]"Expected `$null but got '$Actual'."
}
$Actual
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUN+iTSinGoqa8A1+jmsVFSlAI
# EL+gghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgV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eLGASL9UsrNhU
# 8s0PtXgmIoz7CFDNm5zAeuIymj3Jh24B27o6SPGKtxVRfSxbthVfNRWKRFzO9irk
# ClstDFgsmFKOQvcBoIaDMMndgStaZtPXuLxRjzjV/dYs8w==
# SIG # End signature block
function Verify-Same {
param (
[Parameter(ValueFromPipeline = $true)]
$Actual,
[Parameter(Mandatory = $true, Position = 0)]
$Expected
)
if (-not [object]::ReferenceEquals($Expected, $Actual)) {
throw [Exception]"Expected the objects to be the same instance but they were not."
}
$Actual
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQU5ixZyRe4q3esHS67yYfIaFCp
# LO+gghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQQDExdEaWdpQ2VydCBUaW1lc3RhbXAgMjAyMTCCASIwDQYJKoZIhvcN
# AQEBBQADggEPADCCAQoCggEBAMLmYYRnxYr1DQikRcpja1HXOhFCvQp1dU2UtAxQ
# tSYQ/h3Ib5FrDJbnGlxI70Tlv5thzRWRYlq4/2cLnGP9NmqB+in43Stwhd4CGPN4
# bbx9+cdtCT2+anaH6Yq9+IRdHnbJ5MZ2djpT0dHTWjaPxqPhL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TXv9tcfKwGdD0p9nJhnXhkS1W+dhDvyUO4hjs+c4PePcKimKcG3roKGC
# AjAwggIsBgkqhkiG9w0BCQYxggIdMIICGQIBATCBhjByMQswCQYDVQQGEwJVUzEV
# MBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29t
# MTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgVGltZXN0YW1waW5n
# IENBAhANQkrgvjqI/2BAIc4UAPDdMA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODAxWjAv
# BgkqhkiG9w0BCQQxIgQgN4aHrq9KuwZE7yo/R170P2rr4odZ4Iderm8ZnWwJjVMw
# DQYJKoZIhvcNAQEBBQAEggEAbmIZvf0RgmDWNb7YA3OyiB4llA6deJaewxjIQyzB
# Cs9MnnE737fsEHbj4eVJ3fubMyseI3+uUZ8wknLHpOPFV/1vEwfrLhOXJoCvLWsc
# eb1Q+x3QQFvGyGvSQu2kLhGEEIi8SS+8IWXL6ukzxUs8qfFY/qHItOtFvebzn2Wd
# SCs+Y8urK2DXhvrV2IAqtceb7RNeaiIzxbln959TxYYe1wuAI8WyCAbglxsZ7QZN
# 75KzLMUaIweDKFJi8df3P7Ts+NJ+2y5OY2XCK8pB4qXk6bMbO+RU92R1hUBTuCn1
# IMC8PoHcYFd3jfzyU7W4zuYIy13Oa86yvRxpD3VtC8VKIQ==
# SIG # End signature block
function Verify-Throw {
param (
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
[ScriptBlock]$ScriptBlock
)
$exceptionThrown = $false
try {
$null = & $ScriptBlock
}
catch {
$exceptionThrown = $true
$_
}
if (-not $exceptionThrown) {
throw [Exception]"An exception was expected, but no exception was thrown!"
}
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBg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CSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODAxWjAv
# BgkqhkiG9w0BCQQxIgQgm8vDNPv4e6SGPkoV9eG8MOzX7o5hqz5qMI8xNtY9Pqww
# DQYJKoZIhvcNAQEBBQAEggEAQrI+WVccgdU6/DrYuL4xuFkT4NgdUwWZz9Bljvry
# m3/29JzikKQCpAzU2jnkSnU8cXjTgjtDjPLTjOcyhEv0Hz3ISVvFebJ1ljNKeOdH
# 7c6i58m8FcgkyvkP9Dl2E330puO3vt4Gh9KPvNZIvusKI0LsKr+YuRLqbPq/Z6Am
# fpJ8xa7bv4pGe8Ry9eoL0TNz0BBiPUexuzpzm/J+xsEd7Qeg6UTkkVuu1nlzAa+P
# 96z5Tkxzm9jaKwaYSsADNH9OZXCnUadDA7qKTFz2t5CMFwcUxayXjIpNRJPmmoeI
# m7nLvIKBeB/qoWQXmIbhXm7R6Iv+1Pxh6YKPCEjmku/Exw==
# SIG # End signature block
function Verify-True {
param (
[Parameter(ValueFromPipeline = $true)]
$Actual
)
if (-not $Actual) {
throw [Exception]"Expected `$true but got '$Actual'."
}
$Actual
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUWug5cBcRTOGv0wBtXiiUo3tO
# IeqgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTA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WhHDL7ToHDdMQfH8bD7vv0C3dCOMGiZBwp376PVomZEm2YuqE6+rXy
# EFzxQtlV8hCgJQgomJy3FkJ1Sku1awNu77bGCwjeYdW4Ng==
# SIG # End signature block
function Verify-Type {
param (
[Parameter(ValueFromPipeline = $true)]
$Actual,
[Parameter(Mandatory = $true, Position = 0)]
[Type]$Expected
)
if ($Actual -isnot $Expected) {
$message = "Expected value to be of type $($Expected.FullName)"
$Actual = "but got " + $(if ($null -eq $Actual) {
"'<null>'"
}
else {
"'$($Actual.GetType().FullName)'"
})
throw [Exception]"$message, $Actual"
}
$Actual
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUhh/oyrwBk1lPWIO59nR56UXG
# FoCgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQQDExdEaWdpQ2VydCBUaW1lc3RhbXAgMjAyMTCCASIwDQYJKoZIhvcN
# AQEBBQADggEPADCCAQoCggEBAMLmYYRnxYr1DQikRcpja1HXOhFCvQp1dU2UtAxQ
# tSYQ/h3Ib5FrDJbnGlxI70Tlv5thzRWRYlq4/2cLnGP9NmqB+in43Stwhd4CGPN4
# bbx9+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V83pJb3/VrJ6hwjlvnFgJNrEBx82rILZIWxxnzh06/
# g1smuvxYUfywyj2HCT21ePlnTcGjdk8NRG8bdAC9c4RCuewEmHJtHnh3kWb7saGC
# AjAwggIsBgkqhkiG9w0BCQYxggIdMIICGQIBATCBhjByMQswCQYDVQQGEwJVUzEV
# MBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29t
# MTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgVGltZXN0YW1waW5n
# IENBAhANQkrgvjqI/2BAIc4UAPDdMA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODAxWjAv
# BgkqhkiG9w0BCQQxIgQgjnql0UNj2jE/zISsH6NM7xSzfNZA5jQA24EDLmay6mAw
# DQYJKoZIhvcNAQEBBQAEggEArkKKMQtj0bdqvpXjsSBk/5UUwY+JNOBHHeOkpidq
# pwJ8Fa1bOdBqjGCzUgW4KoHBbafEddLhCv7u8OG+/co/GKU9nOKZQnm0yQ/qbwBr
# 0vgZcCSCTpeBbbZnJuxYbbyf3DxXOJ+0ad/1LkRf3A2m7FYM7hXrS6M+tTsKQyOU
# LZWZnQmMM992P3IBBPlvHRY3Xkf2+B9Lay6wFsPMxV2hhNbu/LQU+OflVnQ3Px7z
# giN+E6Rj6el/2LBC8VwLmqd1cudk8ko19cx0Re5t/f6gOM5McvUL4DZ8v/WI3ovw
# oypqZZUEqiOxb7KDCKsv9y0sODps7MT1d5pUInL9oQWwaQ==
# SIG # End signature block
Import-Module $PSScriptRoot\..\TypeClass\TypeClass.psm1 -DisableNameChecking
function Format-Collection ($Value, [switch]$Pretty) {
$Limit = 10
$separator = ', '
if ($Pretty) {
$separator = ",`n"
}
#$count = $Value.Count
#$trimmed = $count -gt $Limit
'@(' + (($Value | Select -First $Limit | % { Format-Nicely -Value $_ -Pretty:$Pretty }) -join $separator ) + <# $(if ($trimmed) {' +' + [string]($count-$limit)}) + #> ')'
}
function Format-Object ($Value, $Property, [switch]$Pretty) {
if ($null -eq $Property) {
$Property = $Value.PSObject.Properties | Select-Object -ExpandProperty Name
}
$valueType = Get-ShortType $Value
$valueFormatted = ([string]([PSObject]$Value | Select-Object -Property $Property))
if ($Pretty) {
$margin = " "
$valueFormatted = $valueFormatted `
-replace '^@{', "@{`n$margin" `
-replace '; ', ";`n$margin" `
-replace '}$', "`n}" `
}
$valueFormatted -replace "^@", $valueType
}
function Format-Null {
'$null'
}
function Format-String ($Value) {
if ('' -eq $Value) {
return '<empty>'
}
"'$Value'"
}
function Format-Date ($Value) {
$Value.ToString('o')
}
function Format-Boolean ($Value) {
'$' + $Value.ToString().ToLower()
}
function Format-ScriptBlock ($Value) {
'{' + $Value + '}'
}
function Format-Number ($Value) {
[string]$Value
}
function Format-Hashtable ($Value) {
$head = '@{'
$tail = '}'
$entries = $Value.Keys | sort | foreach {
$formattedValue = Format-Nicely $Value.$_
"$_=$formattedValue" }
$head + ( $entries -join '; ') + $tail
}
function Format-Dictionary ($Value) {
$head = 'Dictionary{'
$tail = '}'
$entries = $Value.Keys | sort | foreach {
$formattedValue = Format-Nicely $Value.$_
"$_=$formattedValue" }
$head + ( $entries -join '; ') + $tail
}
function Format-Nicely ($Value, [switch]$Pretty) {
if ($null -eq $Value) {
return Format-Null -Value $Value
}
if ($Value -is [bool]) {
return Format-Boolean -Value $Value
}
if ($Value -is [string]) {
return Format-String -Value $Value
}
if ($Value -is [DateTime]) {
return Format-Date -Value $Value
}
if ($value -is [Type]) {
return '[' + (Format-Type -Value $Value) + ']'
}
if (Is-DecimalNumber -Value $Value) {
return Format-Number -Value $Value
}
if (Is-ScriptBlock -Value $Value) {
return Format-ScriptBlock -Value $Value
}
if (Is-Value -Value $Value) {
return $Value
}
if (Is-Hashtable -Value $Value) {
# no advanced formatting of objects in the first version, till I balance it
return [string]$Value
#return Format-Hashtable -Value $Value
}
if (Is-Dictionary -Value $Value) {
# no advanced formatting of objects in the first version, till I balance it
return [string]$Value
#return Format-Dictionary -Value $Value
}
if (Is-Collection -Value $Value) {
return Format-Collection -Value $Value -Pretty:$Pretty
}
# no advanced formatting of objects in the first version, till I balance it
return [string]$Value
# Format-Object -Value $Value -Property (Get-DisplayProperty $Value) -Pretty:$Pretty
}
function Sort-Property ($InputObject, [string[]]$SignificantProperties, $Limit = 4) {
$properties = @($InputObject.PSObject.Properties |
where { $_.Name -notlike "_*"} |
select -expand Name |
sort)
$significant = @()
$rest = @()
foreach ($p in $properties) {
if ($significantProperties -contains $p) {
$significant += $p
}
else {
$rest += $p
}
}
#todo: I am assuming id, name properties, so I am just sorting the selected ones by name.
(@($significant | sort) + $rest) | Select -First $Limit
}
function Get-DisplayProperty ($Value) {
Sort-Property -InputObject $Value -SignificantProperties 'id', 'name'
}
function Get-ShortType ($Value) {
if ($null -ne $value) {
$type = Format-Type $Value.GetType()
# PSCustomObject serializes to the whole type name on normal PS but to
# just PSCustomObject on PS Core
$type `
-replace "^System\." `
-replace "^Management\.Automation\.PSCustomObject$", "PSObject" `
-replace "^PSCustomObject$", "PSObject" `
-replace "^Object\[\]$", "collection" `
}
else {
Format-Type $null
}
}
function Format-Type ([Type]$Value) {
if ($null -eq $Value) {
return '<none>'
}
[string]$Value
}
Export-ModuleMember -Function @(
'Format-Collection'
'Format-Object'
'Format-Null'
'Format-Boolean'
'Format-String'
'Format-Date'
'Format-ScriptBlock'
'Format-Number'
'Format-Hashtable'
'Format-Dictionary'
'Format-Type'
'Format-Nicely'
'Get-DisplayProperty'
'Get-ShortType'
)
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAA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EBBQAEggEAwcUkVaxYHJhLazpev3Ya7vBmqQyYLJqz1PpQh+pq
# 5Ds84RYQyQ90yhnpdZlZC4U77asYa20v/u6xMU1EoswqfSDGNckieuJXOi/m/yX2
# ILFLADlcXiweo0ee5AMXTB4b/1YncDxUSTQgkoj52balpUROXcJN9AFJSCewJJSj
# jZLkpx429gc/b7qQc12M69qLoHlBYo7Mn4iEwT6JHPSR0seMSdFaYhlV7XwwPYCU
# 3dI+tLpwn5TuRDAMkobLWdMsdMO7j91EbideD6CqIlZj7H6KFVsVR2qVRp0BVpvv
# BvAMpH5asiB0TAo7kxqrQWOd9rI3tvC6s8u0mEvO9CDf6w==
# SIG # End signature block
function Is-Value ($Value) {
$Value = $($Value)
$Value -is [ValueType] -or $Value -is [string] -or $value -is [scriptblock]
}
function Is-Collection ($Value) {
# check for value types and strings explicitly
# because otherwise it does not work for decimal
# so let's skip all values we definitely know
# are not collections
if ($Value -is [ValueType] -or $Value -is [string]) {
return $false
}
-not [object]::ReferenceEquals($Value, $($Value))
}
function Is-ScriptBlock ($Value) {
$Value -is [ScriptBlock]
}
function Is-DecimalNumber ($Value) {
$Value -is [float] -or $Value -is [single] -or $Value -is [double] -or $Value -is [decimal]
}
function Is-Hashtable ($Value) {
$Value -is [hashtable]
}
function Is-Dictionary ($Value) {
$Value -is [System.Collections.IDictionary]
}
function Is-Object ($Value) {
# here we need to approximate that that object is not value
# or any special category of object, so other checks might
# need to be added
-not ($null -eq $Value -or (Is-Value -Value $Value) -or (Is-Collection -Value $Value))
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUICiyjxBewBLZ6r+DoKQLGcVi
# QMqgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46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BRMcjJhVf2RaETAwRASCgH2S9c/v/mzrRzHLnooNrAy/ov9gKSFhlzBraIv
# 8o9pfux42ctzoq2MJ4NmaE8h3l1qZxZnnvZRYHISsWllbCLvYTZRaWNDAlF9Ia7W
# M3pFsjhRp7pjB276ZXTE+R6O+WGZowhIZ7zPxKTEshibft7nkL7OSI23AvUnjz62
# c9Oug63hRPrdI3fZdcGfBp31Qg2K9hkbyMTqVjB4P/TMjdpVqjKjl3bEGTaultfc
# huM/08vetcld8iWyl7I/xOSyayy10+BXyzFu5GJzWT2PhA==
# SIG # End signature block
TOPIC
about_BeforeEach_AfterEach
SHORT DESCRIPTION
Describes the BeforeEach and AfterEach commands, which run a set of commands that you specify
before or after every It block.
LONG DESCRIPTION
The the BeforeEach and AfterEach commands in the Pester module let you define setup and teardown
tasks that are performed at the beginning and end of every It block. This can eliminate duplication of code
in test scripts, ensure that each test is performed on a pristine state regardless of their
order, and perform any necessary clean-up tasks after each test.
BeforeEach and AfterEach blocks may be defined inside of any Describe or Context. If they
are present in both a Context and its parent Describe, BeforeEach blocks in the Describe scope
are executed first, followed by BeforeEach blocks in the Context scope. AfterEach blocks are
the reverse of this, with the Context AfterEach blocks executing before Describe.
The script blocks assigned to BeforeEach and AfterEach are dot-sourced in the Context or Describe
which contains the current It statement, so you don't have to worry about the scope of variable
assignments. Any variables that are assigned values within a BeforeEach block can be used inside
the body of the It block.
BeforeAll and AfterAll are used the same way as BeforeEach and AfterEach, except that they are
executed at the beginning and end of their containing Describe or Context block. This is
essentially syntactic sugar for the following arrangement of code:
Describe 'Something' {
try
{
<BeforeAll Code Here>
<Describe Body>
}
finally
{
<AfterAll Code Here>
}
}
SYNTAX AND PLACEMENT
Unlike most of the commands in a Pester script, BeforeEach, AfterEach, BeforeAll and AfterAll blocks
apply to the entire Describe or Context scope in which they are defined, regardless of the order of
commands inside the Describe or Context. In other words, even if an It block appears before BeforeEach
or AfterEach in the tests file, the BeforeEach and AfterEach will still be executed. Likewise, BeforeAll
code will be executed at the beginning of a Context or Describe block regardless of where it is found,
and AfterAll code will execute at the end of the Context or Describe.
EXAMPLES
Describe 'Testing BeforeEach and AfterEach' {
$afterEachVariable = 'AfterEach has not been executed yet'
It 'Demonstrates that BeforeEach may be defined after the It command' {
$beforeEachVariable | Should -Be 'Set in a describe-scoped BeforeEach'
$afterEachVariable | Should -Be 'AfterEach has not been executed yet'
$beforeAllVariable | Should -Be 'BeforeAll has been executed'
}
It 'Demonstrates that AfterEach has executed after the end of the first test' {
$afterEachVariable | Should -Be 'AfterEach has been executed'
}
BeforeEach {
$beforeEachVariable = 'Set in a describe-scoped BeforeEach'
}
AfterEach {
$afterEachVariable = 'AfterEach has been executed'
}
BeforeAll {
$beforeAllVariable = 'BeforeAll has been executed'
}
}
SEE ALSO
about_Pester
about_Should
about_Mocking
about_TestDrive
about_about_Try_Catch_Finally
Describe
Context
Should
It
Invoke-Pester
TOPIC
about_Mocking
SHORT DESCRIPTION
Pester provides a set of Mocking functions making it easy to fake dependencies
and also to verify behavior. Using these mocking functions can allow you to
"shim" a data layer or mock other complex functions that already have their
own tests.
LONG DESCRIPTION
With the set of Mocking functions that Pester exposes, one can:
- Mock the behavior of ANY PowerShell command.
- Verify that specific commands were (or were not) called.
- Verify the number of times a command was called with a set of specified
parameters.
MOCKING FUNCTIONS
For detailed information about the functions in the Pester module, use Get-Help.
Mock
Mocks the behavior of an existing command with an alternate
implementation.
Assert-VerifiableMock
Checks if any Verifiable Mock has not been invoked. If so, this will
throw an exception.
Assert-MockCalled
Checks if a Mocked command has been called a certain number of times
and throws an exception if it has not.
EXAMPLE
function Build ($version) {
Write-Host "a build was run for version: $version"
}
function BuildIfChanged {
$thisVersion = Get-Version
$nextVersion = Get-NextVersion
if ($thisVersion -ne $nextVersion) { Build $nextVersion }
return $nextVersion
}
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
. "$here\$sut"
Describe "BuildIfChanged" {
Context "When there are Changes" {
Mock Get-Version {return 1.1}
Mock Get-NextVersion {return 1.2}
Mock Build {} -Verifiable -ParameterFilter {$version -eq 1.2}
$result = BuildIfChanged
It "Builds the next version" {
Assert-VerifiableMock
}
It "returns the next version number" {
$result | Should -Be 1.2
}
}
Context "When there are no Changes" {
Mock Get-Version { return 1.1 }
Mock Get-NextVersion { return 1.1 }
Mock Build {}
$result = BuildIfChanged
It "Should not build the next version" {
Assert-MockCalled Build -Times 0 -ParameterFilter {$version -eq 1.1}
}
}
}
MOCKING CALLS TO COMMANDS MADE FROM INSIDE SCRIPT MODULES
Let's say you have code like this inside a script module (.psm1 file):
function BuildIfChanged {
$thisVersion = Get-Version
$nextVersion = Get-NextVersion
if ($thisVersion -ne $nextVersion) { Build $nextVersion }
return $nextVersion
}
function Build ($version) {
Write-Host "a build was run for version: $version"
}
# Actual definitions of Get-Version and Get-NextVersion are not shown here,
# since we'll just be mocking them anyway. However, the commands do need to
# exist in order to be mocked, so we'll stick dummy functions here
function Get-Version { return 0 }
function Get-NextVersion { return 0 }
Export-ModuleMember -Function BuildIfChanged
Beginning in Pester 3.0, there are two ways to write a unit test for a module that
mocks the calls to Get-Version and Get-NextVersion from the module's BuildIfChanged
command. The first is to inject mocks into a module:
In these examples, the PSM1 file, MyModule.psm1 is installed in $env:PSModulePath on
the local computer.
Import-Module MyModule
Describe "BuildIfChanged" {
Context "When there are Changes" {
Mock -ModuleName MyModule Get-Version { return 1.1 }
Mock -ModuleName MyModule Get-NextVersion { return 1.2 }
# To demonstrate that you can mock calls to commands other than functions
# defined in the same module, we'll mock a call to Write-Host.
Mock -ModuleName MyModule Write-Host {} -Verifiable -ParameterFilter {
$Object -eq 'a build was run for version: 1.2'
}
$result = BuildIfChanged
It "Builds the next version and calls Write-Host" {
Assert-VerifiableMock
}
It "returns the next version number" {
$result | Should -Be 1.2
}
}
Context "When there are no Changes" {
Mock -ModuleName MyModule Get-Version { return 1.1 }
Mock -ModuleName MyModule Get-NextVersion { return 1.1 }
Mock -ModuleName MyModule Build { }
$result = BuildIfChanged
It "Should not build the next version" {
Assert-MockCalled Build -ModuleName MyModule -Times 0 -ParameterFilter {
$version -eq 1.1
}
}
}
}
In this sample test script, all calls to Mock and Assert-MockCalled have the
-ModuleName MyModule parameter added. This tells Pester to inject the mock into the module scope,
which causes any calls to those commands from inside the module to execute the mock instead.
When you write your test script this way, you can mock commands that are called by the module's
internal functions. However, your test script is still limited to accessing the public, exported
members of the module. For example, you could not call the Build function directly.
The InModuleScope command causes entire sections of your test script to execute inside the targeted
script module. This gives you access to unexported members of the module. For example:
Import-Module MyModule
Describe "Unit testing the module's internal Build function:" {
InModuleScope MyModule {
$testVersion = 5.0
Mock Write-Host { }
Build $testVersion
It 'Outputs the correct message' {
Assert-MockCalled Write-Host -ParameterFilter {
$Object -eq "a build was run for version: $testVersion"
}
}
}
}
When using InModuleScope, you no longer need to specify a ModuleName parameter when calling
Mock or Assert-MockCalled for commands in the module. You can also directly call the Build
function that the module does not export.
SEE ALSO
Mock
Assert-VerifiableMock
Assert-MockCalled
InModuleScope
Describe
Context
It
The following articles are useful for further understanding of Pester Mocks.
Pester Mock and Test Drive, by Jakub Jareš:
http://www.powershellmagazine.com/2014/09/30/pester-mock-and-testdrive/
Pester and Mocking, by Mickey Gousset:
http://www.systemcentercentral.com/day-53-pester-mocking/
Mocking Missing Cmdlets with Pester, by Iain Brighton:
http://virtualengine.co.uk/2015/mocking-missing-cmdlets-with-pester/
Testing Mocked Output with Pester, by Steven Murawski:
http://stevenmurawski.com/powershell/2014/02/testing-returned-objects-with-pester/
The following articles are useful for deeper understanding of Mocking in general.
Answer to the Question "What is the Purpose of Mock Objects" by Bert F:
http://stackoverflow.com/a/3623574/5514075
Mocks Aren't Stubs, by Martin Fowler:
http://martinfowler.com/articles/mocksArentStubs.html
The Art of Mocking, by Gil Zilberfeld:
http://www.methodsandtools.com/archive/archive.php?id=122
TOPIC
about_Pester
SHORT DESCRIPTION
Pester is a test framework for Windows PowerShell. Use the Pester language
and its commands to write and run tests that verify that your scripts and
modules work as designed.
Pester 3.4.0 supports Windows PowerShell 2.0 and greater.
LONG DESCRIPTION
Pester introduces a professional test framework for Windows PowerShell
commands. You can use Pester to test commands of any supported type,
including scripts, cmdlets, functions, CIM commands, workflows, and DSC
resources, and test these commands in modules of all types.
Each Pester test compares actual to expected output using a collection of
comparison operators that mirror the familiar operators in Windows
PowerShell. In this way, Pester supports "dynamic testing", that is, it
tests the code while it's running, instead of just evaluating code syntax
("static testing").
Once your Pester tests are written are verified to work correctly, you can
run them automatically or on demand to verify that the output didn't change
and that any code changes did not introduce errors. You can also add your
tests to the build scripts of a continuous integration system, and add new
tests at any time.
WHAT CAN PESTER TEST?
Pester is designed to support "test-driven development" (TDD), in which you
write and run tests before writing your code, thereby using the test as a
code specification.
It also supports "behavior-driven development" (BDD), in which the tests
verify the behavior and output of the code, and the user experience,
independent of its implementation. This lets you change the implementation
and use the test to verify that the behavior is unchanged.
You can use Pester to write "unit tests" that test individual functions in
isolation and "integration tests" that verify that functions can be used
together to generate expected results.
Pester creates and manages a temporary drive (PSDrive named TestDrive:) that
you can use to simulate a file system. For more information, see
about_TestDrive.
Pester also has "mocking" commands that replace the actual output of
commands with output that you specify. Mocking lets you test your commands
with varied input without creating and maintaining fake entries in a file
or database, or commenting-out and inserting code just for testing. For more
information, see about_Mocking.
THE PESTER LANGUAGE
To make it easier to write tests, Pester uses a language especially designed
for testing. This "domain-specific language" (DSL) hides the standard
verb-noun syntax of PowerShell commands.
To make the language more fluent, the command parameters are positional, so
you don't typically use parameter names.
For example, this "gets all widgets" test uses the Pester language,
including its "It", "Should", and "Be" commands. The test verifies that the
actual output of the Get-Widget cmdlet is the same as the expected value in
the $allWidgets variables.
It "gets all widgets" {
Get-Widget | Should -Be $allWidgets
}
To learn the Pester language, start by reading the following About and
cmdlet help topics:
-- Describe: Creates a required test container.
-- Context: Creates an optional scoped test sub-container.
-- It: Creates a test.
-- about_Should Compares actual to expected values. This topic also
lists all valid values of Be, which specify the
comparison operator used in the test.
HOW TO CREATE TEST FILES
To start using Pester, create a script and a test file that tests the
script. If you already have a script, you can create a test file for it.
Pester test files are Windows PowerShell scripts with a .Tests.ps1 file name
extension. The distinctive file name extension enables Pester to identify
tests and distinguish them from other scripts.
Typically, the test file and file it tests have the same base file name,
such as:
New-Log.ps1
New-Log.Tests.ps1
For a quick start, use the New-Fixture cmdlet in the Pester module. It
creates a script with an empty function and a matching test file with a
valid test.
For example, this command creates a New-Log.ps1 script and a
New-Log.Tests.ps1 test script in the C:\Scripts\LogScripts directory.
New-Fixture -Path C:\Scripts\LogScripts -Name New-Log
Directory: C:\Scripts\LogScripts
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 4/18/2016 9:51 AM 30 New-Log.ps1
-a---- 4/18/2016 9:51 AM 262 New-Log.Tests.ps1
The similar names do not automatically associate the test file and script
file. The test file must include code to import ("dot-source") the
functions, aliases, and variables in the script being tested into the scope
of the test script.
For example:
. .\New-Log.ps1
-or-
. C:\Scripts\LogScripts\New-Log.ps1
Many Pester test files, including the files that New-Fixture creates, begin with these
statements.
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
. "$here\$sut"
This code finds the current path of the test file at run time and saves it
in the $here variable. Then, it finds the script based on the path in $here.
This code assumes that the script has the same base name and is located in
the same directory as the test file.
You can use any code in the test file that finds the script, but be sure
that the test file has the required *.Tests.ps1 file name extension.
HOW TO RUN PESTER TESTS
Pester tests are Windows PowerShell scripts (.ps1 files), so you can run
them at the command line, or in any editor.
Pester also has an Invoke-Pester cmdlet with useful parameters. By default,
Invoke-Pester runs all the tests in a directory and all of its subdirectories
recursively, but you can run selected tests by specifying a script name or
name pattern, a test name, or a test tag.
Invoke-Pester parameters also let you save the test output in NUnitXml or
LegacyNUnitXml formats that are commonly used by reporting tools.
For example, the following command runs all tests in the current directory
and all subdirectories recursively. It writes output to the host, but does
not generate any objects.
Invoke-Pester
In contrast, this command runs only the tests in the New-Log.Tests.ps1 file
that have the 'EventVwr' tag. It writes the test results as custom objects
and saves them in NUnitXml format in the NewLogTests.xml file. It also runs
an optional code coverage test to verify that all lines in the script ran
at least once during the tests.
Invoke-Pester -Script C:\Tests\New-Log.Tests.ps1 `
-Tag EventVwr -OutputFile .\NewLogTests.xml -OutputFormat NUnitXml `
-CodeCoverage
To run the New-Log.Tests.ps1 file that New-Fixture created, change to its
local directory or a parent directory, and run Invoke-Pester. You can also
use the Script parameter of Invoke-Pester to run only the New-Log.Tests.ps1
test.
PS C:\Scripts> Invoke-Pester -Script .\New-Log.Tests.ps1
For more information about Invoke-Pester, type: Get-Help Invoke-Pester
EXAMPLE
For your first Pester test, use the New-Fixture cmdlet to create a script
file and matching test file.
For example:
New-Fixture -Path C:\TestPester -Name Get-Hello
Directory: C:\TestPester
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 4/18/2016 9:51 AM 30 Get-Hello.ps1
-a---- 4/18/2016 9:51 AM 262 Get-Hello.Tests.ps1
The Get-Hello.ps1 script contains an empty Get-Hello.ps1 function.
function Get-Hello {}
The Get-Hello.Tests.ps1 file contains an empty Pester test that is named
for the Get-Hello function.
Describe "Get-Hello" {
It "does something useful" {
$true | Should -Be $false
}
}
To run the test, use Invoke-Pester. For example,
Invoke-Pester C:\TestPester
When you run the test, it fails by design, because Should compares $True to
$False using the equal operator ("Be") and $True doesn't equal $False.
To start testing the Get-Hello function, change $True to Get-Hello and
$False to "Hello". Now, the test compares the output of Get-Hello output to
'hello'.
It should still fail, because Get-Hello doesn't return anything.
Describe "New-Log" {
It "does something useful" {
Get-Hello | Should -Be 'Hello'
}
}
To make the test pass, change the Get-Hello function so it returns 'hello'.
Then, in steps, change $False to more interesting values, then change the
Get-Hello function output to make the test pass.
You can also experiment with other comparison operators, such as the BeLike
(supports wildcards) and BeExactly (case sensitive), and BeLikeExactly
operators. For more, information about comparison operators in Pester, see
about_Should.
PESTER TEST OUTPUT
When you run a test, Pester use a variation of Write-Host to write
color-coded text to the console. You'll quickly learn to recognize the
purple test names and green (passing) and red (failing) test results with
the elapsed time of the test.
Describing Get-Profile
[+] Gets all profiles 156ms
[+] Gets only profiles 24ms
The output ends with a summary of the test results.
Tests completed in 3.47s
Passed: 20 Failed: 1 Skipped: 0 Pending: 0 Inconclusive: 0
However, because Pester uses Write-Host, it does not write to the output
stream (stdout), so there are no output objects to save in a variable or
redirect to a file.
To direct Pester to create custom objects, use its PassThru parameter. The
result is a single PSCustomObject with a TestResult property that one
TestResult custom object for each test in the test file.
To save the custom objects to a file, use the OutputFile and OutputFormat
parameters of Invoke-Pester, which save the output in NUnitXml and
LegacyNUnitXml formats that are easy to parse and commonly used by reporting
tools.
REAL-WORLD EXAMPLES
For help in writing Pester tests, examine the extensive collection of tests
that Pester uses to verify its Windows PowerShell code.
To find the Pester tests in the Pester module directory, type:
dir <Pester_module_path>\*Tests.ps1 -Recurse
-or-
dir (Get-Module Pester -ListAvailable).ModuleBase -Include *Tests.ps1 -Recurse
SEE ALSO
Pester wiki: https://github.com/pester/pester/wiki
Describe
Context
It
New-Fixture
Invoke-Pester
about_Mocking
about_Should
about_TestDrive
TOPIC
about_Should
SHORT DESCRIPTION
Provides assertion convenience methods for comparing objects and throwing
test failures when test expectations fail.
LONG DESCRIPTION
Should is an Extension of System.Object and can be used as a native type
inside Describe blocks. The various Should member methods can be invoked
directly from an object being compared. It is typically used in individual
It blocks to verify the results of an expectation. The Should method is
typically called from the "actual" object being compared and takes the
expected" object as a parameter. Should includes several members that
perform various comparisons of objects and will throw a PesterFailure when
the objects do not evaluate to be comparable.
SHOULD MEMBERS
GENERAL
Be
Compares one object with another for equality and throws if the two
objects are not the same.
$actual="Actual value"
$actual | Should -Be "actual value" # Test will pass
$actual | Should -Be "not actual value" # Test will fail
Also compares an entire array for equality and throws if the array is not the same.
$array = @(1, 2, 3, 4, 'I am a string', (New-Object psobject -Property @{ IAm = 'An Object' }))
$array | Should -Be $array # Test will pass
$string = 'I am a string'
$array = @(1, 2, 3, 4, $string)
$arrayWithCaps = @(1, 2, 3, 4, $string.ToUpper())
$array | Should -Be $arrayWithCaps # Test will pass
Comparisons will fail if the arrays have the same values, but not the same order.
[int32[]]$array = (1..10)
$arrayoutoforder = (1,10,2,3,4,5,6,7,8,9)
$array | Should -Be $arrayOutOfOrder # Test will fail
BeExactly
Compares one object with another for equality and throws if the two objects are not the same. This comparison is case sensitive.
$actual="Actual value"
$actual | Should -BeExactly "Actual value" # Test will pass
$actual | Should -BeExactly "actual value" # Test will fail
BeNullOrEmpty
Checks values for null or empty (strings). The static [String]::IsNullOrEmpty() method is used to do the comparison.
$null | Should -BeNullOrEmpty # Test will pass
$null | Should -Not -BeNullOrEmpty # Test will fail
@() | Should -BeNullOrEmpty # Test will pass
"" | Should -BeNullOrEmpty # Test will pass
BeTrue
Asserts that the value is true, or truthy.
$true | Should -BeTrue
1 | Should -BeTrue
1,2,3 | Should -BeTrue
BeFalse
Asserts that the value is false of falsy.
$false | Should -BeFalse
0 | Should -BeFalse
$null | Should -BeFalse
BeOfType, HaveType
Asserts that the actual value should be an object of a specified type (or a subclass of the specified type) using PowerShell's -is operator:
$actual = Get-Item $env:SystemRoot
$actual | Should -BeOfType System.IO.DirectoryInfo # Test will pass; object is a DirectoryInfo
$actual | Should -BeOfType System.IO.FileSystemInfo # Test will pass; DirectoryInfo base class is FileSystemInfo
$actual | Should -HaveType System.IO.FileSystemInfo # Test will pass; DirectoryInfo base class is FileSystemInfo
$actual | Should -BeOfType System.IO.FileInfo # Test will fail; FileInfo is not a base class of DirectoryInfo
TEXT
BeLike
Asserts that the actual value matches a wildcard pattern using PowerShell's -like operator. This comparison is not case-sensitive.
$actual="Actual value"
$actual | Should -BeLike "actual *" # Test will pass
$actual | Should -BeLike "not actual *" # Test will fail
BeLikeExactly
Asserts that the actual value matches a wildcard pattern using PowerShell's -like operator. This comparison is case-sensitive.
$actual="Actual value"
$actual | Should -BeLikeExactly "Actual *" # Test will pass
$actual | Should -BeLikeExactly "actual *" # Test will fail
Match
Uses a regular expression to compare two objects. This comparison is not case sensitive.
"I am a value" | Should -Match "I Am" # Test will pass
"I am a value" | Should -Match "I am a bad person" # Test will fail
Tip: Use [regex]::Escape("pattern") to match the exact text.
"Greg" | Should -Match ".reg" # Test will pass
"Greg" | Should -Match ([regex]::Escape(".reg")) # Test will fail
MatchExactly
Uses a regular expression to compare two objects. This comparison is case sensitive.
"I am a value" | Should -MatchExactly "I am" # Test will pass
"I am a value" | Should -MatchExactly "I Am" # Test will fail
COMPARISON
BeGreaterThan
Asserts that a number (or other comparable value) is greater than an expected value. Uses PowerShell's -gt operator to compare the two values.
2 | Should -BeGreaterThan 0
BeGreaterOrEqual
Asserts that a number (or other comparable value) is greater than or equal to an expected value. Uses PowerShell's -ge operator to compare the two values.
2 | Should -BeGreaterOrEqual 0
2 | Should -BeGreaterOrEqual 2
BeLessThan
Asserts that a number (or other comparable value) is lower than an expected value. Uses PowerShell's -lt operator to compare the two values.
1 | Should -BeLessThan 10
BeLessOrEqual
Asserts that a number (or other comparable value) is lower than, or equal to an expected value. Uses PowerShell's -le operator to compare the two values.
1 | Should -BeLessOrEqual 10
10 | Should -BeLessOrEqual 10
COLLECTION
BeIn
Asserts that a collection of values contain a specific value. Uses PowerShell's -contains operator to confirm.
1 | Should -BeIn @(1,2,3,'a','b','c')
Contain
Asserts that collection contains a specific value. Uses PowerShell's -contains operator to confirm.
1,2,3 | Should -Contain 1
HaveCount
Asserts that a collection has the expected amount of items.
1,2,3 | Should -HaveCount 3
FILE
Exist
Does not perform any comparison but checks if the object calling Exist
is present in a PS Provider. The object must have valid path syntax. It
essentially must pass a Test-Path call.
$actual=(Dir . )[0].FullName
Remove-Item $actual
$actual | Should -Exist # Test will fail
FileContentMatch
Checks to see if a file contains the specified text. This search is not case sensitive and uses regular expressions.
Set-Content -Path TestDrive:\file.txt -Value 'I am a file.'
'TestDrive:\file.txt' | Should -FileContentMatch 'I Am' # Test will pass
'TestDrive:\file.txt' | Should -FileContentMatch '^I.*file\.$' # Test will pass
'TestDrive:\file.txt' | Should -FileContentMatch 'I Am Not' # Test will fail
Tip: Use [regex]::Escape("pattern") to match the exact text.
Set-Content -Path TestDrive:\file.txt -Value 'I am a file.'
'TestDrive:\file.txt' | Should -FileContentMatch 'I.am.a.file' # Test will pass
'TestDrive:\file.txt' | Should -FileContentMatch ([regex]::Escape('I.am.a.file')) # Test will fail
FileContentMatchExactly
Checks to see if a file contains the specified text. This search is case sensitive and uses regular expressions to match the text.
Set-Content -Path TestDrive:\file.txt -Value 'I am a file.'
'TestDrive:\file.txt' | Should -FileContentMatch 'I am' # Test will pass
'TestDrive:\file.txt' | Should -FileContentMatch 'I Am' # Test will fail
FileContentMatchMultiline
As opposed to FileContentMatch and FileContentMatchExactly operators, FileContentMatchMultiline presents content of the file
being tested as one string object, so that the expression you are comparing it to can consist of several lines.
$Content = "I am the first line.`nI am the second line."
Set-Content -Path TestDrive:\file.txt -Value $Content -NoNewline
'TestDrive:\file.txt' | Should -FileContentMatchMultiline 'first line\.\r?\nI am' # Test will pass
'TestDrive:\file.txt' | Should -FileContentMatchMultiline '^I am the first.*\n.*second line\.$' # Test will pass.
When using FileContentMatchMultiline operator, '^' and '$' represent the beginning and end of the whole file,
instead of the beginning and end of a line.
$Content = "I am the first line.`nI am the second line."
Set-Content -Path TestDrive:\file.txt -Value $Content -NoNewline
'TestDrive:\file.txt' | Should -FileContentMatchMultiline '^I am the first line\.$' # Test will fail.
EXCEPTIONS
Throw
Checks if an exception was thrown. Enclose input in a script block.
{ foo } | Should -Throw # Test will pass
{ $foo = 1 } | Should -Throw # Test will fail
{ foo } | Should -Not -Throw # Test will fail
{ $foo = 1 } | Should -Not -Throw # Test will pass
Warning: The input object must be a ScriptBlock, otherwise it is processed outside of the assertion.
Get-Process -Name "process" -ErrorAction Stop | Should -Throw # Should pass, but the exception thrown by Get-Process causes the test to fail.
NEGATIVE ASSERTIONS
Any of the Should operators described above can be negated by using the word "Not" before the operator. For example:
'one' | Should -Not -Be 'Two'
{ Get-Item $env:SystemRoot } | Should -Not -Throw
USING SHOULD IN A TEST
function Add-Numbers($a, $b) {
return $a + $b
}
Describe "Add-Numbers" {
It "adds positive numbers" {
$sum = Add-Numbers 2 3
$sum | Should -Be 3
}
}
This test will fail since 3 will not be equal to the sum of 2 and 3.
BECAUSE
Every built in assertion allows you to specify -Because parameter, to give more meaning to your tests.
function Get-Group { $null }
$groups = 1..10 | Get-Group -Size 3
$groups | Should -HaveCount 4 -Because "because 10 items are split into three groups with 3 members and one extra group with 1 member"
Which fails with: "Expected a collection with size {4}, because 10 items are split into three groups with 3 members and one extra group with 1 member, but got collection with size {1} [].
SEE ALSO
Describe
Context
It
TOPIC
about_TestDrive
SHORT DESCRIPTION
A PSDrive for file activity limited to the scope of a singe Describe or
Context block.
LONG DESCRIPTION
A test may need to work with file operations and validate certain types of
file activities. It is usually desirable not to perform file activity tests
that will produce side effects outside of an individual test. Pester
creates a PSDrive inside the user's temporary drive that is accessible via a
names PSDrive TestDrive:. Pester will remove this drive after the test
completes. You may use this drive to isolate the file operations of your
test to a temporary store.
EXAMPLE
function Add-Footer($path, $footer) {
Add-Content $path -Value $footer
}
Describe "Add-Footer" {
$testPath="TestDrive:\test.txt"
Set-Content $testPath -value "my test text."
Add-Footer $testPath "-Footer"
$result = Get-Content $testPath
It "adds a footer" {
(-join $result).Should.Be("my test text.-Footer")
}
}
When this test completes, the contents of the TestDrive PSDrive will
be removed.
SEE ALSO
Context
Describe
It
about_Should
@{
ReportStrings = @{
HeaderMessage = 'Pester v{0}'
StartMessage = 'Executing all feature scenarios in ''{0}'''
FilterMessage = ' for scenarios matching ''{0}'''
TagMessage = ' with Tags ''{0}'''
MessageOfs = ''', '''
CoverageTitle = 'Code coverage report:'
CoverageMessage = 'Covered { 2:P2 } of { 3:N0 } analyzed { 0 } in { 4:N0 } { 1 }.'
MissedSingular = 'Missed command:'
MissedPlural = 'Missed commands:'
CommandSingular = 'Command'
CommandPlural = 'Commands'
FileSingular = 'File'
FilePlural = 'Files'
Feature = '{0}: {1}'
Background = '{0}: {1}'
ScenarioOutline = '{0}: {1}'
Examples = '{0}: {1}'
Scenario = '{0}: {1}'
Step = '{0} {1}'
Margin = ' '
Timing = '{0:m\ms\.fff\s}'
ScenarioSummary = '{0} scenarios ('
ScenariosFailed = '{0} failed'
ScenariosUndefined = '{0} undefined'
ScenariosPending = '{0} pending'
ScenariosPassed = '{0} passed'
StepsSummary = '{0} steps ('
StepsFailed = '{0} failed'
StepsUndefined = '{0} undefined'
StepsSkipped = '{0} skipped'
StepsPending = '{0} pending'
StepsPassed = '{0} passed'
}
ReportTheme = @{
Feature = 'Gray'
FeatureDescription = 'Gray'
Background = 'Gray'
BackgroundDescription = 'Gray'
ScenarioOutline = 'Gray'
ScenarioOutlineDescription = 'Gray'
ScenarioOutlineStep = 'DarkCyan'
ScenarioOutlineTableHeaderCell = 'Cyan'
Examples = 'Gray'
ExamplesDescription = 'Gray'
Scenario = 'Gray'
ScenarioDescription = 'Gray'
TableCellDivider = 'Gray'
TableCellValue = 'DarkCyan'
Pass = 'DarkGreen'
PassArgument = 'Green'
PassTime = 'DarkGray'
Fail = 'DarkRed'
FailArgument = 'Red'
FailTime = 'DarkGray'
Skipped = 'DarkCyan'
SkippedArgument = 'Cyan'
SkippedTime = 'DarkGray'
Pending = 'DarkYellow'
PendingArgument = 'Yellow'
PendingTime = 'DarkGray'
Undefined = 'DarkYellow'
UndefinedTime = 'DarkGray'
Foreground = 'Gray'
Information = 'DarkGray'
Coverage = 'Gray'
CoverageWarn = 'DarkRed'
}
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUcQcEXnlYD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QAEggEAM3pD/RU/TcyPCKTaETKOQodmTLeqB3TZW+nuXSIr
# kov9HSmPM60pmBzDJ+bjp7IiHHTpAeCiE1yBX0QvtzsZS0BZdXbCtxGva+VS4I4G
# 88W8vvk/Wwv2H+OyIxpnaG22cAoNgQOID6zPeZHa5sW/G7diWrFyZ/MNIyGqlq6w
# LNXazfG0JCWF9rLQepNn2CC9B5nPHGzixHtocEUbAW/YLBs7iarLjHig0p051lBU
# X8pT1f3TM9/JUgNWtVnWyPHE88PcRs+nG65ES0R9GW3XlDCRua7NVTCdxiF1Ibiy
# lI+p6AM+z0usR1OrYN9cdMANVmw6LRjRFX5SJpoNZgYgiw==
# SIG # End signature block
@{
HeaderMessage = 'Pester v{0}'
StartMessage = "Executing all tests in '{0}'"
FilterMessage = ' matching test name {0}'
TagMessage = ' with Tags {0}'
MessageOfs = "', '"
CoverageTitle = 'Code coverage report:'
CoverageMessage = 'Covered {2:P2} of {3:N0} analyzed {0} in {4:N0} {1}.'
MissedSingular = 'Missed command:'
MissedPlural = 'Missed commands:'
CommandSingular = 'Command'
CommandPlural = 'Commands'
FileSingular = 'File'
FilePlural = 'Files'
Describe = 'Describing {0}'
Script = 'Executing script {0}'
Context = 'Context {0}'
Margin = ' '
Timing = 'Tests completed in {0}'
# If this is set to an empty string, the count won't be printed
ContextsPassed = ''
ContextsFailed = ''
TestsPassed = 'Tests Passed: {0}, '
TestsFailed = 'Failed: {0}, '
TestsSkipped = 'Skipped: {0}, '
TestsPending = 'Pending: {0}, '
TestsInconclusive = 'Inconclusive: {0} '
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUunvUKhGWb1QMOlJ6KDc+xrIR
# dqygghR8MIIE/jCCA+ag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tqTLGah7tm9lPf
# KEi3mQQbDxC8kYfAQezk5yqM1SRke0T6gFZJZrFZOrbWqAk1xA0GL2TjHN8s7OdL
# CCoUtWL7sfS3D17GSFhcsy9SKHyjnWZ0rG+rYHVgHATAsyxfKIQLC78VFSPNpiS3
# Agag3pbYBQM9iIzXPSfmHybFi55va75Gh3qBIm1CP9k3zvvTwdwRLHV2EFuy5eX7
# NxVpjrf6aysTldtYn/xRh4LHm5QSowM44gLX4UCcC7MFjaNuUcef0f7J5G9Uz5cs
# TJlB2Qb4xrE3Fmt7JNiMVjvgACUjdTFjz9InwhABJck6qg==
# SIG # End signature block
#Be
function Should-Be ($ActualValue, $ExpectedValue, [switch] $Negate, [string] $Because) {
<#
.SYNOPSIS
Compares one object with another for equality
and throws if the two objects are not the same.
.EXAMPLE
$actual = "Actual value"
PS C:\>$actual | Should -Be "actual value"
This test will pass. -Be is not case sensitive.
For a case sensitive assertion, see -BeExactly.
.EXAMPLE
$actual = "Actual value"
PS C:\>$actual | Should -Be "not actual value"
This test will fail, as the two strings are not identical.
#>
[bool] $succeeded = ArraysAreEqual $ActualValue $ExpectedValue
if ($Negate) {
$succeeded = -not $succeeded
}
$failureMessage = ''
if (-not $succeeded) {
if ($Negate) {
$failureMessage = NotShouldBeFailureMessage -ActualValue $ActualValue -Expected $ExpectedValue -Because $Because
}
else {
$failureMessage = ShouldBeFailureMessage -ActualValue $ActualValue -Expected $ExpectedValue -Because $Because
}
}
return & $SafeCommands['New-Object'] psobject -Property @{
Succeeded = $succeeded
FailureMessage = $failureMessage
}
}
function ShouldBeFailureMessage($ActualValue, $ExpectedValue, $Because) {
# This looks odd; it's to unroll single-element arrays so the "-is [string]" expression works properly.
$ActualValue = $($ActualValue)
$ExpectedValue = $($ExpectedValue)
if (-not (($ExpectedValue -is [string]) -and ($ActualValue -is [string]))) {
return "Expected $(Format-Nicely $ExpectedValue),$(Format-Because $Because) but got $(Format-Nicely $ActualValue)."
}
<#joining the output strings to a single string here, otherwise I get
Cannot find an overload for "Exception" and the argument count: "4".
at line: 63 in C:\Users\nohwnd\github\pester\Functions\Assertions\Should.ps1
This is a quickwin solution, doing the join in the Should directly might be better
way of doing this. But I don't want to mix two problems.
#>
(Get-CompareStringMessage -Expected $ExpectedValue -Actual $ActualValue -Because $Because) -join "`n"
}
function NotShouldBeFailureMessage($ActualValue, $ExpectedValue, $Because) {
return "Expected $(Format-Nicely $ExpectedValue) to be different from the actual value,$(Format-Because $Because) but got the same value."
}
Add-AssertionOperator -Name Be `
-InternalName Should-Be `
-Test ${function:Should-Be} `
-Alias 'EQ' `
-SupportsArrayInput
#BeExactly
function Should-BeExactly($ActualValue, $ExpectedValue, $Because) {
<#
.SYNOPSIS
Compares one object with another for equality and throws if the
two objects are not the same. This comparison is case sensitive.
.EXAMPLE
$actual = "Actual value"
PS C:\>$actual | Should -Be "Actual value"
This test will pass. The two strings are identical.
.EXAMPLE
$actual = "Actual value"
PS C:\>$actual | Should -Be "actual value"
This test will fail, as the two strings do not match case sensitivity.
#>
[bool] $succeeded = ArraysAreEqual $ActualValue $ExpectedValue -CaseSensitive
if ($Negate) {
$succeeded = -not $succeeded
}
$failureMessage = ''
if (-not $succeeded) {
if ($Negate) {
$failureMessage = NotShouldBeExactlyFailureMessage -ActualValue $ActualValue -ExpectedValue $ExpectedValue -Because $Because
}
else {
$failureMessage = ShouldBeExactlyFailureMessage -ActualValue $ActualValue -ExpectedValue $ExpectedValue -Because $Because
}
}
return New-Object psobject -Property @{
Succeeded = $succeeded
FailureMessage = $failureMessage
}
}
function ShouldBeExactlyFailureMessage($ActualValue, $ExpectedValue, $Because) {
# This looks odd; it's to unroll single-element arrays so the "-is [string]" expression works properly.
$ActualValue = $($ActualValue)
$ExpectedValue = $($ExpectedValue)
if (-not (($ExpectedValue -is [string]) -and ($ActualValue -is [string]))) {
return "Expected exactly $(Format-Nicely $ExpectedValue),$(Format-Because $Because) but got $(Format-Nicely $ActualValue)."
}
<#joining the output strings to a single string here, otherwise I get
Cannot find an overload for "Exception" and the argument count: "4".
at line: 63 in C:\Users\nohwnd\github\pester\Functions\Assertions\Should.ps1
This is a quickwin solution, doing the join in the Should directly might be better
way of doing this. But I don't want to mix two problems.
#>
(Get-CompareStringMessage -Expected $ExpectedValue -Actual $ActualValue -CaseSensitive -Because $Because) -join "`n"
}
function NotShouldBeExactlyFailureMessage($ActualValue, $ExpectedValue, $Because) {
return "Expected $(Format-Nicely $ExpectedValue) to be different from the actual value,$(Format-Because $Because) but got exactly the same value."
}
Add-AssertionOperator -Name BeExactly `
-InternalName Should-BeExactly `
-Test ${function:Should-BeExactly} `
-Alias 'CEQ' `
-SupportsArrayInput
#common functions
function Get-CompareStringMessage {
param(
[Parameter(Mandatory = $true)]
[AllowEmptyString()]
[String]$ExpectedValue,
[Parameter(Mandatory = $true)]
[AllowEmptyString()]
[String]$Actual,
[switch]$CaseSensitive,
$Because
)
$ExpectedValueLength = $ExpectedValue.Length
$actualLength = $actual.Length
$maxLength = $ExpectedValueLength, $actualLength | & $SafeCommands['Sort-Object'] -Descending | & $SafeCommands['Select-Object'] -First 1
$differenceIndex = $null
for ($i = 0; $i -lt $maxLength -and ($null -eq $differenceIndex); ++$i) {
$differenceIndex = if ($CaseSensitive -and ($ExpectedValue[$i] -cne $actual[$i])) {
$i
}
elseif ($ExpectedValue[$i] -ne $actual[$i]) {
$i
}
}
if ($null -ne $differenceIndex) {
"Expected strings to be the same,$(Format-Because $Because) but they were different."
if ($ExpectedValue.Length -ne $actual.Length) {
"Expected length: $ExpectedValueLength"
"Actual length: $actualLength"
"Strings differ at index $differenceIndex."
}
else {
"String lengths are both $ExpectedValueLength."
"Strings differ at index $differenceIndex."
}
$ellipsis = "..."
$excerptSize = 5;
"Expected: '{0}'" -f ( $ExpectedValue | Format-AsExcerpt -startIndex $differenceIndex -excerptSize $excerptSize -excerptMarker $ellipsis | Expand-SpecialCharacters )
"But was: '{0}'" -f ( $actual | Format-AsExcerpt -startIndex $differenceIndex -excerptSize $excerptSize -excerptMarker $ellipsis | Expand-SpecialCharacters )
}
}
function Format-AsExcerpt {
param (
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
[AllowEmptyString()]
[string]$InputObject,
[Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)]
[int]$startIndex,
[Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)]
[int]$excerptSize,
[Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)]
[string]$excerptMarker
)
$InputObjectDisplay=""
$displayDifferenceIndex = $startIndex - $excerptSize
$maximumStringLength = 40
$maximumSubstringLength = $excerptSize * 2
$substringLength = $InputObject.Length - $displayDifferenceIndex
if ($substringLength -gt $maximumSubstringLength) {
$substringLength = $maximumSubstringLength
}
if ($displayDifferenceIndex + $substringLength -lt $InputObject.Length) {
$endExcerptMarker = $excerptMarker
}
if ($displayDifferenceIndex -lt 0) {
$displayDifferenceIndex = 0
}
if ($InputObject.length -ge $maximumStringLength) {
if ($displayDifferenceIndex -ne 0) {
$InputObjectDisplay = $excerptMarker
}
$InputObjectDisplay += $InputObject.Substring($displayDifferenceIndex, $substringLength) + $endExcerptMarker
}
else {
$InputObjectDisplay = $InputObject
}
$InputObjectDisplay
}
function Expand-SpecialCharacters {
param (
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
[AllowEmptyString()]
[string[]]$InputObject)
process {
$InputObject -replace "`n", "\n" -replace "`r", "\r" -replace "`t", "\t" -replace "`0", "\0" -replace "`b", "\b"
}
}
function ArraysAreEqual {
param (
[object[]] $First,
[object[]] $Second,
[switch] $CaseSensitive,
[int] $RecursionDepth = 0,
[int] $RecursionLimit = 100
)
$RecursionDepth++
if ($RecursionDepth -gt $RecursionLimit) {
throw "Reached the recursion depth limit of $RecursionLimit when comparing arrays $First and $Second. Is one of your arrays cyclic?"
}
# Do not remove the subexpression @() operators in the following two lines; doing so can cause a
# silly error in PowerShell v3. (Null Reference exception from the PowerShell engine in a
# method called CheckAutomationNullInCommandArgumentArray(System.Object[]) ).
$firstNullOrEmpty = ArrayOrSingleElementIsNullOrEmpty -Array @($First)
$secondNullOrEmpty = ArrayOrSingleElementIsNullOrEmpty -Array @($Second)
if ($firstNullOrEmpty -or $secondNullOrEmpty) {
return $firstNullOrEmpty -and $secondNullOrEmpty
}
if ($First.Count -ne $Second.Count) {
return $false
}
for ($i = 0; $i -lt $First.Count; $i++) {
if ((IsArray $First[$i]) -or (IsArray $Second[$i])) {
if (-not (ArraysAreEqual -First $First[$i] -Second $Second[$i] -CaseSensitive:$CaseSensitive -RecursionDepth $RecursionDepth -RecursionLimit $RecursionLimit)) {
return $false
}
}
else {
if ($CaseSensitive) {
$comparer = { param($Actual, $Expected) $Expected -ceq $Actual }
}
else {
$comparer = { param($Actual, $Expected) $Expected -eq $Actual }
}
if (-not (& $comparer $First[$i] $Second[$i])) {
return $false
}
}
}
return $true
}
function ArrayOrSingleElementIsNullOrEmpty {
param ([object[]] $Array)
return $null -eq $Array -or $Array.Count -eq 0 -or ($Array.Count -eq 1 -and $null -eq $Array[0])
}
function IsArray {
param ([object] $InputObject)
# Changing this could cause infinite recursion in ArraysAreEqual.
# see https://github.com/pester/Pester/issues/785#issuecomment-322794011
return $InputObject -is [Array]
}
function ReplaceValueInArray {
param (
[object[]] $Array,
[object] $Value,
[object] $NewValue
)
foreach ($object in $Array) {
if ($Value -eq $object) {
$NewValue
}
elseif (@($object).Count -gt 1) {
ReplaceValueInArray -Array @($object) -Value $Value -NewValue $NewValue
}
else {
$object
}
}
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUA9c23VB2YZe72DevXxLvvut/
# vfKgghR8MIIE/jCCA+agAwI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13Ve9YafGQEaL
# UZQVjL9KKhg7lV32P7Z15QPZ1b9CTg/6RLBZNXPt01YP2UtwjhOSyCcPQ6GKgLiF
# R2xfq88AoJIHbT/JrydNvFZkyd9YvrBZk2jmMWYjMOFdQl72BtubLOeS7FgNnH3R
# 7heYhvxY0q3a066bX6RgaHfsxRlErZLMKx+xMadSKwceixNlL4pWR/fb5tZosWpx
# dI9ML8aB6LgokqzNnrJatydMzdY4af8B+Tz028U479mEcmTSooU0L0242RXddpZp
# Kg7uFYsHR5GTDaQyonahC2cSZSrDc7TIHq2prK4rmCS5Xw==
# SIG # End signature block
function Should-BeGreaterThan($ActualValue, $ExpectedValue, [switch] $Negate, [string] $Because) {
<#
.SYNOPSIS
Asserts that a number (or other comparable value) is greater than an expected value.
Uses PowerShell's -gt operator to compare the two values.
.EXAMPLE
2 | Should -BeGreaterThan 0
This test passes, as PowerShell evaluates `2 -gt 0` as true.
#>
if ($Negate) {
return Should-BeLessOrEqual -ActualValue $ActualValue -ExpectedValue $ExpectedValue -Negate:$false -Because $Because
}
if ($ActualValue -le $ExpectedValue) {
return New-Object psobject -Property @{
Succeeded = $false
FailureMessage = "Expected the actual value to be greater than $(Format-Nicely $ExpectedValue),$(Format-Because $Because) but got $(Format-Nicely $ActualValue)."
}
}
return New-Object psobject -Property @{
Succeeded = $true
}
}
function Should-BeLessOrEqual($ActualValue, $ExpectedValue, [switch] $Negate, [string] $Because) {
<#
.SYNOPSIS
Asserts that a number (or other comparable value) is lower than, or equal to an expected value.
Uses PowerShell's -le operator to compare the two values.
.EXAMPLE
1 | Should -BeLessOrEqual 10
This test passes, as PowerShell evaluates `1 -le 10` as true.
.EXAMPLE
10 | Should -BeLessOrEqual 10
This test also passes, as PowerShell evaluates `10 -le 10` as true.
#>
if ($Negate) {
return Should-BeGreaterThan -ActualValue $ActualValue -ExpectedValue $ExpectedValue -Negate:$false -Because $Because
}
if ($ActualValue -gt $ExpectedValue) {
return New-Object psobject -Property @{
Succeeded = $false
FailureMessage = "Expected the actual value to be less than or equal to $(Format-Nicely $ExpectedValue),$(Format-Because $Because) but got $(Format-Nicely $ActualValue)."
}
}
return New-Object psobject -Property @{
Succeeded = $true
}
}
Add-AssertionOperator -Name BeGreaterThan `
-InternalName Should-BeGreaterThan `
-Test ${function:Should-BeGreaterThan} `
-Alias 'GT'
Add-AssertionOperator -Name BeLessOrEqual `
-InternalName Should-BeLessOrEqual `
-Test ${function:Should-BeLessOrEqual} `
-Alias 'LE'
#keeping tests happy
function ShouldBeGreaterThanFailureMessage() {
}
function NotShouldBeGreaterThanFailureMessage() {
}
function ShouldBeLessOrEqualFailureMessage() {
}
function NotShouldBeLessOrEqualFailureMessage() {
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUNzhWrZj1EvL4bWFmv5tSKNnQ
# sFygghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQQDExdEaWdpQ2VydCBUaW1lc3RhbXAgMjAyMTCCASIwDQYJKoZIhvcN
# AQEBBQADggEPADCCAQoCggEBAMLmYYRnxYr1DQikRcpja1HXOhFCvQp1dU2UtAxQ
# tSYQ/h3Ib5FrDJbnGlxI70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RveTQ6v2yOB+7nMC9kIk8N17GBASwS
# M3Vc87jxEKNHnlRD7FEJdIi++5/5hjRAm1RzeOGy9SGC/h4lAvny7H9yIPiZK41Y
# E154GTlCvLJOVTRrVEiJHdDyWH70M/RWcBC9ND/31vW6M+sneAr7M6neg/3OqqGC
# AjAwggIsBgkqhkiG9w0BCQYxggIdMIICGQIBATCBhjByMQswCQYDVQQGEwJVUzEV
# MBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29t
# MTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgVGltZXN0YW1waW5n
# IENBAhANQkrgvjqI/2BAIc4UAPDdMA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODA3WjAv
# BgkqhkiG9w0BCQQxIgQgdsQt5X0xm+0xRdKHWmJXI9MUOYF9RKfFGBhgwSenOWkw
# DQYJKoZIhvcNAQEBBQAEggEAFZCLC00TtEMHB2IR4zplJTOyVzGuzdwwFZWwlcOl
# 7bBS8Yiq/43gxeZ85lqItVpUvmiWKCUqTFk1Q432TcmZHEk57YNUFUM36xKI5Zx/
# gmnKQJuyiwqeDCv7qXHKQoie0eE1wG/HauWK4nv4pmpqoJY6lg1LFw+VEnQ5Sn3h
# U81/iMj9nD8YrrzuIl+hvhuj421PBKsgnh1Rc0wvaEPfdZd83ITypJazInAuoRwH
# A39buI0mkt79Ov6pB1Fs1hU8XdAvr75IrtKgUpFr/7HbQJAcLMnuu3IobVyHPUav
# 8dFzHwMpfA1l8BJRe8HoWLnn4nIQXbYbGPJWRGjln/fF+Q==
# SIG # End signature block
function Should-BeIn($ActualValue, $ExpectedValue, [switch] $Negate, [string] $Because) {
<#
.SYNOPSIS
Asserts that a collection of values contain a specific value.
Uses PowerShell's -contains operator to confirm.
.EXAMPLE
1 | Should -BeIn @(1,2,3,'a','b','c')
This test passes, as 1 exists in the provided collection.
#>
[bool] $succeeded = $ExpectedValue -contains $ActualValue
if ($Negate) {
$succeeded = -not $succeeded
}
if (-not $succeeded) {
if ($Negate) {
return New-Object psobject -Property @{
Succeeded = $false
FailureMessage = "Expected collection $(Format-Nicely $ExpectedValue) to not contain $(Format-Nicely $ActualValue),$(Format-Because $Because) but it was found."
}
}
else {
return New-Object psobject -Property @{
Succeeded = $false
FailureMessage = "Expected collection $(Format-Nicely $ExpectedValue) to contain $(Format-Nicely $ActualValue),$(Format-Because $Because) but it was not found."
}
}
}
return New-Object psobject -Property @{
Succeeded = $true
}
}
Add-AssertionOperator -Name BeIn `
-InternalName Should-BeIn `
-Test ${function:Should-BeIn}
function ShouldBeInFailureMessage() {
}
function NotShouldBeInFailureMessage() {
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUs/T5jprtM3OEJ8vvRjOKIfeX
# Da6gghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQQDExdEaWdpQ2VydCBUaW1lc3RhbXAgMjAyMTCCASIwDQYJKoZIhvcN
# AQEBBQADggEPADCCAQoCggEBA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p8taVdrxHKbirRyzlyZ
# mGldnMrienllzp+tQVUDbFV4Rk8/LLjFpp1CgydOw+hEXblRY4DySn7KuzI0dAqM
# 2tmn64rnbwkcygrnb3UDJEEBgAAzhWSbq5B7nGem60U9R5lOu4/KzlbSVZ5dDhCv
# PK1HuTB8bo1nild/Be1XLTrH8h5d5ISlcIeAwvSe04yOTMPPdGud/PrwrBkZkqGC
# AjAwggIsBgkqhkiG9w0BCQYxggIdMIICGQIBATCBhjByMQswCQYDVQQGEwJVUzEV
# MBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29t
# MTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgVGltZXN0YW1waW5n
# IENBAhANQkrgvjqI/2BAIc4UAPDdMA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODA3WjAv
# BgkqhkiG9w0BCQQxIgQgEdKsrHQZHCkj2zl9SWt86MsPk9p4KF4baLtkUmiyUT8w
# DQYJKoZIhvcNAQEBBQAEggEAk3E7xwaPwiVzjriDYRiIGGQdLngXCK9zrFMKRA1b
# 90IXwfdpHS/P93hZ90IWxqZUsM/LM/fR9Ux3yejBZJEW/d9dRQ7avBfuMtx1aK28
# +GhoCgKY+VB7zcE0KkBw3wErnY8KC4vMq1Y5SDNrMHarRIC+cMMXS89zPQ8CgSUz
# c0OG1YDPdx9yiUCE0PoI1fQLujTFKGY3mAlDGDmSdC2QgLhUdI2hOWCTIJTyAoOx
# zjLu+Yk+TVN0sXSlXR8olhvDSXkPTnK4s/oH3iH/OQNbPIxWyhgJewnBENRv5Iw2
# qF3fQDAC+NOYKqDwDbr3aUHFIkjXjd3ym19YnVGlb98rJA==
# SIG # End signature block
function Should-BeLessThan($ActualValue, $ExpectedValue, [switch] $Negate, [string] $Because) {
<#
.SYNOPSIS
Asserts that a number (or other comparable value) is lower than an expected value.
Uses PowerShell's -lt operator to compare the two values.
.EXAMPLE
1 | Should -BeLessThan 10
This test passes, as PowerShell evaluates `1 -lt 10` as true.
#>
if ($Negate) {
return Should-BeGreaterOrEqual -ActualValue $ActualValue -ExpectedValue $ExpectedValue -Negate:$false -Because $Because
}
if ($ActualValue -ge $ExpectedValue) {
return New-Object psobject -Property @{
Succeeded = $false
FailureMessage = "Expected the actual value to be less than $(Format-Nicely $ExpectedValue),$(Format-Because $Because) but got $(Format-Nicely $ActualValue)."
}
}
return New-Object psobject -Property @{
Succeeded = $true
}
}
function Should-BeGreaterOrEqual($ActualValue, $ExpectedValue, [switch] $Negate, [string] $Because) {
<#
.SYNOPSIS
Asserts that a number (or other comparable value) is greater than or equal to an expected value.
Uses PowerShell's -ge operator to compare the two values.
.EXAMPLE
2 | Should -BeGreaterOrEqual 0
This test passes, as PowerShell evaluates `2 -ge 0` as true.
.EXAMPLE
2 | Should -BeGreaterOrEqual 2
This test also passes, as PowerShell evaluates `2 -ge 2` as true.
#>
if ($Negate) {
return Should-BeLessThan -ActualValue $ActualValue -ExpectedValue $ExpectedValue -Negate:$false -Because $Because
}
if ($ActualValue -lt $ExpectedValue) {
return New-Object psobject -Property @{
Succeeded = $false
FailureMessage = "Expected the actual value to be greater than or equal to $(Format-Nicely $ExpectedValue),$(Format-Because $Because) but got $(Format-Nicely $ActualValue)."
}
}
return New-Object psobject -Property @{
Succeeded = $true
}
}
Add-AssertionOperator -Name BeLessThan `
-InternalName Should-BeLessThan `
-Test ${function:Should-BeLessThan} `
-Alias 'LT'
Add-AssertionOperator -Name BeGreaterOrEqual `
-InternalName Should-BeGreaterOrEqual `
-Test ${function:Should-BeGreaterOrEqual} `
-Alias 'GE'
#keeping tests happy
function ShouldBeLessThanFailureMessage() {
}
function NotShouldBeLessThanFailureMessage() {
}
function ShouldBeGreaterOrEqualFailureMessage() {
}
function NotShouldBeGreaterOrEqualFailureMessage() {
}
# SIG # Begin signature block
# MI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MA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODA3WjAv
# BgkqhkiG9w0BCQQxIgQgHnYhrqXOYju58yFzcwJSdjBXNZZ4On/xKzKE/YKT5tUw
# DQYJKoZIhvcNAQEBBQAEggEAkg/5Jbnz0YYy6T/9rbRbZr9RjzTRQ7USUWe1l2Kk
# 0lO4FbeYNdWEtFA+pVVuTDfb5+J5wYg4sDsi3zG3ZxemS39qp4eCqpuBx0EBxtQr
# yWfhaNhKqxN+M6/kFd7Tz/OcXobSnvlHxsO/Cwp4PzrYqC4qtN3IktfkWKPnJ6Dj
# KIY6foTc8mCf/9tOrgLgc/PYXCmdKUJgcVSOY+7dYmSB/iXQQAL7Swjs/yZ6UJ2G
# IjccxVu2tr6w54qHU7mdmqmVnm4r1XJHpnTM+3gq+1u/+79Ec42KSYTIWKelqlR3
# /iuKRGs7kJhM0GOWu8peuRyw8cAL1OFWslWZztH2KpPQxA==
# SIG # End signature block
function Should-BeLike($ActualValue, $ExpectedValue, [switch] $Negate, [String] $Because) {
<#
.SYNOPSIS
Asserts that the actual value matches a wildcard pattern using PowerShell's -like operator.
This comparison is not case-sensitive.
.EXAMPLE
$actual = "Actual value"
PS C:\>$actual | Should -BeLike "actual *"
This test will pass. -BeLike is not case sensitive.
For a case sensitive assertion, see -BeLikeExactly.
.EXAMPLE
$actual = "Actual value"
PS C:\>$actual | Should -BeLike "not actual *"
This test will fail, as the first string does not match the expected value.
#>
[bool] $succeeded = $ActualValue -like $ExpectedValue
if ($Negate) {
$succeeded = -not $succeeded
}
if (-not $succeeded) {
if ($Negate) {
return New-Object psobject -Property @{
Succeeded = $false
FailureMessage = "Expected like wildcard $(Format-Nicely $ExpectedValue) to not match $(Format-Nicely $ActualValue),$(Format-Because $Because) but it did match."
}
}
else {
return New-Object psobject -Property @{
Succeeded = $false
FailureMessage = "Expected like wildcard $(Format-Nicely $ExpectedValue) to match $(Format-Nicely $ActualValue),$(Format-Because $Because) but it did not match."
}
}
}
return New-Object psobject -Property @{
Succeeded = $true
}
}
Add-AssertionOperator -Name BeLike `
-InternalName Should-BeLike `
-Test ${function:Should-BeLike}
function ShouldBeLikeFailureMessage() {
}
function NotShouldBeLikeFailureMessage() {
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQU6f9XPmKmwDLM97pqTMzyNbwa
# Eu2gghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQQDExdEaWdpQ2VydCBUaW1lc3RhbXAgMjAyMTCCASIwDQYJKoZIhvcN
# AQEBBQADggEPADCCAQoCggEBAMLmYYRnxYr1DQikRcpja1HXOhFCvQp1dU2UtAxQ
# tSYQ/h3Ib5FrDJbnGlxI70Tlv5thzRWRYlq4/2cLnGP9NmqB+in43Stwhd4CGPN4
# bbx9+cdtCT2+anaH6Yq9+IRdHnbJ5MZ2djpT0dHTWjaPxqPhLxs6t2HWc+xObTOK
# fF1FLUuxUOZBOjdWhtyTI433UCXoZObd048vV7WHIOsOjizVI9r0TXhG4wODMSlK
# XAwxikqMiMX3MFr5FK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hjByMQswCQYDVQQGEwJVUzEV
# MBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29t
# MTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgVGltZXN0YW1waW5n
# IENBAhANQkrgvjqI/2BAIc4UAPDdMA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODA3WjAv
# BgkqhkiG9w0BCQQxIgQghBmnXETD4liUIgG2Na0ayDXA4b7FYOsQb9BbFGrfOekw
# DQYJKoZIhvcNAQEBBQAEggEAl4PwwlafypSWCwv9TDI5BuN4TAcZeTUgdwDxSIiJ
# nXO8ABOKX/vMY4Gcvm8pGCjN4bAl8kHp3zk+CLkl5E0LuEHsRSPECK93KVdvcELj
# KSo7wqJJyDIcnWFX4FHleCCPyd0rtWjH5gDFPlJpEqn+ZqFmxV+xh4GtDBlk91sF
# 3fyCimSSeQVd60RG6BN572PWWPiX0EDOCRPm+JyZOn0ZFQwf8aYT960eTFgBTUkX
# GCmMF18pSZdleGNP2ZiWt+Wo9tawtnqTd2iLnbptAvsLZQAHweaeliri7hrpmMLp
# ZSDWE6vJpX1Oj10ouYEB00eTSlTyLcPKtSTpMOuhkZwrwA==
# SIG # End signature block
function Should-BeLikeExactly($ActualValue, $ExpectedValue, [switch] $Negate, [String] $Because) {
<#
.SYNOPSIS
Asserts that the actual value matches a wildcard pattern using PowerShell's -like operator.
This comparison is case-sensitive.
.EXAMPLE
$actual = "Actual value"
PS C:\>$actual | Should -BeLikeExactly "Actual *"
This test will pass, as the string matches the provided pattern.
.EXAMPLE
$actual = "Actual value"
PS C:\>$actual | Should -BeLikeExactly "actual *"
This test will fail, as -BeLikeExactly is case-sensitive.
#>
[bool] $succeeded = $ActualValue -clike $ExpectedValue
if ($Negate) {
$succeeded = -not $succeeded
}
if (-not $succeeded) {
if ($Negate) {
return New-Object psobject -Property @{
Succeeded = $false
FailureMessage = "Expected case sensitive like wildcard $(Format-Nicely $ExpectedValue) to not match $(Format-Nicely $ActualValue),$(Format-Because $Because) but it did match."
}
}
else {
return New-Object psobject -Property @{
Succeeded = $false
FailureMessage = "Expected case sensitive like wildcard $(Format-Nicely $ExpectedValue) to match $(Format-Nicely $ActualValue),$(Format-Because $Because) but it did not match."
}
}
}
return New-Object psobject -Property @{
Succeeded = $true
}
}
Add-AssertionOperator -Name BeLikeExactly `
-InternalName Should-BeLikeExactly `
-Test ${function:Should-BeLikeExactly}
function ShouldBeLikeExactlyFailureMessage() {
}
function NotShouldBeLikeExactlyFailureMessage() {
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUGJ7sabsKt3Vkj8a6oqPBASOC
# anmgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQQDExdEaWdpQ2VydCBUaW1lc3RhbXAgMjAyMTCCASIwDQYJKoZIhvcN
# AQEBBQADggEPADCCAQoCggEBAMLmYYRnxYr1DQikRcpja1HXOhFCvQp1dU2UtAxQ
# tSYQ/h3Ib5FrDJbnGl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zkcNBs8te5TQXfkJ6hMN1fX
# mRJgwVrqbOI98Omp1DLswCTNYKwQSg851nhwNzxjoVxRhNGgszY+OZSSf4iEB7gW
# GTMr8ERebKbaJBqHH7PxzocaDn6wdPVoJJwQC4LZ4QT3Hljch0ZQLedbq5S0nKGC
# AjAwggIsBgkqhkiG9w0BCQYxggIdMIICGQIBATCBhjByMQswCQYDVQQGEwJVUzEV
# MBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29t
# MTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgVGltZXN0YW1waW5n
# IENBAhANQkrgvjqI/2BAIc4UAPDdMA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODA3WjAv
# BgkqhkiG9w0BCQQxIgQgmjDaagbSViNp9pZ8Uzng34ep+ixUv5HdiapDYJwIw+0w
# DQYJKoZIhvcNAQEBBQAEggEASz25Yc+p2x3O74jLHfziiaYNUil+eONnWlIe+hPY
# z+jh67grnuqXF/Jao6ThHic3oTHMByawEJBMYZC3YTKqKm5j8D96NLCMvbDoMcB8
# 1rcMiGiJ1u21h3moqWKjKFGlezsxwrCBsOg1TW4tjEKiWoLg7xmMHN6qvZXmoCxx
# c4tju/n2Nrr9E0EDjcIoraFOGZDRNwmxz539SnFCcJW8t5kCHC/TkGS6WLBcmWrV
# 3IA4kzzcAwg45zNLmdVqT7iZ75aHigr3P1ixK2yP5A2xh+ng/WCGHfGtgHKaOnMe
# NVL7JUp3kzfcwiJ3aQE9YJLZdmUQp8o6Gsk8AIfLRcAPoA==
# SIG # End signature block
function Should-BeNullOrEmpty([object[]] $ActualValue, [switch] $Negate, [string] $Because) {
<#
.SYNOPSIS
Checks values for null or empty (strings).
The static [String]::IsNullOrEmpty() method is used to do the comparison.
.EXAMPLE
$null | Should -BeNullOrEmpty
This test will pass. $null is null.
.EXAMPLE
$null | Should -Not -BeNullOrEmpty
This test will fail and throw an error.
.EXAMPLE
@() | Should -BeNullOrEmpty
An empty collection will pass this test.
.EXAMPLE
"" | Should -BeNullOrEmpty
An empty string will pass this test.
#>
if ($null -eq $ActualValue -or $ActualValue.Count -eq 0) {
$succeeded = $true
}
elseif ($ActualValue.Count -eq 1) {
$expandedValue = $ActualValue[0]
if ($expandedValue -is [hashtable]) {
$succeeded = $expandedValue.Count -eq 0
}
else {
$succeeded = [String]::IsNullOrEmpty($expandedValue)
}
}
else {
$succeeded = $false
}
if ($Negate) {
$succeeded = -not $succeeded
}
$failureMessage = ''
if (-not $succeeded) {
if ($Negate) {
$failureMessage = NotShouldBeNullOrEmptyFailureMessage -Because $Because
}
else {
$failureMessage = ShouldBeNullOrEmptyFailureMessage -ActualValue $ActualValue -Because $Because
}
}
return New-Object psobject -Property @{
Succeeded = $succeeded
FailureMessage = $failureMessage
}
}
function ShouldBeNullOrEmptyFailureMessage($ActualValue, $Because) {
return "Expected `$null or empty,$(Format-Because $Because) but got $(Format-Nicely $ActualValue)."
}
function NotShouldBeNullOrEmptyFailureMessage ($Because) {
return "Expected a value,$(Format-Because $Because) but got `$null or empty."
}
Add-AssertionOperator -Name BeNullOrEmpty `
-InternalName Should-BeNullOrEmpty `
-Test ${function:Should-BeNullOrEmpty} `
-SupportsArrayInput
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUoxNz23ji+jAAzt+ouf+RJFYR
# qOmgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcn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asHxjPdWzHRGcRKGqpfLN/1hmbax0xIkWBJZ649RKZfEtvNW8nQj3ZfMs
# GyI/Ls1MmybmzfJozzYZX5ja48gXzY7gJ8RaPQlrfkEWqCrTYXxQR0XeHzEX72QH
# ox/QRhrOU4ARGTo8ah/iWd3b4xrDZMqP+ZXqgH4VNx9kiVgywSNff3/LjAmWoDYs
# xnfucWhoe2lCkf3B5CJ/Tymoupfg2W0UjTVUc704JZeGGQ==
# SIG # End signature block
function Should-BeOfType($ActualValue, $ExpectedType, [switch] $Negate, [string]$Because) {
<#
.SYNOPSIS
Asserts that the actual value should be an object of a specified type
(or a subclass of the specified type) using PowerShell's -is operator.
.EXAMPLE
$actual = Get-Item $env:SystemRoot
PS C:\>$actual | Should -BeOfType System.IO.DirectoryInfo
This test passes, as $actual is a DirectoryInfo object.
.EXAMPLE
$actual | Should -BeOfType System.IO.FileSystemInfo
This test passes, as DirectoryInfo's base class is FileSystemInfo.
.EXAMPLE
$actual | Should -HaveType System.IO.FileSystemInfo
This test passes for the same reason, but uses the -HaveType alias instead.
.EXAMPLE
$actual | Should -BeOfType System.IO.FileInfo
This test will fail, as FileInfo is not a base class of DirectoryInfo.
#>
if ($ExpectedType -is [string]) {
# parses type that is provided as a string in brackets (such as [int])
$parsedType = ($ExpectedType -replace '^\[(.*)\]$', '$1') -as [Type]
if ($null -eq $parsedType) {
throw [ArgumentException]"Could not find type [$ParsedType]. Make sure that the assembly that contains that type is loaded."
}
$ExpectedType = $parsedType
}
$succeded = $ActualValue -is $ExpectedType
if ($Negate) {
$succeded = -not $succeded
}
$failureMessage = ''
if ($null -ne $ActualValue) {
$actualType = $ActualValue.GetType()
}
else {
$actualType = $null
}
if (-not $succeded) {
if ($Negate) {
$failureMessage = "Expected the value to not have type $(Format-Nicely $ExpectedType) or any of its subtypes,$(Format-Because $Because) but got $(Format-Nicely $ActualValue) with type $(Format-Nicely $actualType)."
}
else {
$failureMessage = "Expected the value to have type $(Format-Nicely $ExpectedType) or any of its subtypes,$(Format-Because $Because) but got $(Format-Nicely $ActualValue) with type $(Format-Nicely $actualType)."
}
}
return New-Object psobject -Property @{
Succeeded = $succeded
FailureMessage = $failureMessage
}
}
Add-AssertionOperator -Name BeOfType `
-InternalName Should-BeOfType `
-Test ${function:Should-BeOfType} `
-Alias 'HaveType'
function ShouldBeOfTypeFailureMessage() {
}
function NotShouldBeOfTypeFailureMessage() {
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUIMk8guo3eGnuj5/U11/rTf3E
# F0OgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQQDExdEaWdpQ2VydCBUaW1lc3RhbXAgMjAyMTCCASIwDQYJKoZIhvcN
# AQEBBQADggEPADCCAQoCggEBAMLmYYRnxYr1DQikRcpja1HXOhFCvQp1dU2UtAxQ
# tSYQ/h3Ib5FrDJbnGlxI70Tlv5thzRWRYlq4/2cLnGP9NmqB+in43Stwhd4CGPN4
# bbx9+cdtCT2+anaH6Yq9+IRdHnbJ5MZ2djpT0dHTWjaPxqPhLxs6t2HWc+xObTOK
# fF1FLUuxUOZBOjdWhtyTI433UCXoZObd048vV7WHIOsOjizVI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gkqhkiG9w0BCQYxggIdMIICGQIBATCBhjByMQswCQYDVQQGEwJVUzEV
# MBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29t
# MTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgVGltZXN0YW1waW5n
# IENBAhANQkrgvjqI/2BAIc4UAPDdMA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODA4WjAv
# BgkqhkiG9w0BCQQxIgQgtKgz9UGw67cOVfc0vrYTwYhtSB5EJ4zGWungRNSLIIQw
# DQYJKoZIhvcNAQEBBQAEggEAELvd/bJ85W4Fwps9XopJcUgNMBzLoZUMs7wEFMwh
# 58Df1B6HUzXaFLiIyT6/KwgWafGymDHvvJjAvIMCmtN5Sh0JjBIqxUEnZsFWg53Y
# uFws4WPHNqspxqyMkqyb4tk/ytcN+aBYtpTcnG63hRKQTdflTVbBlzP1p47k1gLs
# HC5iNmF3IId5Bsd5Bacz78f7hKFOCoc/oEOJrMI2qNoi6HgzEXKwrA2Y32qUp2Gb
# paqB5weaw8stmjYSwsU+JLc83V5VY2h31T95f3BZSpOFWqA78b9EfcCpjGRLGdQz
# mT5hxu2xtxgjojZV2f7LNnVYNBAU4pKal00iMFkJpjHZeA==
# SIG # End signature block
function Should-BeTrue($ActualValue, [switch] $Negate, [string] $Because) {
<#
.SYNOPSIS
Asserts that the value is true, or truthy.
.EXAMPLE
$true | Should -BeTrue
This test passes. $true is true.
.EXAMPLE
1 | Should -BeTrue
This test passes. 1 is true.
.EXAMPLE
1,2,3 | Should -BeTrue
PowerShell does not enter a `If (-not @(1,2,3)) {}` block.
This test passes as a "truthy" result.
#>
if ($Negate) {
return Should-BeFalse -ActualValue $ActualValue -Negate:$false -Because $Because
}
if (-not $ActualValue) {
$failureMessage = "Expected `$true,$(Format-Because $Because) but got $(Format-Nicely $ActualValue)."
return New-Object psobject -Property @{
Succeeded = $false
FailureMessage = $failureMessage
}
}
return New-Object psobject -Property @{
Succeeded = $true
}
}
function Should-BeFalse($ActualValue, [switch] $Negate, $Because) {
<#
.SYNOPSIS
Asserts that the value is false, or falsy.
.EXAMPLE
$false | Should -BeFalse
This test passes. $false is false.
.EXAMPLE
0 | Should -BeFalse
This test passes. 0 is false.
.EXAMPLE
$null | Should -BeFalse
PowerShell does not enter a `If ($null) {}` block.
This test passes as a "falsy" result.
#>
if ($Negate) {
return Should-BeTrue -ActualValue $ActualValue -Negate:$false -Because $Because
}
if ($ActualValue) {
$failureMessage = "Expected `$false,$(Format-Because $Because) but got $(Format-Nicely $ActualValue)."
return New-Object psobject -Property @{
Succeeded = $false
FailureMessage = $failureMessage
}
}
return New-Object psobject -Property @{
Succeeded = $true
}
}
Add-AssertionOperator -Name BeTrue `
-InternalName Should-BeTrue `
-Test ${function:Should-BeTrue}
Add-AssertionOperator -Name BeFalse `
-InternalName Should-BeFalse `
-Test ${function:Should-BeFalse}
# to keep tests happy
function ShouldBeTrueFailureMessage($ActualValue) {
}
function NotShouldBeTrueFailureMessage($ActualValue) {
}
function ShouldBeFalseFailureMessage($ActualValue) {
}
function NotShouldBeFalseFailureMessage($ActualValue) {
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUIkpJE6BOt9y5hyOSL1GLatdt
# 3YigghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTE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GePKPPEvDtU/xIrEFH9sbb29E2PhNNzZyA8+Q2FkFO2b0pnYsxDNsPK
# qYZSrb6JaqGtohQxSDQjz6S9Oo0a9rsqqAMvEKiiuF0vOUr8O78Xm+ceyEE/kBw6
# kDEHrwMLvWyRoz4tSADbB+wZJexX5McBjAfJvVwtMYSMEg==
# SIG # End signature block
function Should-Contain($ActualValue, $ExpectedValue, [switch] $Negate, [string] $Because) {
<#
.SYNOPSIS
Asserts that collection contains a specific value.
Uses PowerShell's -contains operator to confirm.
.EXAMPLE
1,2,3 | Should -Contain 1
This test passes, as 1 exists in the provided collection.
#>
[bool] $succeeded = $ActualValue -contains $ExpectedValue
if ($Negate) {
$succeeded = -not $succeeded
}
if (-not $succeeded) {
if ($Negate) {
return New-Object psobject -Property @{
Succeeded = $false
FailureMessage = "Expected $(Format-Nicely $ExpectedValue) to not be found in collection $(Format-Nicely $ActualValue),$(Format-Because $Because) but it was found."
}
}
else {
return New-Object psobject -Property @{
Succeeded = $false
FailureMessage = "Expected $(Format-Nicely $ExpectedValue) to be found in collection $(Format-Nicely $ActualValue),$(Format-Because $Because) but it was not found."
}
}
}
return New-Object psobject -Property @{
Succeeded = $true
}
}
Add-AssertionOperator -Name Contain `
-InternalName Should-Contain `
-Test ${function:Should-Contain} `
-SupportsArrayInput
function ShouldContainFailureMessage() {
}
function NotShouldContainFailureMessage() {
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUATXrSkUOxkTBKAsj/xC2G25W
# +nSgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMR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zuxb8Ol+F/7qgDooTYHV56Yrle2TAV8
# ZrAYNT2Tu+IOMUzGGZBzFw1r1i8dt9gadrueNqAAedn6OoKptcBqPCXvraQ82OOI
# 1U7SY6+usUUJvJ3uTQQb01VE7L6Kja/wyvG+I18cnY0XAOsjxf0hq0AHmXl6r033
# d3/0A+qeQivKRcc8YxJ/4HvGMezZlJJlni38cXyv6wC9AA==
# SIG # End signature block
function Should-Exist($ActualValue, [switch] $Negate, [string] $Because) {
<#
.SYNOPSIS
Does not perform any comparison, but checks if the object calling Exist is present in a PS Provider.
The object must have valid path syntax. It essentially must pass a Test-Path call.
.EXAMPLE
$actual = (Dir . )[0].FullName
PS C:\>Remove-Item $actual
PS C:\>$actual | Should -Exist
`Should -Exist` calls Test-Path. Test-Path expects a file,
returns $false because the file was removed, and fails the test.
#>
[bool] $succeeded = & $SafeCommands['Test-Path'] $ActualValue
if ($Negate) {
$succeeded = -not $succeeded
}
$failureMessage = ''
if (-not $succeeded) {
if ($Negate) {
$failureMessage = "Expected path $(Format-Nicely $ActualValue) to not exist,$(Format-Because $Because) but it did exist."
}
else {
$failureMessage = "Expected path $(Format-Nicely $ActualValue) to exist,$(Format-Because $Because) but it did not exist."
}
}
return & $SafeCommands['New-Object'] psobject -Property @{
Succeeded = $succeeded
FailureMessage = $failureMessage
}
}
Add-AssertionOperator -Name Exist `
-InternalName Should-Exist `
-Test ${function:Should-Exist}
function ShouldExistFailureMessage() {
}
function NotShouldExistFailureMessage() {
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUFHNJxYlCaLJvJlGn8mdQgQP+
# z2igghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0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2hH4T5uMRoOxOJuvY5r4WxtAwib7NdCGc+NQKIQrdsk
# g7YVPJ6S3UshbVurWOUZstx04XD2pmY1PS0xLgwq7trkaE7Yr8rPQagKJY9SP4dI
# OPJMIJiHOjL+5KwuAaHSxKQyMCOqoakuGsIu5Lh2RCLmpqHH6TpXVeE9vaprDxVq
# Neo97SrWmCnSO3R5f026oaomN74IhulM7XOerK/dsctd+Mkn5AbQFKKddlIH4Lv3
# bHkKpIUAkt96ryuwaT2dP9QkyyvRIQyHrA0skWUpyN4Erg==
# SIG # End signature block
function Should-FileContentMatch($ActualValue, $ExpectedContent, [switch] $Negate, $Because) {
<#
.SYNOPSIS
Checks to see if a file contains the specified text.
This search is not case sensitive and uses regular expressions.
.EXAMPLE
Set-Content -Path TestDrive:\file.txt -Value 'I am a file.'
PS C:\>'TestDrive:\file.txt' | Should -FileContentMatch 'I Am'
Create a new file and verify its content. This test passes.
The 'I Am' regular expression (RegEx) pattern matches against the txt file contents.
For case-sensitivity, see FileContentMatchExactly.
.EXAMPLE
'TestDrive:\file.txt' | Should -FileContentMatch '^I.*file\.$'
This RegEx pattern also matches against the "I am a file." string from Example 1.
With a matching RegEx pattern, this test also passes.
.EXAMPLE
'TestDrive:\file.txt' | Should -FileContentMatch 'I Am Not'
This test fails, as the RegEx pattern does not match "I am a file."
.EXAMPLE
'TestDrive:\file.txt' | Should -FileContentMatch 'I.am.a.file'
This test passes, because "." in RegEx matches any character including a space.
.EXAMPLE
'TestDrive:\file.txt' | Should -FileContentMatch ([regex]::Escape('I.am.a.file'))
Tip: Use [regex]::Escape("pattern") to match the exact text.
This test fails, because "I am a file." != "I.am.a.file"
#>
$succeeded = (@(& $SafeCommands['Get-Content'] -Encoding UTF8 $ActualValue) -match $ExpectedContent).Count -gt 0
if ($Negate) {
$succeeded = -not $succeeded
}
$failureMessage = ''
if (-not $succeeded) {
if ($Negate) {
$failureMessage = NotShouldFileContentMatchFailureMessage -ActualValue $ActualValue -ExpectedContent $ExpectedContent -Because $Because
}
else {
$failureMessage = ShouldFileContentMatchFailureMessage -ActualValue $ActualValue -ExpectedContent $ExpectedContent -Because $Because
}
}
return & $SafeCommands['New-Object'] psobject -Property @{
Succeeded = $succeeded
FailureMessage = $failureMessage
}
}
function ShouldFileContentMatchFailureMessage($ActualValue, $ExpectedContent, $Because) {
return "Expected $(Format-Nicely $ExpectedContent) to be found in file '$ActualValue',$(Format-Because $Because) but it was not found."
}
function NotShouldFileContentMatchFailureMessage($ActualValue, $ExpectedContent, $Because) {
return "Expected $(Format-Nicely $ExpectedContent) to not be found in file '$ActualValue',$(Format-Because $Because) but it was found."
}
Add-AssertionOperator -Name FileContentMatch `
-InternalName Should-FileContentMatch `
-Test ${function:Should-FileContentMatch}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQU4WIISJhmilLw7Pb4gqNq724z
# etmgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQQDExdEaWdpQ2VydCBUaW1lc3RhbXAgMjAyMTCCASIwDQYJKoZIhvcN
# AQEBBQADggEPADCCAQoCggEBAMLmYYRnxYr1DQikRcpja1HXOhFCvQp1dU2UtAxQ
# tSYQ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oAesy7FjEZfz+qiDvSbOv29JHe341IRrMDqxmO
# JW0KYtB0ygoOG61DnSqeUCAPSiVVIXqNx0NSnn+WCIEOuf2JqpGwtv04afE04cf1
# 1Q3WA2551q6wHrY+srPkh3J7qHxbWHBzCBqzkPdxunxGlhS745i5ygGya2JxGqGC
# AjAwggIsBgkqhkiG9w0BCQYxggIdMIICGQIBATCBhjByMQswCQYDVQQGEwJVUzEV
# MBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29t
# MTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgVGltZXN0YW1waW5n
# IENBAhANQkrgvjqI/2BAIc4UAPDdMA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODA5WjAv
# BgkqhkiG9w0BCQQxIgQgg6Z3Iivlw6S78B5pveRwFTL4dwqqUIvOeV1NFI1Y4rUw
# DQYJKoZIhvcNAQEBBQAEggEAWo5L7Lpq0d6JFO8ZDFeNT2zhBNU/1K1dss0TAdS4
# pZEPUNHBAgL5AS1fHz0cW+owM1gw0xeY0LEtqm3bgG1osmLRSi+xsc+Jx3apEk4J
# WCEmysLD8/FIxne2tu2TjCjY709QXl41U4/u1FyV/0GTHKR0RAKBZSavNpqcm2rz
# jD9CUxN0lxg60Zgp5LhLntY0m8hCc0DwQuRplzjI+TLJc4LILnptWhjpKI0s5+Jx
# iCGCvMUh9145Jpi9dbHg4bYIlkmsCBODVc4INvoNWI1coTUhSzTEPs2xXGGgvE87
# J/hH9mZARxVrDcqWfwEhlbZLXtC6LFIdGwqP4F9ocp428Q==
# SIG # End signature block
function Should-FileContentMatchExactly($ActualValue, $ExpectedContent, [switch] $Negate, [String] $Because) {
<#
.SYNOPSIS
Checks to see if a file contains the specified text.
This search is case sensitive and uses regular expressions to match the text.
.EXAMPLE
Set-Content -Path TestDrive:\file.txt -Value 'I am a file.'
PS C:\>'TestDrive:\file.txt' | Should -FileContentMatchExactly 'I am'
Create a new file and verify its content. This test passes.
The 'I am' regular expression (RegEx) pattern matches against the txt file contents.
.EXAMPLE
'TestDrive:\file.txt' | Should -FileContentMatchExactly 'I Am'
This test checks a case-sensitive pattern against the "I am a file." string from Example 1.
Because the RegEx pattern fails to match, this test fails.
#>
$succeeded = (@(& $SafeCommands['Get-Content'] -Encoding UTF8 $ActualValue) -cmatch $ExpectedContent).Count -gt 0
if ($Negate) {
$succeeded = -not $succeeded
}
$failureMessage = ''
if (-not $succeeded) {
if ($Negate) {
$failureMessage = NotShouldFileContentMatchExactlyFailureMessage -ActualValue $ActualValue -ExpectedContent $ExpectedContent -Because $Because
}
else {
$failureMessage = ShouldFileContentMatchExactlyFailureMessage -ActualValue $ActualValue -ExpectedContent $ExpectedContent -Because $Because
}
}
return & $SafeCommands['New-Object'] psobject -Property @{
Succeeded = $succeeded
FailureMessage = $failureMessage
}
}
function ShouldFileContentMatchExactlyFailureMessage($ActualValue, $ExpectedContent) {
return "Expected $(Format-Nicely $ExpectedContent) to be case sensitively found in file $(Format-Nicely $ActualValue),$(Format-Because $Because) but it was not found."
}
function NotShouldFileContentMatchExactlyFailureMessage($ActualValue, $ExpectedContent) {
return "Expected $(Format-Nicely $ExpectedContent) to not be case sensitively found in file $(Format-Nicely $ActualValue),$(Format-Because $Because) but it was found."
}
Add-AssertionOperator -Name FileContentMatchExactly `
-InternalName Should-FileContentMatchExactly `
-Test ${function:Should-FileContentMatchExactly}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUls7jxCA+j4XmhTiCgSiu6Cv0
# jKegghR8MIIE/jCC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L
# IiYxm4JVIS32ss43NlM9ZxFsz4uez/o4x8drEWe/rJargbkeGmfhfp5eoH/kgSYO
# V0Sf+0AvZU5Qq7PbwqdcGajUTAUEQ+uxUH8l0/fPxd7cDK2SmJ7pcaPIU3uKfZZ3
# CyIe7im5211jQOyPjYQuNjOD61c6S+PJcM/K/Faq54eyFBCDlLmIOVtHQ68Ks0C4
# eLnnP8CAJzYqJimL++F4sbqQ+rHQyGr4JWbXTtPEjkr6Zf7KFc9fw9zC9SEg7Gp4
# EzmVA2BPg0Fsz2je2sOZ6irsPpniN/+eZi0glB5qnk5Www==
# SIG # End signature block
function Should-FileContentMatchMultiline($ActualValue, $ExpectedContent, [switch] $Negate, [String] $Because) {
<#
.SYNOPSIS
As opposed to FileContentMatch and FileContentMatchExactly operators,
FileContentMatchMultiline presents content of the file being tested as one string object,
so that the expression you are comparing it to can consist of several lines.
When using FileContentMatchMultiline operator, '^' and '$' represent the beginning and end
of the whole file, instead of the beginning and end of a line.
.EXAMPLE
$Content = "I am the first line.`nI am the second line."
PS C:\>Set-Content -Path TestDrive:\file.txt -Value $Content -NoNewline
PS C:\>'TestDrive:\file.txt' | Should -FileContentMatchMultiline 'first line\.\r?\nI am'
This regular expression (RegEx) pattern matches the file contents, and the test passes.
.EXAMPLE
'TestDrive:\file.txt' | Should -FileContentMatchMultiline '^I am the first.*\n.*second line\.$'
Using the file from Example 1, this RegEx pattern also matches, and this test also passes.
.EXAMPLE
'TestDrive:\file.txt' | Should -FileContentMatchMultiline '^I am the first line\.$'
FileContentMatchMultiline uses the '$' symbol to match the end of the file,
not the end of any single line within the file. This test fails.
#>
$succeeded = [bool] ((& $SafeCommands['Get-Content'] $ActualValue -Delimiter ([char]0)) -match $ExpectedContent)
if ($Negate) {
$succeeded = -not $succeeded
}
$failureMessage = ''
if (-not $succeeded) {
if ($Negate) {
$failureMessage = NotShouldFileContentMatchMultilineFailureMessage -ActualValue $ActualValue -ExpectedContent $ExpectedContent -Because $Because
}
else {
$failureMessage = ShouldFileContentMatchMultilineFailureMessage -ActualValue $ActualValue -ExpectedContent $ExpectedContent -Because $Because
}
}
return New-Object psobject -Property @{
Succeeded = $succeeded
FailureMessage = $failureMessage
}
}
function ShouldFileContentMatchMultilineFailureMessage($ActualValue, $ExpectedContent, $Because) {
return "Expected $(Format-Nicely $ExpectedContent) to be found in file $(Format-Nicely $ActualValue),$(Format-Because $Because) but it was not found."
}
function NotShouldFileContentMatchMultilineFailureMessage($ActualValue, $ExpectedContent, $Because) {
return "Expected $(Format-Nicely $ExpectedContent) to not be found in file $(Format-Nicely $ActualValue),$(Format-Because $Because) but it was found."
}
Add-AssertionOperator -Name FileContentMatchMultiline `
-InternalName Should-FileContentMatchMultiline `
-Test ${function:Should-FileContentMatchMultiline}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQU3Gq8DK0AsXrptfqIsMI/X6bi
# dVqgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQQDExdEaWdpQ2VydCBUaW1lc3RhbXAgMjAyMTCCASIwDQYJKoZIhvcN
# AQEBBQADggEPADCCAQoCggEBAMLmYYRnxYr1DQikRcpja1HXOhFCv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P/KZ7SWn6ONAirl6PMJnNdGDxcg90QQOxhhyxiwlf+jewBnF/lv7B+4yIK32p5W
# B/fCToNLdNRGdU/nBzmEHTiB79n18oNQpYDqWfGTp506yF1D4h517nDiaPhc6jCb
# 7pLg41OlBeCMkJXBfEVQtPzWPqlr6IhPfozsyCame+3o//Yfmh0VEkybc7vN4aGC
# AjAwggIsBgkqhkiG9w0BCQYxggIdMIICGQIBATCBhjByMQswCQYDVQQGEwJVUzEV
# MBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29t
# MTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgVGltZXN0YW1waW5n
# IENBAhANQkrgvjqI/2BAIc4UAPDdMA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODA5WjAv
# BgkqhkiG9w0BCQQxIgQg0B2w2FnB718RZscL0QsKllNM8kG7GYnEcDypJBjN/ggw
# DQYJKoZIhvcNAQEBBQAEggEAY9yR1ysA3Xtv0f5ninjEDwHETHb18NBh+STWfxyu
# bh8Da5u6S7gXfvKtUywZ49GEXgBUfT14I55gps0bwR2I8HUST9PWYbP6XUGZy40A
# +5m/4qWm9oOKqD4lhiXhkmzmnO0r0boknzE4KXkzALXKRyY0bF+QGCyLYEzjrLI1
# xapg1wclV+I5v4ReFRmGrppGXwDwEtZI7IYyDnIqpVkaM/TpZXRbC4F7E2Zq4zPI
# swjQUnjnyA3PE9k2jeQ3qk5cJyGrDzXnt+S7vvXqu+yWhndDaZlGmYq0aWBL7A5k
# ve5/vzTUSkJpfsLpvfqYypHzjwYmKXfMtEQb+erCMycN2w==
# SIG # End signature block
function Should-HaveCount($ActualValue, [int] $ExpectedValue, [switch] $Negate, [string] $Because) {
<#
.SYNOPSIS
Asserts that a collection has the expected amount of items.
.EXAMPLE
1,2,3 | Should -HaveCount 3
This test passes, because it expected three objects, and received three.
This is like running `@(1,2,3).Count` in PowerShell.
#>
if ($ExpectedValue -lt 0) {
throw [ArgumentException]"Excpected collection size must be greater than or equal to 0."
}
$count = if ($null -eq $ActualValue) {
0
}
else {
$ActualValue.Count
}
$expectingEmpty = $ExpectedValue -eq 0
[bool] $succeeded = $count -eq $ExpectedValue
if ($Negate) {
$succeeded = -not $succeeded
}
if (-not $succeeded) {
if ($Negate) {
$expect = if ($expectingEmpty) {
"Expected a non-empty collection"
}
else {
"Expected a collection with size different from $(Format-Nicely $ExpectedValue)"
}
$but = if ($count -ne 0) {
"but got collection with that size $(Format-Nicely $ActualValue)."
}
else {
"but got an empty collection."
}
return New-Object psobject -Property @{
Succeeded = $false
FailureMessage = "$expect,$(Format-Because $Because) $but"
}
}
else {
$expect = if ($expectingEmpty) {
"Expected an empty collection"
}
else {
"Expected a collection with size $(Format-Nicely $ExpectedValue)"
}
$but = if ($count -ne 0) {
"but got collection with size $(Format-Nicely $count) $(Format-Nicely $ActualValue)."
}
else {
"but got an empty collection."
}
return New-Object psobject -Property @{
Succeeded = $false
FailureMessage = "$expect,$(Format-Because $Because) $but"
}
}
}
return New-Object psobject -Property @{
Succeeded = $true
}
}
Add-AssertionOperator -Name HaveCount `
-InternalName Should-HaveCount `
-Test ${function:Should-HaveCount} `
-SupportsArrayInput
function ShouldHaveCountFailureMessage() {
}
function NotShouldHaveCountFailureMessage() {
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUA9FZoIr/Qis+B3Uv7asGdjXX
# J9agghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGE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pQJEj0H/569Vru
# O9BJtUP0+RxryhjUYnkLwLhox5qn3xuZ7pze5Mvc9rbt2KKInyqqDwJAbBFU90qe
# KphLpvhM9uEQjHRe1bJ62aYN10IXciYgsBAkMpMJRtZjkNt89TAc22Tmz/QXvJx+
# myDoT4IGMCjt4OyfVSzc847E4AVCWwe10dJnthOcLdcRBduv6M3SeBtpRkjz3sE9
# Kpy6/eo0MJlyzTN8yRL3yihAiMF2CiAV8gK5kSTw6AiQSQ==
# SIG # End signature block
function Should-HaveParameter (
$ActualValue,
[String] $ParameterName,
$Type,
[String]$DefaultValue,
[Switch]$Mandatory,
[Switch]$HasArgumentCompleter,
[String]$Alias,
[Switch]$Negate,
[String]$Because ) {
<#
.SYNOPSIS
Asserts that a command has the expected parameter.
.EXAMPLE
Get-Command "Invoke-WebRequest" | Should -HaveParameter Uri -Mandatory
This test passes, because it expected the parameter URI to exist and to
be mandatory.
.NOTES
The attribute [ArgumentCompleter] was added with PSv5. Previouse this
assertion will not be able to use the -HasArgumentCompleter parameter
if the attribute does not exist.
#>
if ($null -eq $ActualValue -or $ActualValue -isnot [Management.Automation.CommandInfo]) {
throw "Input value must be non-null CommandInfo object. You can get one by calling Get-Command."
}
if ($null -eq $ParameterName) {
throw "The ParameterName can't be empty"
}
#region HelperFunctions
function Join-And ($Items, $Threshold = 2) {
if ($null -eq $items -or $items.count -lt $Threshold) {
$items -join ', '
}
else {
$c = $items.count
($items[0..($c - 2)] -join ', ') + ' and ' + $items[-1]
}
}
function Add-SpaceToNonEmptyString ([string]$Value) {
if ($Value) {
" $Value"
}
}
function Get-ParameterInfo {
param(
[Parameter( Mandatory = $true )]
[Management.Automation.CommandInfo]$Command
)
<#
.SYNOPSIS
Use Tokenize to get information about the parameter block of a command
.DESCRIPTION
In order to get information about the parameter block of a command,
several tools can be used (Get-Command, AST, etc).
In order to get the default value of a parameter, AST is the easiest
way to go; but AST was only introduced with PSv3.
This function creates an object with information about parameters
using the Tokenize
.NOTES
Author: Chris Dent
#>
function Get-TokenGroup {
param(
[Parameter( Mandatory = $true )]
[System.Management.Automation.PSToken[]]$tokens
)
$i = $j = 0
do {
$token = $tokens[$i]
if ($token.Type -eq 'GroupStart') {
$j++
}
if ($token.Type -eq 'GroupEnd') {
$j--
}
if (-not $token.PSObject.Properties.Item('Depth')) {
$token | Add-Member Depth -MemberType NoteProperty -Value $j
}
$token
$i++
} until ($j -eq 0 -or $i -ge $tokens.Count)
}
$errors = $null
$tokens = [System.Management.Automation.PSParser]::Tokenize($Command.Definition, [Ref]$errors)
# Find param block
$start = $tokens.IndexOf(($tokens | Where-Object { $_.Content -eq 'param' } | Select-Object -First 1)) + 1
$paramBlock = Get-TokenGroup $tokens[$start..($tokens.Count - 1)]
for ($i = 0; $i -lt $paramBlock.Count; $i++) {
$token = $paramBlock[$i]
if ($token.Depth -eq 1 -and $token.Type -eq 'Variable') {
$paramInfo = New-Object PSObject -Property @{
Name = $token.Content
} | Select-Object Name, Type, DefaultValue, DefaultValueType
if ($paramBlock[$i + 1].Content -ne ',') {
$value = $paramBlock[$i + 2]
if ($value.Type -eq 'GroupStart') {
$tokenGroup = Get-TokenGroup $paramBlock[($i + 2)..($paramBlock.Count - 1)]
$paramInfo.DefaultValue = [String]::Join('', ($tokenGroup | ForEach-Object { $_.Content }))
$paramInfo.DefaultValueType = 'Expression'
}
else {
$paramInfo.DefaultValue = $value.Content
$paramInfo.DefaultValueType = $value.Type
}
}
if ($paramBlock[$i - 1].Type -eq 'Type') {
$paramInfo.Type = $paramBlock[$i - 1].Content
}
$paramInfo
}
}
}
if ($Type -is [string]) {
# parses type that is provided as a string in brackets (such as [int])
$parsedType = ($Type -replace '^\[(.*)\]$', '$1') -as [Type]
if ($null -eq $parsedType) {
throw [ArgumentException]"Could not find type [$ParsedType]. Make sure that the assembly that contains that type is loaded."
}
$Type = $parsedType
}
#endregion HelperFunctions
$buts = @()
$filters = @()
$null = $ActualValue.Parameters # necessary for PSv2
$hasKey = $ActualValue.Parameters.PSBase.ContainsKey($ParameterName)
$filters += "to$(if ($Negate) {" not"}) have a parameter $ParameterName"
if (-not $Negate -and -not $hasKey) {
$buts += "the parameter is missing"
}
elseif ($Negate -and -not $hasKey) {
return New-Object PSObject -Property @{ Succeeded = $true }
}
elseif ($Negate -and $hasKey -and -not ($Mandatory -or $Type -or $DefaultValue -or $HasArgumentCompleter)) {
$buts += "the parameter exists"
}
else {
$attributes = $ActualValue.Parameters[$ParameterName].Attributes
if ($Mandatory) {
$testMandatory = $attributes | Where-Object { $_ -is [System.Management.Automation.ParameterAttribute] -and $_.Mandatory }
$filters += "which is$(if ($Negate) {" not"}) mandatory"
if (-not $Negate -and -not $testMandatory) {
$buts += "it wasn't mandatory"
}
elseif ($Negate -and $testMandatory) {
$buts += "it was mandatory"
}
}
if ($Type) {
# This block is not using `Format-Nicely`, as in PSv2 the output differs. Eg:
# PS2> [System.DateTime]
# PS5> [datetime]
[type]$actualType = $ActualValue.Parameters[$ParameterName].ParameterType
$testType = ($Type -eq $actualType)
$filters += "$(if ($Negate) {"not "})of type [$($Type.FullName)]"
if (-not $Negate -and -not $testType) {
$buts += "it was of type [$($actualType.FullName)]"
}
elseif ($Negate -and $testType) {
$buts += "it was of type [$($Type.FullName)]"
}
}
if ($PSBoundParameters.Keys -contains "DefaultValue") {
$parameterMetadata = Get-ParameterInfo $ActualValue | Where-Object { $_.Name -eq $ParameterName }
$actualDefault = if ($parameterMetadata.DefaultValue) { $parameterMetadata.DefaultValue } else { "" }
$testDefault = ($actualDefault -eq $DefaultValue)
$filters += "the default value$(if ($Negate) {" not"}) to be $(Format-Nicely $DefaultValue)"
if (-not $Negate -and -not $testDefault) {
$buts += "the default value was $(Format-Nicely $actualDefault)"
}
elseif ($Negate -and $testDefault) {
$buts += "the default value was $(Format-Nicely $DefaultValue)"
}
}
if ($HasArgumentCompleter) {
$testArgumentCompleter = $attributes | Where-Object { $_ -is [ArgumentCompleter] }
$filters += "has ArgumentCompletion"
if (-not $Negate -and -not $testArgumentCompleter) {
$buts += "has no ArgumentCompletion"
}
elseif ($Negate -and $testArgumentCompleter) {
$buts += "has ArgumentCompletion"
}
}
if ($Alias) {
$testPresenceOfAlias = $ActualValue.Parameters[$ParameterName].Aliases -contains $Alias
$filters += "to$(if ($Negate) {" not"}) have an alias '$Alias'"
if (-not $Negate -and -not $testPresenceOfAlias) {
$buts += "it didn't have an alias '$Alias'"
}
elseif ($Negate -and $testPresenceOfAlias) {
$buts += "it had an alias '$Alias'"
}
}
}
if ($buts.Count -ne 0) {
$filter = Add-SpaceToNonEmptyString ( Join-And $filters -Threshold 3 )
$but = Join-And $buts
$failureMessage = "Expected command $($ActualValue.Name)$filter,$(Format-Because $Because) but $but."
return New-Object PSObject -Property @{
Succeeded = $false
FailureMessage = $failureMessage
}
}
else {
return New-Object PSObject -Property @{ Succeeded = $true }
}
}
Add-AssertionOperator -Name HaveParameter `
-InternalName Should-HaveParameter `
-Test ${function:Should-HaveParameter}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUM6HED6a/kAA4b+HhWzsaWlhU
# 9b2gghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQQDExdEaWd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w==
# SIG # End signature block
function Should-Match($ActualValue, $RegularExpression, [switch] $Negate, [string] $Because) {
<#
.SYNOPSIS
Uses a regular expression to compare two objects.
This comparison is not case sensitive.
.EXAMPLE
"I am a value" | Should -Match "I Am"
The "I Am" regular expression (RegEx) pattern matches the provided string,
so the test passes. For case sensitive matches, see MatchExactly.
.EXAMPLE
"I am a value" | Should -Match "I am a bad person" # Test will fail
RegEx pattern does not match the string, and the test fails.
.EXAMPLE
"Greg" | Should -Match ".reg" # Test will pass
This test passes, as "." in RegEx matches any character.
.EXAMPLE
"Greg" | Should -Match ([regex]::Escape(".reg"))
One way to provide literal characters to Match is the [regex]::Escape() method.
This test fails, because the pattern does not match a period symbol.
#>
[bool] $succeeded = $ActualValue -match $RegularExpression
if ($Negate) {
$succeeded = -not $succeeded
}
$failureMessage = ''
if (-not $succeeded) {
if ($Negate) {
$failureMessage = NotShouldMatchFailureMessage -ActualValue $ActualValue -RegularExpression $RegularExpression -Because $Because
}
else {
$failureMessage = ShouldMatchFailureMessage -ActualValue $ActualValue -RegularExpression $RegularExpression -Because $Because
}
}
return New-Object psobject -Property @{
Succeeded = $succeeded
FailureMessage = $failureMessage
}
}
function ShouldMatchFailureMessage($ActualValue, $RegularExpression, $Because) {
return "Expected regular expression $(Format-Nicely $RegularExpression) to match $(Format-Nicely $ActualValue),$(Format-Because $Because) but it did not match."
}
function NotShouldMatchFailureMessage($ActualValue, $RegularExpression, $Because) {
return "Expected regular expression $(Format-Nicely $RegularExpression) to not match $(Format-Nicely $ActualValue),$(Format-Because $Because) but it did match."
}
Add-AssertionOperator -Name Match `
-InternalName Should-Match `
-Test ${function:Should-Match}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFA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oZIhvcNAQEBBQAEggEAwPVKdSX6Cat4ajOXkhLTRRrleed3ZpSM7XWchuOx
# /ve+t2/WySRx4GrR6GbNSwR8dMC9RMcJgTTer2IQXLNOvxnHKzgRLSnbdIHjfynf
# 3ed0vT4hb0bkjDwfAvyXgvp3N84EHwj5FkO/oefdM+RPI6M1h8EO208D3K5vDR2y
# FTFGhVSFeKWgrqVm23YoxnoHpWLt1bPfMyS0v05sCIyXAWXG5Mrod72Nb0iGjaaV
# 2RWacEQK+imggUypomICDwtj1fpozcqY6JIYer9jk+Gwo14Tlja6Z8aUFSs/z4TA
# Oabkf5CgVucq+322oyob6Y6tDgcwhlRE3gb0Q9YJnf+JKg==
# SIG # End signature block
function Should-MatchExactly($ActualValue, $RegularExpression, [switch] $Negate, [string] $Because) {
<#
.SYNOPSIS
Uses a regular expression to compare two objects.
This comparison is case sensitive.
.EXAMPLE
"I am a value" | Should -MatchExactly "I am"
The "I am" regular expression (RegEx) pattern matches the string.
This test passes.
.EXAMPLE
"I am a value" | Should -MatchExactly "I Am"
Because MatchExactly is case sensitive, this test fails.
For a case insensitive test, see Match.
#>
[bool] $succeeded = $ActualValue -cmatch $RegularExpression
if ($Negate) {
$succeeded = -not $succeeded
}
$failureMessage = ''
if (-not $succeeded) {
if ($Negate) {
$failureMessage = NotShouldMatchExactlyFailureMessage -ActualValue $ActualValue -RegularExpression $RegularExpression -Because $Because
}
else {
$failureMessage = ShouldMatchExactlyFailureMessage -ActualValue $ActualValue -RegularExpression $RegularExpression -Because $Because
}
}
return New-Object psobject -Property @{
Succeeded = $succeeded
FailureMessage = $failureMessage
}
}
function ShouldMatchExactlyFailureMessage($ActualValue, $RegularExpression) {
return "Expected regular expression $(Format-Nicely $RegularExpression) to case sensitively match $(Format-Nicely $ActualValue),$(Format-Because $Because) but it did not match."
}
function NotShouldMatchExactlyFailureMessage($ActualValue, $RegularExpression) {
return "Expected regular expression $(Format-Nicely $RegularExpression) to not case sensitively match $(Format-Nicely $ActualValue),$(Format-Because $Because) but it did match."
}
Add-AssertionOperator -Name MatchExactly `
-InternalName Should-MatchExactly `
-Test ${function:Should-MatchExactly} `
-Alias 'CMATCH'
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUjNVNFdeoBKU7ojzuW1WBBhgi
# WG6gghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQQDExdEaWdpQ2VydCBUaW1lc3RhbXAgMjAyMTCCASIwDQYJKoZIhvcN
# AQEBBQADggEPADCCAQoCggEBAMLmYYRnxYr1DQikRcpja1HXOhFCvQp1dU2UtAxQ
# tSYQ/h3Ib5FrDJbnGlxI70Tlv5thzRWRYlq4/2cLnGP9NmqB+in43Stwhd4CGPN4
# bbx9+cdtCT2+anaH6Yq9+IRdHnbJ5MZ2djpT0dHTWjaPxqPhLxs6t2HWc+xObTOK
# fF1FLUuxUOZBOjdWhtyTI433UCXoZObd048vV7WHIOsOjizVI9r0TXhG4wODMSlK
# XAwxikqMiMX3MFr5FK8VX2xDSQn9JiNT9o1j6BqrW7EdMMKbaYK02/xWVLwfoYer
# vnpbCiAvSwnJlaeNsvrWY4tOpXIc7p96AXP4Gdb+D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MTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgVGltZXN0YW1waW5n
# IENBAhANQkrgvjqI/2BAIc4UAPDdMA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODEwWjAv
# BgkqhkiG9w0BCQQxIgQgBTobbvP1mfyMLGfkw9dP47zQIbiA6wp9FRx5nOuDI9Qw
# DQYJKoZIhvcNAQEBBQAEggEABYEZifzrCviLFt5TInWYzQicZQDz3JtCqUVLETFY
# UaFZxM9evUTgOi1C6cOeqeJB1NmQUfaX/AbbiZGhDeaj/uv51DRuhxOzuzqD4Gtp
# S79Sox0jboUyPi1FxpDJaryjCaHMQug5PYUqXTC5AAGZtnK99CjQYeUjtDxuf48L
# 6jt6RF6bxeYUSp/3s5fOgFxfnM34LCDcXwelcZTRoAHuq6++5kNVxaWQDC7/Rw8Y
# oMClGymCIPzU9fBZ+HoPOZlAouSKg1zztQ7CbunnMTb3Y4SZ3oVH7HWQvKfYVZu6
# zqm/7X0awENkXHnJVY3FTvgcym+jBNlQ0eLyU90qnUqw9g==
# SIG # End signature block
function Should-Throw([scriptblock] $ActualValue, $ExpectedMessage, $ErrorId, [type]$ExceptionType, [switch] $Negate, [string] $Because, [switch] $PassThru) {
<#
.SYNOPSIS
Checks if an exception was thrown. Enclose input in a script block.
Warning: The input object must be a ScriptBlock, otherwise it is processed outside of the assertion.
.EXAMPLE
{ foo } | Should -Throw
Because "foo" isn't a known command, PowerShell throws an error.
Throw confirms that an error occurred, and successfully passes the test.
.EXAMPLE
{ foo } | Should -Not -Throw
By using -Not with -Throw, the opposite effect is achieved.
"Should -Not -Throw" expects no error, but one occurs, and the test fails.
.EXAMPLE
{ $foo = 1 } | Should -Throw
Assigning a variable does not throw an error.
If asserting "Should -Throw" but no error occurs, the test fails.
.EXAMPLE
{ $foo = 1 } | Should -Not -Throw
Assert that assigning a variable should not throw an error.
It does not throw an error, so the test passes.
#>
$actualExceptionMessage = ""
$actualExceptionWasThrown = $false
$actualError = $null
$actualException = $null
$actualExceptionLine = $null
if ($null -eq $ActualValue) {
throw (New-Object -TypeName ArgumentNullException -ArgumentList "ActualValue", "Scriptblock not found. Input to 'Throw' and 'Not Throw' must be enclosed in curly braces.")
}
try {
do {
Write-ScriptBlockInvocationHint -Hint "Should -Throw" -ScriptBlock $ActualValue
$null = & $ActualValue
} until ($true)
}
catch {
$actualExceptionWasThrown = $true
$actualError = $_
$actualException = $_.Exception
$actualExceptionMessage = $_.Exception.Message
$actualErrorId = $_.FullyQualifiedErrorId
$actualExceptionLine = (Get-ExceptionLineInfo $_.InvocationInfo) -replace [System.Environment]::NewLine, "$([System.Environment]::NewLine) "
}
[bool] $succeeded = $false
if ($Negate) {
# this is for Should -Not -Throw. Once *any* exception was thrown we should fail the assertion
# there is no point in filtering the exception, because there should be none
$succeeded = -not $actualExceptionWasThrown
if (-not $succeeded) {
$failureMessage = "Expected no exception to be thrown,$(Format-Because $Because) but an exception `"$actualExceptionMessage`" was thrown $actualExceptionLine."
return New-Object psobject -Property @{
Succeeded = $succeeded
FailureMessage = $failureMessage
}
}
else {
return New-Object psobject -Property @{
Succeeded = $true
}
}
}
# the rest is for Should -Throw, we must fail the assertion when no exception is thrown
# or when the exception does not match our filter
function Join-And ($Items, $Threshold = 2) {
if ($null -eq $items -or $items.count -lt $Threshold) {
$items -join ', '
}
else {
$c = $items.count
($items[0..($c - 2)] -join ', ') + ' and ' + $items[-1]
}
}
function Add-SpaceToNonEmptyString ([string]$Value) {
if ($Value) {
" $Value"
}
}
$buts = @()
$filters = @()
$filterOnExceptionType = $null -ne $ExceptionType
if ($filterOnExceptionType) {
$filters += "with type $(Format-Nicely $ExceptionType)"
if ($actualExceptionWasThrown -and $actualException -isnot $ExceptionType) {
$buts += "the exception type was $(Format-Nicely ($actualException.GetType()))"
}
}
$filterOnMessage = -not [string]::IsNullOrEmpty($ExpectedMessage -replace "\s")
if ($filterOnMessage) {
$filters += "with message $(Format-Nicely $ExpectedMessage)"
if ($actualExceptionWasThrown -and (-not (Get-DoValuesMatch $actualExceptionMessage $ExpectedMessage))) {
$buts += "the message was $(Format-Nicely $actualExceptionMessage)"
}
}
$filterOnId = -not [string]::IsNullOrEmpty($ErrorId -replace "\s")
if ($filterOnId) {
$filters += "with FullyQualifiedErrorId $(Format-Nicely $ErrorId)"
if ($actualExceptionWasThrown -and (-not (Get-DoValuesMatch $actualErrorId $ErrorId))) {
$buts += "the FullyQualifiedErrorId was $(Format-Nicely $actualErrorId)"
}
}
if (-not $actualExceptionWasThrown) {
$buts += "no exception was thrown"
}
if ($buts.Count -ne 0) {
$filter = Add-SpaceToNonEmptyString ( Join-And $filters -Threshold 3 )
$but = Join-And $buts
$failureMessage = "Expected an exception,$filter to be thrown,$(Format-Because $Because) but $but. $actualExceptionLine".Trim()
return New-Object psobject -Property @{
Succeeded = $false
FailureMessage = $failureMessage
}
}
$result = New-Object psobject -Property @{
Succeeded = $true
}
if ($PassThru) {
$result | Add-Member -MemberType NoteProperty -Name 'Data' -Value $actualError
}
return $result
}
function Get-DoValuesMatch($ActualValue, $ExpectedValue) {
#user did not specify any message filter, so any message matches
if ($null -eq $ExpectedValue ) {
return $true
}
return $ActualValue.ToString().IndexOf($ExpectedValue, [System.StringComparison]::InvariantCultureIgnoreCase) -ge 0
}
function Get-ExceptionLineInfo($info) {
# $info.PositionMessage has a leading blank line that we need to account for in PowerShell 2.0
$positionMessage = $info.PositionMessage -split '\r?\n' -match '\S' -join [System.Environment]::NewLine
return ($positionMessage -replace "^At ", "from ")
}
function ShouldThrowFailureMessage {
# to make the should tests happy, for now
}
function NotShouldThrowFailureMessage {
# to make the should tests happy, for now
}
Add-AssertionOperator -Name Throw `
-InternalName Should-Throw `
-Test ${function:Should-Throw}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisG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9w0BCQUxDxcNMjEwNTI5MTIyODEwWjAv
# BgkqhkiG9w0BCQQxIgQgSNyhxV/H+H9IOFkoOIqbJd0NiCTXPcOUtrJknESOUsww
# DQYJKoZIhvcNAQEBBQAEggEAKXxAu2ZPrJG2MWNZd5ocIb2/X6Q18EhR8IdbYXvN
# FRHiCOZ5rY/ojxrYr6+dzop5TM21xuMU0DZz75HPabBjb9PftJUyIOVkNNSYHEcj
# amY0U/U2A8VPOWH2pf9e/CSPjJs6JqPUSoJPNyBAmqrI87Il3l11mgYA272MNLJT
# 718ERhNb/Wn6h0A3O5kI5nTMBiIjLGmUVtwtSlw0f8dtK2+Qr08aQ+8LMuOCxJnh
# 6o7C1hhU/Wf7m8UTfOO3vCiv6ncm/7zESeCd+rVli+FWmMJFV1st/2l5qcXlAT/B
# +LjQdprYnejviFnHUVhJNpwJn4YNSTjCeuuCMYnVLGtG9Q==
# SIG # End signature block
function Set-TestInconclusive {
<#
.SYNOPSIS
Deprecated. Use `Set-ItResult -Inconclusive` instead
.DESCRIPTION
Set-TestInconclusive was used inside an It block to mark the test as inconclusive.
If you need this functionality please use the new Set-ItResult command.
.PARAMETER Message
Value assigned to the Message parameter will be displayed in the the test result.
.EXAMPLE
```ps
Describe "Example" {
It "My test" {
Set-TestInconclusive -Message "we forced it to be inconclusive"
}
}
```
The test result.
```
Describing Example
[?] My test, is inconclusive because we forced it to be inconclusive 58ms
```
#>
[CmdletBinding()]
param (
[string] $Message
)
if (!$script:HasAlreadyWarnedAboutDeprecation) {
Write-Warning 'DEPRECATED: Set-TestInconclusive was deprecated and will be removed in the future. Please update your scripts to use `Set-ItResult -Inconclusive -Because $Message`.'
$script:HasAlreadyWarnedAboutDeprecation = $true
}
Set-ItResult -Inconclusive -Because $Message
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBA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QxIgQgSw2mPYr086tGlUoZ40WwuxjvTSqNlwD7ZMDT4fWpMHEw
# DQYJKoZIhvcNAQEBBQAEggEAcd+IaQgRin7TaIUAHL+yK5qXLE1s5H9KV5ezCil7
# RrhN6nomIO6NCNv2WTKMGhObxWQ8e0cegsc2cYlk3OAv3APZQgklCcenBVcKD+ly
# cZSnA9NErkq+eeSItpDPe2+/T06crfxUKHOuvObskNOI+l9BtE2Z2IQKupIetev8
# HX4uwsmD53NfyeJqV+7l72T36l6zIJp1UJslqzNqtnTPs0sKQzHIcZXBjFjsGvgN
# MQVUZthKEmNVfb6C9ult8nW9XgLL1MZO8mEEmTsJXhL9GugmWa9NobmlOa+3L2hB
# Tq8O/f+3UXqbA/QKOjJg24CPGa4MisUna+grUUvT8Jkjfg==
# SIG # End signature block
function Parse-ShouldArgs([object[]] $shouldArgs) {
if ($null -eq $shouldArgs) {
$shouldArgs = @()
}
$parsedArgs = @{
PositiveAssertion = $true
ExpectedValue = $null
}
$assertionMethodIndex = 0
$expectedValueIndex = 1
if ($shouldArgs.Count -gt 0 -and $shouldArgs[0] -eq "not") {
$parsedArgs.PositiveAssertion = $false
$assertionMethodIndex += 1
$expectedValueIndex += 1
}
if ($assertionMethodIndex -lt $shouldArgs.Count) {
$parsedArgs.AssertionMethod = "$($shouldArgs[$assertionMethodIndex])"
}
else {
throw 'You cannot call Should without specifying an assertion method.'
}
if ($expectedValueIndex -lt $shouldArgs.Count) {
$parsedArgs.ExpectedValue = $shouldArgs[$expectedValueIndex]
}
return $parsedArgs
}
function Get-FailureMessage($assertionEntry, $negate, $value, $expected) {
if ($negate) {
$failureMessageFunction = $assertionEntry.GetNegativeFailureMessage
}
else {
$failureMessageFunction = $assertionEntry.GetPositiveFailureMessage
}
return (& $failureMessageFunction $value $expected)
}
function New-ShouldErrorRecord ([string] $Message, [string] $File, [string] $Line, [string] $LineText) {
$exception = & $SafeCommands['New-Object'] Exception $Message
$errorID = 'PesterAssertionFailed'
$errorCategory = [Management.Automation.ErrorCategory]::InvalidResult
# we use ErrorRecord.TargetObject to pass structured information about the error to a reporting system.
$targetObject = @{Message = $Message; File = $File; Line = $Line; LineText = $LineText}
$errorRecord = & $SafeCommands['New-Object'] Management.Automation.ErrorRecord $exception, $errorID, $errorCategory, $targetObject
return $errorRecord
}
function Should {
<#
.SYNOPSIS
Should is a keyword what is used to define an assertion inside It block.
.DESCRIPTION
Should is a keyword what is used to define an assertion inside the It block.
Should provides assertion methods for verify assertion e.g. comparing objects.
If assertion is not met the test fails and an exception is throwed up.
Should can be used more than once in the It block if more than one assertion
need to be verified. Each Should keywords need to be located in a new line.
Test will be passed only when all assertion will be met (logical conjuction).
#>
[CmdletBinding(DefaultParameterSetName = 'Legacy')]
param (
[Parameter(ParameterSetName = 'Legacy', Position = 0)]
[object] $__LegacyArg1,
[Parameter(ParameterSetName = 'Legacy', Position = 1)]
[object] $__LegacyArg2,
[Parameter(ParameterSetName = 'Legacy', Position = 2)]
[object] $__LegacyArg3,
[Parameter(ValueFromPipeline = $true)]
[object] $ActualValue
)
dynamicparam {
Get-AssertionDynamicParams
}
begin {
$inputArray = New-Object System.Collections.Generic.List[PSObject]
if ($PSCmdlet.ParameterSetName -eq 'Legacy') {
$parsedArgs = Parse-ShouldArgs ($__LegacyArg1, $__LegacyArg2, $__LegacyArg3)
$entry = Get-AssertionOperatorEntry -Name $parsedArgs.AssertionMethod
if ($null -eq $entry) {
throw "'$($parsedArgs.AssertionMethod)' is not a valid Should operator."
}
}
}
process {
$inputArray.Add($ActualValue)
}
end {
$lineNumber = $MyInvocation.ScriptLineNumber
$lineText = $MyInvocation.Line.TrimEnd("$([System.Environment]::NewLine)")
$file = $MyInvocation.ScriptName
if ($PSCmdlet.ParameterSetName -eq 'Legacy') {
if ($inputArray.Count -eq 0) {
Invoke-LegacyAssertion $entry $parsedArgs $null $file $lineNumber $lineText
}
elseif ($entry.SupportsArrayInput) {
Invoke-LegacyAssertion $entry $parsedArgs $inputArray.ToArray() $file $lineNumber $lineText
}
else {
foreach ($object in $inputArray) {
Invoke-LegacyAssertion $entry $parsedArgs $object $file $lineNumber $lineText
}
}
}
else {
$negate = $false
if ($PSBoundParameters.ContainsKey('Not')) {
$negate = [bool]$PSBoundParameters['Not']
}
$null = $PSBoundParameters.Remove('ActualValue')
$null = $PSBoundParameters.Remove($PSCmdlet.ParameterSetName)
$null = $PSBoundParameters.Remove('Not')
$entry = Get-AssertionOperatorEntry -Name $PSCmdlet.ParameterSetName
if ($inputArray.Count -eq 0) {
Invoke-Assertion $entry $PSBoundParameters $null $file $lineNumber $lineText -Negate:$negate
}
elseif ($entry.SupportsArrayInput) {
Invoke-Assertion $entry $PSBoundParameters $inputArray.ToArray() $file $lineNumber $lineText -Negate:$negate
}
else {
foreach ($object in $inputArray) {
Invoke-Assertion $entry $PSBoundParameters $object $file $lineNumber $lineText -Negate:$negate
}
}
}
}
}
function Invoke-LegacyAssertion($assertionEntry, $shouldArgs, $valueToTest, $file, $lineNumber, $lineText) {
# $expectedValueSplat = @(
# if ($null -ne $shouldArgs.ExpectedValue)
# {
# ,$shouldArgs.ExpectedValue
# }
# )
$negate = -not $shouldArgs.PositiveAssertion
$testResult = (& $assertionEntry.Test $valueToTest $shouldArgs.ExpectedValue -Negate:$negate)
if (-not $testResult.Succeeded) {
throw ( New-ShouldErrorRecord -Message $testResult.FailureMessage -File $file -Line $lineNumber -LineText $lineText )
}
}
function Invoke-Assertion {
param (
[object] $AssertionEntry,
[System.Collections.IDictionary] $BoundParameters,
[object] $valuetoTest,
[string] $File,
[int] $LineNumber,
[string] $LineText,
[switch] $Negate
)
$testResult = & $AssertionEntry.Test -ActualValue $valuetoTest -Negate:$Negate @BoundParameters
if (-not $testResult.Succeeded) {
throw ( New-ShouldErrorRecord -Message $testResult.FailureMessage -File $file -Line $lineNumber -LineText $lineText )
}
else {
#extract data to return if there are any on the object
$data = $testResult.psObject.Properties.Item('Data')
if ($data) {
$data.Value
}
}
}
function Format-Because ([string] $Because) {
if ($null -eq $Because) {
return
}
$bcs = $Because.Trim()
if ([string]::IsNullOrEmpty($bcs)) {
return
}
" because $($bcs -replace 'because\s'),"
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUg/IM9IPRr86fAbD+ZeIB5mMd
# x3SgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQQDExdEaWdpQ2VydCBUaW1lc3RhbXAgMjAyMTCCASIwDQYJKoZIhvcN
# AQEBBQADggEPADCCAQoCggEBAMLmYYRnxYr1DQikRcpja1HXOhFCvQp1dU2UtAxQ
# tSYQ/h3Ib5FrDJbnGlxI70Tlv5thzRWRYlq4/2cLnGP9NmqB+in43Stwhd4CGPN4
# bbx9+cdtCT2+anaH6Yq9+IRdHnbJ5MZ2djpT0dHTWjaPxqPhLxs6t2HWc+xObTOK
# fF1FLUuxUOZBOjdWhtyTI433UCXoZObd048vV7WHIOsOjizVI9r0TXhG4wODMSlK
# XAwxikqMiMX3MFr5FK8VX2xDSQn9JiNT9o1j6BqrW7EdMMKbaYK02/xWVLwfoYer
# vnpbCiAvSwnJlaeNsvrWY4tOpXIc7p96AXP4Gdb+DUmEvQECAwEAAaOCA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EaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgVGltZXN0YW1waW5n
# IENBAhANQkrgvjqI/2BAIc4UAPDdMA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODEwWjAv
# BgkqhkiG9w0BCQQxIgQgzP8MqMqLboSmJ/WfIjg3Ngh/wByJ7B1Zh4yVvp5Ezgww
# DQYJKoZIhvcNAQEBBQAEggEAtqR4Z6CRpEktJ0ZcoWoXDmI0o15nflhix3pRiFq5
# wAWvOFztsvJUYIkhsGzd/LpBCqSZ2GrfQIRNvnCYIZ+diMA8o5c0mlpTQaztkSSj
# xvCEeoettWTa2P22Dmxsi6I5W53zwHU2euG7AYU+6iDJm+Yrjs3l8CQNEYnzALNd
# /bjDRiFFo+Jqb9YkjPxudKWLZ2BD7ivexCuoieZwmy5sQZs+rjTSmAQRofWCgmgo
# 9HewedD+/4khbb0i2GC01gYCYN9gQupQ6MHDW/WucNoU6V6HkibxU5YvjHmoFD+F
# +/S1LKm/jNvEEKhXQD3pARb5LuSN9xIOX9wYhXBRnkKWSA==
# SIG # End signature block
function Context {
<#
.SYNOPSIS
Provides logical grouping of It blocks within a single Describe block.
.DESCRIPTION
Provides logical grouping of It blocks within a single Describe block.
Any Mocks defined inside a Context are removed at the end of the Context scope,
as are any files or folders added to the TestDrive during the Context block's
execution. Any BeforeEach or AfterEach blocks defined inside a Context also only
apply to tests within that Context .
.PARAMETER Name
The name of the Context. This is a phrase describing a set of tests within a describe.
.PARAMETER Tag
Optional parameter containing an array of strings. When calling Invoke-Pester,
it is possible to specify a -Tag parameter which will only execute Context blocks
containing the same Tag.
.PARAMETER Fixture
Script that is executed. This may include setup specific to the context
and one or more It blocks that validate the expected outcomes.
.EXAMPLE
```ps
function Add-Numbers($a, $b) {
return $a + $b
}
Describe "Add-Numbers" {
Context "when root does not exist" {
It "..." { ... }
}
Context "when root does exist" {
It "..." { ... }
It "..." { ... }
It "..." { ... }
}
}
```
.LINK
https://pester.dev/docs/commands/Describe
.LINK
https://pester.dev/docs/commands/It
.LINK
https://pester.dev/docs/commands/BeforeEach
.LINK
https://pester.dev/docs/commands/AfterEach
.LINK
https://pester.dev/docs/commands/Should
.LINK
https://pester.dev/docs/usage/mocking
.LINK
https://pester.dev/docs/usage/testdrive
#>
param(
[Parameter(Mandatory = $true, Position = 0)]
[string] $Name,
[Alias('Tags')]
[string[]] $Tag = @(),
[Parameter(Position = 1)]
[ScriptBlock] $Fixture
)
if ($Fixture -eq $null) {
if ($Name.Contains("`n")) {
throw "Test fixture name has multiple lines and no test fixture is provided. (Have you provided a name for the test group?)"
}
else {
throw 'No test fixture is provided. (Have you put the open curly brace on the next line?)'
}
}
if ($null -eq (& $SafeCommands['Get-Variable'] -Name Pester -ValueOnly -ErrorAction $script:IgnoreErrorPreference)) {
# User has executed a test script directly instead of calling Invoke-Pester
$sessionState = Set-SessionStateHint -PassThru -Hint "Caller - Captured in Context" -SessionState $PSCmdlet.SessionState
$Pester = New-PesterState -Path (& $SafeCommands['Resolve-Path'] .) -TestNameFilter $null -TagFilter @() -SessionState $sessionState
$script:mockTable = @{ }
}
DescribeImpl @PSBoundParameters -CommandUsed 'Context' -Pester $Pester -DescribeOutputBlock ${function:Write-Describe} -TestOutputBlock ${function:Write-PesterResult} -NoTestRegistry:('Windows' -ne (GetPesterOs))
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUCiRUe8lzi+1N+K1oyOW/4kIq
# qBKgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVU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
# bpepREmgNDJqsxjU8+S1Jkpxq9YG/qO/4OwXGS5DPktlEGb0UKRtMwg1Bl8Se6sO
# pV8f5rXBYUwp5eq6GYE6gizV/cwb+4vD9FMeZzsim3jSJY9j3YFU8VU9lUi67ugl
# I8fMIdYl9bQ5wTbyJbwT+Lh2Iiu1RHn8RU5Y8JVOkf/I1a00H1YB49PCKAu9NbnC
# BeOzGsLKgcMcN+N4Z9m7sVbcJtYA7WhWg6CRZtLP3BuTfw==
# SIG # End signature block
if ($PSVersionTable.PSVersion.Major -le 2) {
function Exit-CoverageAnalysis { }
function Get-CoverageReport { }
function Write-CoverageReport { }
function Enter-CoverageAnalysis {
param ( $CodeCoverage )
if ($CodeCoverage) {
& $SafeCommands['Write-Error'] 'Code coverage analysis requires PowerShell 3.0 or later.'
}
}
return
}
function Enter-CoverageAnalysis {
[CmdletBinding()]
param (
[object[]] $CodeCoverage,
[object] $PesterState
)
$coverageInfo =
foreach ($object in $CodeCoverage) {
Get-CoverageInfoFromUserInput -InputObject $object
}
$PesterState.CommandCoverage = @(Get-CoverageBreakpoints -CoverageInfo $coverageInfo)
}
function Exit-CoverageAnalysis {
param ([object] $PesterState)
& $SafeCommands['Set-StrictMode'] -Off
# PSScriptAnalyzer it will flag this line because $null is on the LHS of -ne.
# BUT that is correct in this case. We are filtering the list of breakpoints
# to only get those that are not $null
# (like if we did $breakpoints | where {$_ -ne $null})
# so DON'T change this.
$breakpoints = @($PesterState.CommandCoverage.Breakpoint) -ne $null
if ($breakpoints.Count -gt 0) {
& $SafeCommands['Remove-PSBreakpoint'] -Breakpoint $breakpoints
}
}
function Get-CoverageInfoFromUserInput {
param (
[Parameter(Mandatory = $true)]
[object]
$InputObject
)
if ($InputObject -is [System.Collections.IDictionary]) {
$unresolvedCoverageInfo = Get-CoverageInfoFromDictionary -Dictionary $InputObject
}
else {
$Path = $InputObject -as [string]
# Auto-detect IncludeTests-value from path-input
$IncludeTests = $Path -match '\.tests\.ps1$'
$unresolvedCoverageInfo = New-CoverageInfo -Path $Path -IncludeTests $IncludeTests
}
Resolve-CoverageInfo -UnresolvedCoverageInfo $unresolvedCoverageInfo
}
function New-CoverageInfo {
param ([string] $Path, [string] $Class = $null, [string] $Function = $null, [int] $StartLine = 0, [int] $EndLine = 0, [bool] $IncludeTests = $false)
return [pscustomobject]@{
Path = $Path
Class = $Class
Function = $Function
StartLine = $StartLine
EndLine = $EndLine
IncludeTests = $IncludeTests
}
}
function Get-CoverageInfoFromDictionary {
param ([System.Collections.IDictionary] $Dictionary)
[string] $path = Get-DictionaryValueFromFirstKeyFound -Dictionary $Dictionary -Key 'Path', 'p'
if ([string]::IsNullOrEmpty($path)) {
throw "Coverage value '$Dictionary' is missing required Path key."
}
$startLine = Get-DictionaryValueFromFirstKeyFound -Dictionary $Dictionary -Key 'StartLine', 'Start', 's'
$endLine = Get-DictionaryValueFromFirstKeyFound -Dictionary $Dictionary -Key 'EndLine', 'End', 'e'
[string] $class = Get-DictionaryValueFromFirstKeyFound -Dictionary $Dictionary -Key 'Class', 'c'
[string] $function = Get-DictionaryValueFromFirstKeyFound -Dictionary $Dictionary -Key 'Function', 'f'
$includeTests = Get-DictionaryValueFromFirstKeyFound -Dictionary $Dictionary -Key 'IncludeTests'
$startLine = Convert-UnknownValueToInt -Value $startLine -DefaultValue 0
$endLine = Convert-UnknownValueToInt -Value $endLine -DefaultValue 0
[bool] $includeTests = Convert-UnknownValueToInt -Value $includeTests -DefaultValue 0
return New-CoverageInfo -Path $path -StartLine $startLine -EndLine $endLine -Class $class -Function $function -IncludeTests $includeTests
}
function Convert-UnknownValueToInt {
param ([object] $Value, [int] $DefaultValue = 0)
try {
return [int] $Value
}
catch {
return $DefaultValue
}
}
function Resolve-CoverageInfo {
param ([psobject] $UnresolvedCoverageInfo)
$path = $UnresolvedCoverageInfo.Path
$testsPattern = '\.tests\.ps1$'
$includeTests = $UnresolvedCoverageInfo.IncludeTests
try {
$resolvedPaths = & $SafeCommands['Resolve-Path'] -Path $path -ErrorAction Stop |
& $SafeCommands['Where-Object'] { $includeTests -or $_.Path -notmatch $testsPattern }
}
catch {
& $SafeCommands['Write-Error'] "Could not resolve coverage path '$path': $($_.Exception.Message)"
return
}
$filePaths =
foreach ($resolvedPath in $resolvedPaths) {
$item = & $SafeCommands['Get-Item'] -LiteralPath $resolvedPath
if ($item -is [System.IO.FileInfo] -and ('.ps1', '.psm1') -contains $item.Extension) {
$item.FullName
}
elseif (-not $item.PsIsContainer) {
& $SafeCommands['Write-Warning'] "CodeCoverage path '$path' resolved to a non-PowerShell file '$($item.FullName)'; this path will not be part of the coverage report."
}
}
$params = @{
StartLine = $UnresolvedCoverageInfo.StartLine
EndLine = $UnresolvedCoverageInfo.EndLine
Class = $UnresolvedCoverageInfo.Class
Function = $UnresolvedCoverageInfo.Function
}
foreach ($filePath in $filePaths) {
$params['Path'] = $filePath
New-CoverageInfo @params
}
}
function Get-CoverageBreakpoints {
[CmdletBinding()]
param (
[object[]] $CoverageInfo
)
$fileGroups = @($CoverageInfo | & $SafeCommands['Group-Object'] -Property Path)
foreach ($fileGroup in $fileGroups) {
& $SafeCommands['Write-Verbose'] "Initializing code coverage analysis for file '$($fileGroup.Name)'"
$totalCommands = 0
$analyzedCommands = 0
:commandLoop
foreach ($command in Get-CommandsInFile -Path $fileGroup.Name) {
$totalCommands++
foreach ($coverageInfoObject in $fileGroup.Group) {
if (Test-CoverageOverlapsCommand -CoverageInfo $coverageInfoObject -Command $command) {
$analyzedCommands++
New-CoverageBreakpoint -Command $command
continue commandLoop
}
}
}
& $SafeCommands['Write-Verbose'] "Analyzing $analyzedCommands of $totalCommands commands in file '$($fileGroup.Name)' for code coverage"
}
}
function Get-CommandsInFile {
param ([string] $Path)
$errors = $null
$tokens = $null
$ast = [System.Management.Automation.Language.Parser]::ParseFile($Path, [ref] $tokens, [ref] $errors)
if ($PSVersionTable.PSVersion.Major -ge 5) {
# In PowerShell 5.0, dynamic keywords for DSC configurations are represented by the DynamicKeywordStatementAst
# class. They still trigger breakpoints, but are not a child class of CommandBaseAst anymore.
$predicate = {
$args[0] -is [System.Management.Automation.Language.DynamicKeywordStatementAst] -or
$args[0] -is [System.Management.Automation.Language.CommandBaseAst]
}
}
else {
$predicate = { $args[0] -is [System.Management.Automation.Language.CommandBaseAst] }
}
$searchNestedScriptBlocks = $true
$ast.FindAll($predicate, $searchNestedScriptBlocks)
}
function Test-CoverageOverlapsCommand {
param ([object] $CoverageInfo, [System.Management.Automation.Language.Ast] $Command)
if ($CoverageInfo.Class -or $CoverageInfo.Function) {
Test-CommandInScope -Command $Command -Class $CoverageInfo.Class -Function $CoverageInfo.Function
}
else {
Test-CoverageOverlapsCommandByLineNumber @PSBoundParameters
}
}
function Test-CommandInScope {
param ([System.Management.Automation.Language.Ast] $Command, [string] $Class, [string] $Function)
$classResult = !$Class
$functionResult = !$Function
for ($ast = $Command; $null -ne $ast; $ast = $ast.Parent) {
if (!$classResult -and $PSVersionTable.PSVersion.Major -ge 5) {
# Classes have been introduced in PowerShell 5.0
$classAst = $ast -as [System.Management.Automation.Language.TypeDefinitionAst]
if ($null -ne $classAst -and $classAst.Name -like $Class) {
$classResult = $true
}
}
if (!$functionResult) {
$functionAst = $ast -as [System.Management.Automation.Language.FunctionDefinitionAst]
if ($null -ne $functionAst -and $functionAst.Name -like $Function) {
$functionResult = $true
}
}
if ($classResult -and $functionResult) {
return $true
}
}
return $false
}
function Test-CoverageOverlapsCommandByLineNumber {
param ([object] $CoverageInfo, [System.Management.Automation.Language.Ast] $Command)
$commandStart = $Command.Extent.StartLineNumber
$commandEnd = $Command.Extent.EndLineNumber
$coverStart = $CoverageInfo.StartLine
$coverEnd = $CoverageInfo.EndLine
# An EndLine value of 0 means to cover the entire rest of the file from StartLine
# (which may also be 0)
if ($coverEnd -le 0) {
$coverEnd = [int]::MaxValue
}
return (Test-RangeContainsValue -Value $commandStart -Min $coverStart -Max $coverEnd) -or
(Test-RangeContainsValue -Value $commandEnd -Min $coverStart -Max $coverEnd)
}
function Test-RangeContainsValue {
param ([int] $Value, [int] $Min, [int] $Max)
return $Value -ge $Min -and $Value -le $Max
}
function New-CoverageBreakpoint {
param ([System.Management.Automation.Language.Ast] $Command)
if (IsIgnoredCommand -Command $Command) {
return
}
$params = @{
Script = $Command.Extent.File
Line = $Command.Extent.StartLineNumber
Column = $Command.Extent.StartColumnNumber
Action = { }
}
$breakpoint = & $SafeCommands['Set-PSBreakpoint'] @params
[pscustomobject] @{
File = $Command.Extent.File
Class = Get-ParentClassName -Ast $Command
Function = Get-ParentFunctionName -Ast $Command
StartLine = $Command.Extent.StartLineNumber
EndLine = $Command.Extent.EndLineNumber
StartColumn = $Command.Extent.StartColumnNumber
EndColumn = $Command.Extent.EndColumnNumber
Command = Get-CoverageCommandText -Ast $Command
Breakpoint = $breakpoint
}
}
Function Get-AstTopParent {
param(
[System.Management.Automation.Language.Ast] $Ast,
[int] $MaxDepth = 30
)
if ([string]::IsNullOrEmpty($Ast.Parent)) {
return $Ast
}
elseif ($MaxDepth -le 0) {
& $SafeCommands['Write-Verbose'] "Max depth reached, moving on"
return $null
}
else {
$MaxDepth--
Get-AstTopParent -Ast $Ast.Parent -MaxDepth $MaxDepth
}
}
function IsIgnoredCommand {
param ([System.Management.Automation.Language.Ast] $Command)
if (-not $Command.Extent.File) {
# This can happen if the script contains "configuration" or any similarly implemented
# dynamic keyword. PowerShell modifies the script code and reparses it in memory, leading
# to AST elements with no File in their Extent.
return $true
}
if ($PSVersionTable.PSVersion.Major -ge 4) {
if ($Command.Extent.Text -eq 'Configuration') {
# More DSC voodoo. Calls to "configuration" generate breakpoints, but their HitCount
# stays zero (even though they are executed.) For now, ignore them, unless we can come
# up with a better solution.
return $true
}
if (IsChildOfHashtableDynamicKeyword -Command $Command) {
# The lines inside DSC resource declarations don't trigger their breakpoints when executed,
# just like the "configuration" keyword itself. I don't know why, at this point, but just like
# configuration, we'll ignore it so it doesn't clutter up the coverage analysis with useless junk.
return $true
}
}
if ($Command.Extent.Text -match '^{?& \$wrappedCmd @PSBoundParameters ?}?$' -and
(Get-AstTopParent -Ast $Command) -like '*$steppablePipeline.Begin($PSCmdlet)*$steppablePipeline.Process($_)*$steppablePipeline.End()*' ) {
# Fix for proxy function wrapped pipeline command. PowerShell does not increment the hit count when
# these functions are executed using the steppable pipeline; further, these checks are redundant, as
# all steppable pipeline constituents already get breakpoints set. This checks to ensure the top parent
# node of the command contains all three constituents of the steppable pipeline before ignoring it.
return $true
}
if (IsClosingLoopCondition -Command $Command) {
# For some reason, the closing expressions of do/while and do/until loops don't trigger their breakpoints.
# To avoid useless clutter, we'll ignore those lines as well.
return $true
}
return $false
}
function IsChildOfHashtableDynamicKeyword {
param ([System.Management.Automation.Language.Ast] $Command)
for ($ast = $Command.Parent; $null -ne $ast; $ast = $ast.Parent) {
if ($PSVersionTable.PSVersion.Major -ge 5) {
# The ast behaves differently for DSC resources with version 5+. There's a new DynamicKeywordStatementAst class,
# and they no longer are represented by CommandAst objects.
if ($ast -is [System.Management.Automation.Language.DynamicKeywordStatementAst] -and
$ast.CommandElements[-1] -is [System.Management.Automation.Language.HashtableAst]) {
return $true
}
}
else {
if ($ast -is [System.Management.Automation.Language.CommandAst] -and
$null -ne $ast.DefiningKeyword -and
$ast.DefiningKeyword.BodyMode -eq [System.Management.Automation.Language.DynamicKeywordBodyMode]::Hashtable) {
return $true
}
}
}
return $false
}
function IsClosingLoopCondition {
param ([System.Management.Automation.Language.Ast] $Command)
$ast = $Command
while ($null -ne $ast.Parent) {
if (($ast.Parent -is [System.Management.Automation.Language.DoWhileStatementAst] -or
$ast.Parent -is [System.Management.Automation.Language.DoUntilStatementAst]) -and
$ast.Parent.Condition -eq $ast) {
return $true
}
$ast = $ast.Parent
}
return $false
}
function Get-ParentClassName {
param ([System.Management.Automation.Language.Ast] $Ast)
if ($PSVersionTable.PSVersion.Major -ge 5) {
# Classes have been introduced in PowerShell 5.0
$parent = $Ast.Parent
while ($null -ne $parent -and $parent -isnot [System.Management.Automation.Language.TypeDefinitionAst]) {
$parent = $parent.Parent
}
}
if ($null -eq $parent) {
return ''
}
else {
return $parent.Name
}
}
function Get-ParentFunctionName {
param ([System.Management.Automation.Language.Ast] $Ast)
$parent = $Ast.Parent
while ($null -ne $parent -and $parent -isnot [System.Management.Automation.Language.FunctionDefinitionAst]) {
$parent = $parent.Parent
}
if ($null -eq $parent) {
return ''
}
else {
return $parent.Name
}
}
function Get-CoverageCommandText {
param ([System.Management.Automation.Language.Ast] $Ast)
$reportParentExtentTypes = @(
[System.Management.Automation.Language.ReturnStatementAst]
[System.Management.Automation.Language.ThrowStatementAst]
[System.Management.Automation.Language.AssignmentStatementAst]
[System.Management.Automation.Language.IfStatementAst]
)
$parent = Get-ParentNonPipelineAst -Ast $Ast
if ($null -ne $parent) {
if ($parent -is [System.Management.Automation.Language.HashtableAst]) {
return Get-KeyValuePairText -HashtableAst $parent -ChildAst $Ast
}
elseif ($reportParentExtentTypes -contains $parent.GetType()) {
return $parent.Extent.Text
}
}
return $Ast.Extent.Text
}
function Get-ParentNonPipelineAst {
param ([System.Management.Automation.Language.Ast] $Ast)
$parent = $null
if ($null -ne $Ast) {
$parent = $Ast.Parent
}
while ($parent -is [System.Management.Automation.Language.PipelineAst]) {
$parent = $parent.Parent
}
return $parent
}
function Get-KeyValuePairText {
param (
[System.Management.Automation.Language.HashtableAst] $HashtableAst,
[System.Management.Automation.Language.Ast] $ChildAst
)
& $SafeCommands['Set-StrictMode'] -Off
foreach ($keyValuePair in $HashtableAst.KeyValuePairs) {
if ($keyValuePair.Item2.PipelineElements -contains $ChildAst) {
return '{0} = {1}' -f $keyValuePair.Item1.Extent.Text, $keyValuePair.Item2.Extent.Text
}
}
# This shouldn't happen, but just in case, default to the old output of just the expression.
return $ChildAst.Extent.Text
}
function Get-CoverageMissedCommands {
param ([object[]] $CommandCoverage)
$CommandCoverage | & $SafeCommands['Where-Object'] { $_.Breakpoint.HitCount -eq 0 }
}
function Get-CoverageHitCommands {
param ([object[]] $CommandCoverage)
$CommandCoverage | & $SafeCommands['Where-Object'] { $_.Breakpoint.HitCount -gt 0 }
}
function Get-CoverageReport {
param ([object] $PesterState)
$properties = @(
'File'
@{ Name = 'Line'; Expression = { $_.StartLine } }
'StartLine'
'EndLine'
'StartColumn'
'EndColumn'
'Class'
'Function'
'Command'
@{ Name = 'HitCount'; Expression = { $_.Breakpoint.HitCount } }
)
$missedCommands = @(Get-CoverageMissedCommands -CommandCoverage $PesterState.CommandCoverage | & $SafeCommands['Select-Object'] $properties)
$hitCommands = @(Get-CoverageHitCommands -CommandCoverage $PesterState.CommandCoverage | & $SafeCommands['Select-Object'] $properties)
$analyzedFiles = @($PesterState.CommandCoverage | & $SafeCommands['Select-Object'] -ExpandProperty File -Unique)
[pscustomobject] @{
NumberOfCommandsAnalyzed = $PesterState.CommandCoverage.Count
NumberOfFilesAnalyzed = $analyzedFiles.Count
NumberOfCommandsExecuted = $hitCommands.Count
NumberOfCommandsMissed = $missedCommands.Count
MissedCommands = $missedCommands
HitCommands = $hitCommands
AnalyzedFiles = $analyzedFiles
}
}
function Get-CommonParentPath {
param ([string[]] $Path)
$pathsToTest = @(
$Path |
Normalize-Path |
& $SafeCommands['Select-Object'] -Unique
)
if ($pathsToTest.Count -gt 0) {
$parentPath = & $SafeCommands['Split-Path'] -Path $pathsToTest[0] -Parent
while ($parentPath.Length -gt 0) {
$nonMatches = $pathsToTest -notmatch "^$([regex]::Escape($parentPath))"
if ($nonMatches.Count -eq 0) {
return $parentPath
}
else {
$parentPath = & $SafeCommands['Split-Path'] -Path $parentPath -Parent
}
}
}
return [string]::Empty
}
function Get-RelativePath {
param ( [string] $Path, [string] $RelativeTo )
return $Path -replace "^$([regex]::Escape("$RelativeTo$([System.IO.Path]::DirectorySeparatorChar)"))?"
}
function Normalize-Path {
[CmdletBinding()]
param (
[Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
[Alias('PSPath', 'FullName')]
[string[]] $Path
)
# Split-Path and Join-Path will replace any AltDirectorySeparatorChar instances with the DirectorySeparatorChar
# (Even if it's not the one that the split / join happens on.) So splitting / rejoining a path will give us
# consistent separators for later string comparison.
process {
if ($null -ne $Path) {
foreach ($p in $Path) {
$normalizedPath = & $SafeCommands['Split-Path'] $p -Leaf
if ($normalizedPath -ne $p) {
$parent = & $SafeCommands['Split-Path'] $p -Parent
$normalizedPath = & $SafeCommands['Join-Path'] $parent $normalizedPath
}
$normalizedPath
}
}
}
}
function Get-JaCoCoReportXml {
param (
[parameter(Mandatory = $true)]
$PesterState,
[parameter(Mandatory = $true)]
[object] $CoverageReport
)
if ($null -eq $CoverageReport -or ($pester.Show -eq [Pester.OutputTypes]::None) -or $CoverageReport.NumberOfCommandsAnalyzed -eq 0) {
return
}
$now = & $SafeCommands['Get-Date']
$nineteenSeventy = & $SafeCommands['Get-Date'] -Date "01/01/1970"
[long] $endTime = [math]::Floor((New-TimeSpan -start $nineteenSeventy -end $now).TotalMilliseconds)
[long] $startTime = [math]::Floor($endTime - $PesterState.Time.TotalMilliseconds)
$folderGroups = $PesterState.CommandCoverage | & $SafeCommands["Group-Object"] -Property {
& $SafeCommands["Split-Path"] $_.File -Parent
}
$packageList = & $SafeCommands['New-Object'] System.Collections.Generic.List[psobject]
$report = @{
Instruction = @{ Missed = 0; Covered = 0 }
Line = @{ Missed = 0; Covered = 0 }
Method = @{ Missed = 0; Covered = 0 }
Class = @{ Missed = 0; Covered = 0 }
}
foreach ($folderGroup in $folderGroups) {
$package = @{
Name = $folderGroup.Name
Classes = [ordered] @{ }
Instruction = @{ Missed = 0; Covered = 0 }
Line = @{ Missed = 0; Covered = 0 }
Method = @{ Missed = 0; Covered = 0 }
Class = @{ Missed = 0; Covered = 0 }
}
foreach ($command in $folderGroup.Group) {
$file = $command.File
$function = $command.Function
if (!$function) { $function = '<script>' }
$line = $command.StartLine.ToString()
$missed = if ($command.Breakpoint.HitCount) { 0 } else { 1 }
$covered = if ($command.Breakpoint.HitCount) { 1 } else { 0 }
if (!$package.Classes.Contains($file)) {
$package.Class.Missed += $missed
$package.Class.Covered += $covered
$package.Classes.$file = @{
Methods = [ordered] @{ }
Lines = [ordered] @{ }
Instruction = @{ Missed = 0; Covered = 0 }
Line = @{ Missed = 0; Covered = 0 }
Method = @{ Missed = 0; Covered = 0 }
Class = @{ Missed = $missed; Covered = $covered }
}
}
if (!$package.Classes.$file.Methods.Contains($function)) {
$package.Method.Missed += $missed
$package.Method.Covered += $covered
$package.Classes.$file.Method.Missed += $missed
$package.Classes.$file.Method.Covered += $covered
$package.Classes.$file.Methods.$function = @{
FirstLine = $line
Instruction = @{ Missed = 0; Covered = 0 }
Line = @{ Missed = 0; Covered = 0 }
Method = @{ Missed = $missed; Covered = $covered }
}
}
if (!$package.Classes.$file.Lines.Contains($line)) {
$package.Line.Missed += $missed
$package.Line.Covered += $covered
$package.Classes.$file.Line.Missed += $missed
$package.Classes.$file.Line.Covered += $covered
$package.Classes.$file.Methods.$function.Line.Missed += $missed
$package.Classes.$file.Methods.$function.Line.Covered += $covered
$package.Classes.$file.Lines.$line = @{
Instruction = @{ Missed = 0; Covered = 0 }
}
}
$package.Instruction.Missed += $missed
$package.Instruction.Covered += $covered
$package.Classes.$file.Instruction.Missed += $missed
$package.Classes.$file.Instruction.Covered += $covered
$package.Classes.$file.Methods.$function.Instruction.Missed += $missed
$package.Classes.$file.Methods.$function.Instruction.Covered += $covered
$package.Classes.$file.Lines.$line.Instruction.Missed += $missed
$package.Classes.$file.Lines.$line.Instruction.Covered += $covered
}
$report.Class.Missed += $package.Class.Missed
$report.Class.Covered += $package.Class.Covered
$report.Method.Missed += $package.Method.Missed
$report.Method.Covered += $package.Method.Covered
$report.Line.Missed += $package.Line.Missed
$report.Line.Covered += $package.Line.Covered
$report.Instruction.Missed += $package.Instruction.Missed
$report.Instruction.Covered += $package.Instruction.Covered
$packageList.Add($package)
}
$commonParent = Get-CommonParentPath -Path $CoverageReport.AnalyzedFiles
$commonParentLeaf = & $SafeCommands["Split-Path"] $commonParent -Leaf
# the JaCoCo xml format without the doctype, as the XML stuff does not like DTD's.
$jaCoCoReport = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
$jaCoCoReport += '<report name="">'
$jaCoCoReport += '<sessioninfo id="this" start="" dump="" />'
$jaCoCoReport += '</report>'
[xml] $jaCoCoReportXml = $jaCoCoReport
$reportElement = $jaCoCoReportXml.report
$reportElement.name = "Pester ($now)"
$reportElement.sessioninfo.start = $startTime.ToString()
$reportElement.sessioninfo.dump = $endTime.ToString()
foreach ($package in $packageList) {
$packageRelativePath = Get-RelativePath -Path $package.Name -RelativeTo $commonParent
if ($null -eq $packageRelativePath) {
$packageName = $commonParentLeaf
}
else {
$packageName = "{0}/{1}" -f $commonParentLeaf, $($packageRelativePath.Replace("\", "/"))
}
$packageElement = Add-XmlElement $reportElement "package" @{
name = ($packageName -replace "/$", "")
}
foreach ($file in $package.Classes.Keys) {
$class = $package.Classes.$file
$classElementRelativePath = (Get-RelativePath -Path $file -RelativeTo $commonParent).Replace("\", "/")
$classElementName = "{0}/{1}" -f $commonParentLeaf, $classElementRelativePath
$classElementName = $classElementName.Substring(0, $($classElementName.LastIndexOf(".")))
$classElement = Add-XmlElement $packageElement 'class' -Attributes ([ordered] @{
name = $classElementName
sourcefilename = (& $SafeCommands["Split-Path"] -Path $classElementRelativePath -Leaf)
})
foreach ($function in $class.Methods.Keys) {
$method = $class.Methods.$function
$methodElement = Add-XmlElement $classElement 'method' -Attributes ([ordered] @{
name = $function
desc = '()'
line = $method.FirstLine
})
Add-JaCoCoCounter Instruction $method $methodElement
Add-JaCoCoCounter Line $method $methodElement
Add-JaCoCoCounter Method $method $methodElement
}
Add-JaCoCoCounter Instruction $class $classElement
Add-JaCoCoCounter Line $class $classElement
Add-JaCoCoCounter Method $class $classElement
Add-JaCoCoCounter Class $class $classElement
}
foreach ($file in $package.Classes.Keys) {
$class = $package.Classes.$file
$sourceFileElement = Add-XmlElement $packageElement 'sourcefile' -Attributes ([ordered] @{
name = (& $SafeCommands["Split-Path"] -Path $file -Leaf)
})
foreach ($line in $class.Lines.Keys) {
$null = Add-XmlElement $sourceFileElement 'line' -Attributes ([ordered] @{
nr = $line
mi = $class.Lines.$line.Instruction.Missed
ci = $class.Lines.$line.Instruction.Covered
mb = 0
cb = 0
})
}
Add-JaCoCoCounter Instruction $class $sourceFileElement
Add-JaCoCoCounter Line $class $sourceFileElement
Add-JaCoCoCounter Method $class $sourceFileElement
Add-JaCoCoCounter Class $class $sourceFileElement
}
Add-JaCoCoCounter Instruction $package $packageElement
Add-JaCoCoCounter Line $package $packageElement
Add-JaCoCoCounter Method $package $packageElement
Add-JaCoCoCounter Class $package $packageElement
}
Add-JaCoCoCounter Instruction $report $reportElement
Add-JaCoCoCounter Line $report $reportElement
Add-JaCoCoCounter Method $report $reportElement
Add-JaCoCoCounter Class $report $reportElement
# There is no pretty way to insert the Doctype, as microsoft has deprecated the DTD stuff.
$jaCoCoReportDocType = '<!DOCTYPE report PUBLIC "-//JACOCO//DTD Report 1.1//EN" "report.dtd">'
return $jaCocoReportXml.OuterXml.Insert(54, $jaCoCoReportDocType)
}
function Add-XmlElement {
param (
[parameter(Mandatory = $true)] [System.Xml.XmlNode] $Parent,
[parameter(Mandatory = $true)] [string] $Name,
[System.Collections.IDictionary] $Attributes
)
$element = $Parent.AppendChild($Parent.OwnerDocument.CreateElement($Name))
if ($Attributes) {
foreach ($key in $Attributes.Keys) {
$attribute = $element.Attributes.Append($Parent.OwnerDocument.CreateAttribute($key))
$attribute.Value = $Attributes.$key
}
}
return $element
}
function Add-JaCoCoCounter {
param (
[parameter(Mandatory = $true)] [ValidateSet('Instruction', 'Line', 'Method', 'Class')] [string] $Type,
[parameter(Mandatory = $true)] [System.Collections.IDictionary] $Data,
[parameter(Mandatory = $true)] [System.Xml.XmlNode] $Parent
)
if ($Data.$Type.Missed -isnot [int] -or $Data.$Type.Covered -isnot [int]) {
throw 'Counter data expected'
}
$null = Add-XmlElement $Parent 'counter' -Attributes ([ordered] @{
type = $Type.ToUpperInvariant()
missed = $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AhANQkrgvjqI/2BAIc4UAPDdMA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODAyWjAv
# BgkqhkiG9w0BCQQxIgQg610+9WOHn6W5n/he5u6Ju0Jbql9g9hZ6ptk2YdGaKMUw
# DQYJKoZIhvcNAQEBBQAEggEAJDF6g0q9tvv6YbFzlRD+H9lkrTW2lqNoXrnvWU5v
# kEsCpL+oXTwVhQOsJRz7LuvMFNJYMwtutbFpUcGXVFx7dqUE7CsEbZYIFIttmPLs
# CppLzfIvpScEm41EwacJNXedmClsY9AKCsy3ntJmKvtTst0GRI/JNNt/jIbEMnV3
# 6LHKJiLZBm50pqElW35zyhef0WcfQQTk7sHRqEkBK4YsBijTrREylZqtmkEOySfx
# 26F5KIRLj0MUoR20bK0Wdx82oF5fAOrfwOPEXd6SNtgverUgcML8AgiM8o6R8Erh
# 0SAwqK7O2r7g3553CE6KYgaAB6SITs4kCK35PUWL70UIiA==
# SIG # End signature block
function Describe {
<#
.SYNOPSIS
Creates a logical group of tests.
.DESCRIPTION
Creates a logical group of tests. All Mocks, TestDrive and TestRegistry contents
defined within a Describe block are scoped to that Describe; they
will no longer be present when the Describe block exits. A Describe
block may contain any number of Context and It blocks.
.PARAMETER Name
The name of the test group. This is often an expressive phrase describing
the scenario being tested.
.PARAMETER Fixture
The actual test script. If you are following the AAA pattern (Arrange-Act-Assert),
this typically holds the arrange and act sections. The Asserts will also lie
in this block but are typically nested each in its own It block. Assertions are
typically performed by the Should command within the It blocks.
.PARAMETER Tag
Optional parameter containing an array of strings. When calling Invoke-Pester,
it is possible to specify a -Tag parameter which will only execute Describe blocks
containing the same Tag.
.EXAMPLE
```ps
function Add-Numbers($a, $b) {
return $a + $b
}
Describe "Add-Numbers" {
It "adds positive numbers" {
$sum = Add-Numbers 2 3
$sum | Should -Be 5
}
It "adds negative numbers" {
$sum = Add-Numbers (-2) (-2)
$sum | Should -Be (-4)
}
It "adds one negative number to positive number" {
$sum = Add-Numbers (-2) 2
$sum | Should -Be 0
}
It "concatenates strings if given strings" {
$sum = Add-Numbers two three
$sum | Should -Be "twothree"
}
}
```
.LINK
https://pester.dev/docs/commands/It
.LINK
https://pester.dev/docs/commands/Context
.LINK
https://pester.dev/docs/commands/Invoke-Pester
.LINK
https://pester.dev/docs/commands/Should
.LINK
https://pester.dev/docs/usage/mocking
.LINK
https://pester.dev/docs/usage/testdrive
#>
param(
[Parameter(Mandatory = $true, Position = 0)]
[string] $Name,
[Alias('Tags')]
[string[]] $Tag = @(),
[Parameter(Position = 1)]
[ValidateNotNull()]
[ScriptBlock] $Fixture
)
if ($Fixture -eq $null) {
if ($Name.Contains("`n")) {
throw "Test fixture name has multiple lines and no test fixture is provided. (Have you provided a name for the test group?)"
}
else {
throw 'No test fixture is provided. (Have you put the open curly brace on the next line?)'
}
}
if ($null -eq (& $SafeCommands['Get-Variable'] -Name Pester -ValueOnly -ErrorAction $script:IgnoreErrorPreference)) {
# User has executed a test script directly instead of calling Invoke-Pester
Remove-MockFunctionsAndAliases
Remove-TestRegistry
Remove-TestDrive
$sessionState = Set-SessionStateHint -PassThru -Hint "Caller - Captured in Describe" -SessionState $PSCmdlet.SessionState
$Pester = New-PesterState -Path (& $SafeCommands['Resolve-Path'] .) -TestNameFilter $null -TagFilter @() -SessionState $sessionState
$script:mockTable = @{ }
}
DescribeImpl @PSBoundParameters -CommandUsed 'Describe' -Pester $Pester -DescribeOutputBlock ${function:Write-Describe} -TestOutputBlock ${function:Write-PesterResult} -NoTestRegistry:('Windows' -ne (GetPesterOs))
}
function DescribeImpl {
param(
[Parameter(Mandatory = $true, Position = 0)]
[string] $Name,
[Alias('Tags')]
$Tag = @(),
[Parameter(Position = 1)]
[ValidateNotNull()]
[ScriptBlock] $Fixture = $(Throw "No test script block is provided. (Have you put the open curly brace on the next line?)"),
[string] $CommandUsed = 'Describe',
$Pester,
[scriptblock] $DescribeOutputBlock,
[scriptblock] $TestOutputBlock,
[switch] $NoTestDrive,
[switch] $NoTestRegistry
)
Assert-DescribeInProgress -CommandName $CommandUsed
if (($Pester.RunningViaInvokePester -and $Pester.TestGroupStack.Count -eq 2) -or
(-not $Pester.RunningViaInvokePester -and $Pester.TestGroupStack.Count -eq 1)) {
if ($Pester.TestNameFilter -and $Name) {
if (-not (Contain-AnyStringLike -Filter $Pester.TestNameFilter -Collection $Name)) {
return
}
}
if ($Pester.ScriptBlockFilter) {
$match = $false
foreach ($filter in $Pester.ScriptBlockFilter) {
if ($match) {
break
}
if ($Fixture.File -eq $filter.Path -and $Fixture.StartPosition.StartLine -eq $filter.Line) {
$match = $true
}
}
if (-not $match) {
return
}
}
if ($Pester.TagFilter) {
if (-not (Contain-AnyStringLike -Filter $Pester.TagFilter -Collection $Tag)) {
return
}
}
if ($Pester.ExcludeTagFilter) {
if (Contain-AnyStringLike -Filter $Pester.ExcludeTagFilter -Collection $Tag) {
return
}
}
}
else {
if ($PSBoundParameters.ContainsKey('Tag')) {
Write-Warning "${CommandUsed} '$Name': Tags are only effective on the outermost test group, for now."
}
}
$Pester.EnterTestGroup($Name, $CommandUsed)
if ($null -ne $DescribeOutputBlock) {
& $DescribeOutputBlock $Name $CommandUsed
}
$testDriveAdded = $false
$testRegistryAdded = $false
try {
try {
if (-not $NoTestDrive) {
if (-not (Test-Path TestDrive:\)) {
New-TestDrive
$testDriveAdded = $true
}
else {
$TestDriveContent = Get-TestDriveChildItem
}
}
if (-not $NoTestRegistry) {
if (-not (Test-Path TestRegistry:\)) {
New-TestRegistry
$testRegistryAdded = $true
}
else {
$TestRegistryContent = Get-TestRegistryChildItem
}
}
Add-SetupAndTeardown -ScriptBlock $Fixture
Invoke-TestGroupSetupBlocks
do {
Write-ScriptBlockInvocationHint -Hint "Describe Fixture" -ScriptBlock $Fixture
$null = & $Fixture
} until ($true)
}
finally {
Invoke-TestGroupTeardownBlocks
if (-not $NoTestDrive) {
if ($testDriveAdded) {
Remove-TestDrive
}
else {
Clear-TestDrive -Exclude ($TestDriveContent | & $SafeCommands['Select-Object'] -ExpandProperty FullName)
}
}
if (-not $NoTestRegistry) {
if ($testRegistryAdded) {
Remove-TestRegistry
}
else {
Clear-TestRegistry -Exclude ($TestRegistryContent | & $SafeCommands['Select-Object'] -ExpandProperty PSPath)
}
}
}
}
catch {
$firstStackTraceLine = $_.InvocationInfo.PositionMessage.Trim() -split "$([System.Environment]::NewLine)" | & $SafeCommands['Select-Object'] -First 1
$Pester.AddTestResult("Error occurred in $CommandUsed block", "Failed", $null, $_.Exception.Message, $firstStackTraceLine, $null, $null, $_)
if ($null -ne $TestOutputBlock) {
& $TestOutputBlock $Pester.TestResult[-1]
}
}
Exit-MockScope
$Pester.LeaveTestGroup($Name, $CommandUsed)
}
# Name is now misleading; rename later. (Many files touched to change this.)
function Assert-DescribeInProgress {
param ($CommandName)
if ($null -eq $Pester) {
throw "The $CommandName command may only be used from a Pester test script."
}
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQU12MhXns5aNui48s3hCHT9CPw
# uzGgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQ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mFsg==
# SIG # End signature block
function GetPesterPsVersion {
# accessing the value indirectly so it can be mocked
(Get-Variable 'PSVersionTable' -ValueOnly).PSVersion.Major
}
function GetPesterOs {
# Prior to v6, PowerShell was solely on Windows. In v6, the $IsWindows variable was introduced.
if ((GetPesterPsVersion) -lt 6) {
'Windows'
}
elseif (Get-Variable -Name 'IsWindows' -ErrorAction 'SilentlyContinue' -ValueOnly ) {
'Windows'
}
elseif (Get-Variable -Name 'IsMacOS' -ErrorAction 'SilentlyContinue' -ValueOnly ) {
'macOS'
}
elseif (Get-Variable -Name 'IsLinux' -ErrorAction 'SilentlyContinue' -ValueOnly ) {
'Linux'
}
else {
throw "Unsupported Operating system!"
}
}
function Get-TempDirectory {
if ((GetPesterOs) -eq 'macOS') {
# Special case for macOS using the real path instead of /tmp which is a symlink to this path
"/private/tmp"
}
else {
[System.IO.Path]::GetTempPath()
}
}
function Get-TempRegistry {
$pesterTempRegistryRoot = 'Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\Software\Pester'
if (-not (Test-Path $pesterTempRegistryRoot)) {
try {
$null = New-Item -Path $pesterTempRegistryRoot -ErrorAction Stop
}
catch [Exception] {
throw (New-Object Exception -ArgumentList "Was not able to create a Pester Registry key for TestRegistry", ($_.Exception))
}
}
return $pesterTempRegistryRoot
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUEQXrjXXZQjg3gMsxmi44ihXn
# 6fygghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY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7Et8yF
# JJ/ViRcs3dcWsjgpF/ZkbBF+DmRhQNNK4jCgqk8e9EvYManC/Ijb4rXi2TMTZqXb
# //Z/fXPQqnrH3uvHkmbM66eWEBYp/7ZEZTAMUalCfK1nosHzPBkIibW9Bo3xknYf
# ej06KrtIsHHVUDA59woAxLSk1GUE+g6MadWYHMztERYK5A==
# SIG # End signature block
function Get-ShouldOperator {
<#
.SYNOPSIS
Display the assertion operators available for use with Should.
.DESCRIPTION
Get-ShouldOperator returns a list of available Should parameters,
their aliases, and examples to help you craft the tests you need.
Get-ShouldOperator will list all available operators,
including any registered by the user with Add-AssertionOperator.
.NOTES
Pester uses dynamic parameters to populate Should arguments.
This limits the user's ability to discover the available assertions via
standard PowerShell discovery patterns (like `Get-Help Should -Parameter *`).
.EXAMPLE
Get-ShouldOperator
Return all available Should assertion operators and their aliases.
.EXAMPLE
Get-ShouldOperator -Name Be
Return help examples for the Be assertion operator.
-Name is a dynamic parameter that tab completes all available options.
.LINK
https://pester.dev/docs/commands/Should
#>
[CmdletBinding()]
param ()
# Use a dynamic parameter to create a dynamic ValidateSet
# Define parameter -Name and tab-complete all current values of $AssertionOperators
# Discovers included assertions (-Be, -Not) and any registered by the user via Add-AssertionOperator
# https://martin77s.wordpress.com/2014/06/09/dynamic-validateset-in-a-dynamic-parameter/
DynamicParam {
$ParameterName = 'Name'
$RuntimeParameterDictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary
$AttributeCollection = New-Object System.Collections.ObjectModel.Collection[System.Attribute]
$ParameterAttribute = New-Object System.Management.Automation.ParameterAttribute
$AttributeCollection.Add($ParameterAttribute)
$arrSet = $AssertionOperators.Values |
Select-Object -Property Name, Alias |
ForEach-Object { $_.Name; $_.Alias }
$ValidateSetAttribute = New-Object System.Management.Automation.ValidateSetAttribute($arrSet)
$AttributeCollection.Add($ValidateSetAttribute)
$RuntimeParameter = New-Object System.Management.Automation.RuntimeDefinedParameter($ParameterName, [string], $AttributeCollection)
$RuntimeParameterDictionary.Add($ParameterName, $RuntimeParameter)
return $RuntimeParameterDictionary
}
BEGIN {
# Bind the parameter to a friendly variable
$Name = $PsBoundParameters[$ParameterName]
}
END {
if ($Name) {
$operator = $AssertionOperators.Values | Where-Object { $Name -eq $_.Name -or $_.Alias -contains $Name }
$help = Get-Help $operator.InternalName -Examples -ErrorAction SilentlyContinue
if (($help | Measure-Object).Count -ne 1) {
Write-Warning ("No help found for Should operator '{0}'" -f ((Get-AssertionOperatorEntry $Name).InternalName))
}
else {
$help
}
}
else {
$AssertionOperators.Keys | ForEach-Object {
$aliases = (Get-AssertionOperatorEntry $_).Alias
# Return name and alias(es) for all registered Should operators
New-Object -TypeName PSObject -Property @{
Name = $_
Alias = $aliases -join ', '
}
}
}
}
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUNYX1GC+IMF5Ld58a9Dyjjy+o
# /XegghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQQDExdEaWdpQ2VydCBUaW1lc3RhbXAgMjAyMTCCASIwDQYJKoZIhvcN
# AQEBBQADggEPADCCAQoCggEBAMLmYYRnxYr1DQikRcpja1HXOhFCvQp1dU2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2hF9miDOrY64JesJ0glWDJ9H6I2epSAN978yV7nI2BJQ6MgNPgW1tO2TUk
# LhM71WQazfMFztlrE+bvP7H8xvmkecXLwtnG0fDpS4qcatMJpF3dctNsUi0SJtbU
# ASzEaQdJ63olsepE4RZz4ZOuVQyOUPvEsnbzrd2iOccG4KlcETf64x9RPNKMFKGC
# AjAwggIsBgkqhkiG9w0BCQYxggIdMIICGQIBATCBhjByMQswCQYDVQQGEwJVUzEV
# MBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29t
# MTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgVGltZXN0YW1waW5n
# IENBAhANQkrgvjqI/2BAIc4UAPDdMA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODAzWjAv
# BgkqhkiG9w0BCQQxIgQgOhjx5ca4vt3gBKGC2lttPSW54vonuG/dSN4MH7ADJDkw
# DQYJKoZIhvcNAQEBBQAEggEASDgtbIm+Lr31xKleL3P0rnM+u4PPK3skpVnHyDql
# z4MimyWJCztZfSUSyRuRA+LaTu918YGm2qYhF/ZoId1MNnIgZOQ+I2e6zAWex+kE
# UWSkLkOdVR92iJekVrSjLCXAS45Px4kdEcWFA5jDRB88Mr76CsxL/VoLn/yaj3dr
# 6dyNudnvqGBkoYSDSDZSpCxpbVHFCMiOV6uMzNrIffZThqxw/pIbH1kpf7iX2CvV
# r+ONlWSp3cbiaWiUNJuezta+lLJ6WUWpG+Yhfg/ioVl7XwBwzKcTXVssRIaDzzrl
# PAPhI671JYrYqzzzgEObsMpSc+JBKcvLMq24M2kZJ0D9sQ==
# SIG # End signature block
if (($PSVersionTable.ContainsKey('PSEdition')) -and ($PSVersionTable.PSEdition -eq 'Core')) {
& $SafeCommands['Add-Type'] -Path "${Script:PesterRoot}/lib/Gherkin/core/Gherkin.dll"
}
else {
& $SafeCommands['Import-Module'] -Name "${Script:PesterRoot}/lib/Gherkin/legacy/Gherkin.dll"
}
$GherkinStepDefinitions = @{ }
$GherkinHooks = @{
BeforeEachFeature = @()
BeforeEachScenario = @()
AfterEachFeature = @()
AfterEachScenario = @()
}
function Invoke-GherkinHook {
<#
.SYNOPSIS
Internal function to run the various gherkin hooks
.PARAMETER Hook
The name of the hook to run
.PARAMETER Name
The name of the feature or scenario the hook is being invoked for
.PARAMETER Tags
Tags for filtering hooks
#>
[CmdletBinding()]
param(
[string]$Hook,
[string]$Name,
[string[]]$Tags
)
if ($GherkinHooks.${Hook}) {
foreach ($GherkinHook in $GherkinHooks.${Hook}) {
if ($GherkinHook.Tags -and $Tags) {
:tags foreach ($hookTag in $GherkinHook.Tags) {
foreach ($testTag in $Tags) {
if ($testTag -match "^($hookTag)$") {
& $GherkinHook.Script $Name
break tags
}
}
}
}
elseif ($GherkinHook.Tags) {
# If the hook has tags, it can't run if the step doesn't
}
else {
& $GherkinHook.Script $Name
}
} # @{ Tags = $Tags; Script = $Test }
}
}
function New-GherkinPesterState {
[CmdletBinding()]
param (
[string[]]$ScenarioName = [string[]]@(),
[string[]]$Tag = [string[]]@(),
[string[]]$ExcludeTag = [string[]]@(),
[System.Management.Automation.SessionState]$SessionState = $null,
[switch]$Strict,
[Pester.OutputTypes]$Show = 'All',
[PSObject]$PesterOption = $null
)
$AddMember = $SafeCommands['Add-Member']
$NewObject = $SafeCommands['New-Object']
New-PesterState -TagFilter $Tag -ExcludeTagFilter $ExcludeTag -TestNameFilter $ScenarioName -SessionState $SessionState -Strict:$Strict -Show $Show -PesterOption $PesterOption |
& $AddMember -MemberType NoteProperty -Name Features -Value (& $NewObject System.Collections.Generic.List[PSObject] ) -PassThru |
& $AddMember -MemberType ScriptMethod -Name GetScenariosWithResult -PassThru -Value {
[CmdletBinding()]
Param(
[Parameter(Position = 0, Mandatory = $True)]
[ValidateSet('Passed','Failed','Inconclusive','Pending')]
[string]$Result
)
$this.Features |
& $SafeCommands['Select-Object'] -ExpandProperty Scenarios |
& $SafeCommands['ForEach-Object'] -Begin { $Scenarios = @() } -Process {
$Scenarios += @(
if ($_ -is [Gherkin.Ast.ScenarioOutline]) {
$_ | & $SafeCommands['Select-Object'] -ExpandProperty Examples |
& $SafeCommands['Select-Object'] -ExpandProperty Scenarios |
& $SafeCommands['Select-Object'] Name, Result
} else {
$_ | & $SafeCommands['Select-Object'] Name, Result
}
)
} -End { $Scenarios } |
& $SafeCommands['Where-Object'] { $_.Result -eq $Result } |
& $SafeCommands['Select-Object'] -ExpandProperty Name
} |
& $AddMember -MemberType ScriptProperty -Name FailedScenarios -PassThru -Value { $this.GetScenariosWithResult('Failed') } |
& $AddMember -MemberType ScriptProperty -Name PendingScenarios -PassThru -Value { $this.GetScenariosWithResult('Pending') } |
& $AddMember -MemberType ScriptProperty -Name UndefinedScenarios -PassThru -Value { $this.GetScenariosWithResult('Inconclusive') } |
& $AddMember -MemberType ScriptProperty -Name PassedScenarios -PassThru -Value { $this.GetScenariosWithResult('Passed') }
}
function Invoke-Gherkin {
<#
.SYNOPSIS
Invokes Pester to run all tests defined in .feature files
.DESCRIPTION
Upon calling Invoke-Gherkin, all files that have a name matching *.feature in the current folder (and child folders recursively), will be parsed and executed.
If ScenarioName is specified, only scenarios which match the provided name(s) will be run.
If FailedLast is specified, only scenarios which failed the previous run will be re-executed.
Optionally, Pester can generate a report of how much code is covered by the tests, and information about any commands which were not executed.
.PARAMETER FailedLast
Rerun only the scenarios which failed last time
.PARAMETER Path
This parameter indicates which feature files should be tested.
Aliased to 'Script' for compatibility with Pester, but does not support hashtables, since feature files don't take parameters.
.PARAMETER ScenarioName
When set, invokes testing of scenarios which match this name.
Aliased to 'Name' and 'TestName' for compatibility with Pester.
.PARAMETER EnableExit
Will cause Invoke-Gherkin to exit with a exit code equal to the number of failed tests once all tests have been run.
Use this to "fail" a build when any tests fail.
.PARAMETER Tag
Filters Scenarios and Features and runs only the ones tagged with the specified tags.
.PARAMETER ExcludeTag
Informs Invoke-Gherkin to not run blocks tagged with the tags specified.
.PARAMETER CodeCoverage
Instructs Pester to generate a code coverage report in addition to running tests. You may pass either hashtables or strings to this parameter.
If strings are used, they must be paths (wildcards allowed) to source files, and all commands in the files are analyzed for code coverage.
By passing hashtables instead, you can limit the analysis to specific lines or functions within a file.
Hashtables must contain a Path key (which can be abbreviated to just "P"), and may contain Function (or "F"), StartLine (or "S"),
and EndLine ("E") keys to narrow down the commands to be analyzed.
If Function is specified, StartLine and EndLine are ignored.
If only StartLine is defined, the entire script file starting with StartLine is analyzed.
If only EndLine is present, all lines in the script file up to and including EndLine are analyzed.
Both Function and Path (as well as simple strings passed instead of hashtables) may contain wildcards.
.PARAMETER Strict
Makes Pending and Skipped tests to Failed tests. Useful for continuous integration where you need
to make sure all tests passed.
.PARAMETER OutputFile
The path to write a report file to. If this path is not provided, no log will be generated.
.PARAMETER OutputFormat
The format for output (LegacyNUnitXml or NUnitXml), defaults to NUnitXml
.PARAMETER Quiet
Disables the output Pester writes to screen. No other output is generated unless you specify PassThru,
or one of the Output parameters.
.PARAMETER PesterOption
Sets advanced options for the test execution. Enter a PesterOption object,
such as one that you create by using the New-PesterOption cmdlet, or a hash table
in which the keys are option names and the values are option values.
For more information on the options available, see the help for New-PesterOption.
.PARAMETER Show
Customizes the output Pester writes to the screen. Available options are None, Default,
Passed, Failed, Pending, Skipped, Inconclusive, Describe, Context, Summary, Header, All, Fails.
The options can be combined to define presets.
Common use cases are:
None - to write no output to the screen.
All - to write all available information (this is default option).
Fails - to write everything except Passed (but including Describes etc.).
A common setting is also Failed, Summary, to write only failed tests and test summary.
This parameter does not affect the PassThru custom object or the XML output that
is written when you use the Output parameters.
.PARAMETER NoMultiline
Controls whether or not Step Definition DocString and DataTable arguments are printed to the
console during the test run.
.PARAMETER Expand
Controls whether or not Scenario Outline example scenarios are displayed fully expanded instead of
just printing the scenario outline and table. This can be useful to determine exactly which step
in a scenario outline example scenario failed.
.PARAMETER PassThru
Returns a custom object (PSCustomObject) that contains the test results. By default,
Invoke-Gherkin writes to the host program, not to the output stream (stdout). If you try to save
the result in a variable, the variable is empty unless you use the PassThru parameter.
To suppress the host output, use the Quiet parameter.
.EXAMPLE
Invoke-Gherkin
This will find all *.feature specifications and execute their tests. No exit code will be returned and no log file will be saved.
.EXAMPLE
Invoke-Gherkin -Path ./tests/Utils*
This will run all *.feature specifications under ./Tests that begin with Utils.
.EXAMPLE
Invoke-Gherkin -ScenarioName "Add Numbers"
This will only run the Scenario named "Add Numbers"
.EXAMPLE
Invoke-Gherkin -EnableExit -OutputXml "./artifacts/TestResults.xml"
This runs all tests from the current directory downwards and writes the results according to the NUnit schema to artifacts/TestResults.xml just below the current directory. The test run will return an exit code equal to the number of test failures.
.EXAMPLE
Invoke-Gherkin -CodeCoverage 'ScriptUnderTest.ps1'
Runs all *.feature specifications in the current directory, and generates a coverage report for all commands in the "ScriptUnderTest.ps1" file.
.EXAMPLE
Invoke-Gherkin -CodeCoverage @{ Path = 'ScriptUnderTest.ps1'; Function = 'FunctionUnderTest' }
Runs all *.feature specifications in the current directory, and generates a coverage report for all commands in the "FunctionUnderTest" function in the "ScriptUnderTest.ps1" file.
.EXAMPLE
Invoke-Gherkin -CodeCoverage @{ Path = 'ScriptUnderTest.ps1'; StartLine = 10; EndLine = 20 }
Runs all *.feature specifications in the current directory, and generates a coverage report for all commands on lines 10 through 20 in the "ScriptUnderTest.ps1" file.
.LINK
Invoke-Pester
https://kevinmarquette.github.io/2017-03-17-Powershell-Gherkin-specification-validation/
.LINK
https://kevinmarquette.github.io/2017-04-30-Powershell-Gherkin-advanced-features/
#>
[CmdletBinding(DefaultParameterSetName = 'Default')]
param(
[Parameter(Mandatory = $True, ParameterSetName = "RetestFailed")]
[switch]$FailedLast,
[Parameter(Position = 0, Mandatory = $False)]
[Alias('Script', 'relative_path')]
[string]$Path = $Pwd,
[Parameter(Position = 1, Mandatory = $False)]
[Alias("Name", "TestName")]
[string[]]$ScenarioName,
[Parameter(Position = 2, Mandatory = $False)]
[switch]$EnableExit,
[Parameter(Position = 4, Mandatory = $False)]
[Alias('Tags')]
[string[]]$Tag,
[string[]]$ExcludeTag,
[object[]] $CodeCoverage = @(),
[Switch]$Strict,
[string] $OutputFile,
[ValidateSet('NUnitXml')]
[string] $OutputFormat = 'NUnitXml',
[Switch]$Quiet,
[object]$PesterOption,
[Pester.OutputTypes]$Show = 'All',
[switch]$NoMultiline,
[switch]$Expand,
[switch]$PassThru
)
begin {
& $SafeCommands['Import-LocalizedData'] -BindingVariable Script:GherkinReportData -BaseDirectory $PesterRoot -Filename Gherkin.psd1 -ErrorAction SilentlyContinue
# Fallback to en-US culture strings and theme colors
if (!$Script:GherkinReportData) {
& $SafeCommands['Import-LocalizedData'] -BaseDirectory $PesterRoot -BindingVariable Script:GherkinReportData -UICulture 'en-US' -Filename Gherkin.psd1 -ErrorAction Stop
}
$Script:ReportStrings = $Script:GherkinReportData.ReportStrings
$Script:ReportTheme = $Script:GherkinReportData.ReportTheme
# Make sure broken tests don't leave you in space:
$CWD = [Environment]::CurrentDirectory
$Location = & $SafeCommands['Get-Location']
[Environment]::CurrentDirectory = & $SafeCommands['Get-Location'] -PSProvider FileSystem
$Script:GherkinStepDefinitions = @{ }
$script:GherkinHooks = @{
BeforeEachFeature = @()
BeforeEachScenario = @()
AfterEachFeature = @()
AfterEachScenario = @()
}
}
end {
if ($PSBoundParameters.ContainsKey('Quiet')) {
& $SafeCommands['Write-Warning'] 'The -Quiet parameter has been deprecated; please use the new -Show parameter instead. To get no output use -Show None.'
& $SafeCommands['Start-Sleep'] -Seconds 2
if (!$PSBoundParameters.ContainsKey('Show')) {
$Show = [Pester.OutputTypes]::None
}
}
if ($PSCmdlet.ParameterSetName -eq "RetestFailed" -and $FailedLast) {
$ScenarioName = $script:GherkinFailedLast
if (!$ScenarioName) {
throw "There are no existing failed tests to re-run."
}
}
$SessionState = Set-SessionStateHint -PassThru -Hint "Caller - Captured in Invoke-Gherkin" -SessionState $PSCmdlet.SessionState
$Pester = New-GherkinPesterState -ScenarioName $ScenarioName -Tag $Tag -ExcludeTag $ExcludeTag -SessionState $SessionState -Strict:$Strict -Show $Show -PesterOption $PesterOption
Write-PesterStart $Pester $Path
Enter-CoverageAnalysis -CodeCoverage $CodeCoverage -PesterState $Pester
foreach ($FeatureFile in & $SafeCommands['Get-ChildItem'] $Path -Filter '*.feature' -Recurse ) {
Invoke-GherkinFeature $FeatureFile -Pester $Pester -NoMultiline:$NoMultiline -Expand:$Expand
}
# Remove all the steps
$Script:GherkinStepDefinitions.Clear()
$Location | & $SafeCommands['Set-Location']
[Environment]::CurrentDirectory = $CWD
$Pester | Write-GherkinReport
$CoverageReport = Get-CoverageReport -PesterState $Pester
Write-CoverageReport -CoverageReport $CoverageReport
Exit-CoverageAnalysis -PesterState $Pester
if (& $SafeCommands['Get-Variable']-Name OutputFile -ValueOnly -ErrorAction $script:IgnoreErrorPreference) {
Export-PesterResults -PesterState $Pester -Path $OutputFile -Format $OutputFormat
}
if ($PassThru) {
$Pester | New-PesterGherkinResults
}
$script:GherkinFailedLast = @($Pester.FailedScenarios.Name)
if ($EnableExit) {
Exit-WithCode -FailedCount $Pester.FailedCount
}
}
}
function New-PesterGherkinResults {
[CmdletBinding()]
Param (
[Parameter(Position = 0, Mandatory = $True, ValueFromPipeline = $True)]
[PSObject]$Pester
)
# The list of properties on the PesterState object which should be part of the test report
$Properties = @( 'Path', 'TagFilter', 'TestNameFilter', 'Features', 'PassedScenarios', 'FailedScenarios',
'PendingScenarios', 'UndefinedScenarios', 'PassedCount', 'FailedCount',
'PendingCount', 'SkippedCount', 'InconclusiveCount', 'TotalCount', 'Time', 'TestResult'
if ($CodeCoverage) {
@{ Name = 'CodeCoverage'; Expression = { $CoverageReport } }
}
)
$Result = $Pester | & $SafeCommands['Select-Object'] -Property $Properties
$Result.PSTypeNames.Insert(0, "Pester.Gherkin.Results")
$Result
}
function Import-GherkinSteps {
<#
.SYNOPSIS
Internal function for importing the script steps from a directory tree
.PARAMETER StepPath
The folder which contains step files
.PARAMETER Pester
Pester
#>
[CmdletBinding()]
param(
[Alias("PSPath")]
[Parameter(Mandatory = $True, Position = 0, ValueFromPipelineByPropertyName = $True)]
$StepPath,
[PSObject]$Pester
)
begin {
# Remove all existing steps
$Script:GherkinStepDefinitions.Clear()
# Remove all existing hooks
$Script:GherkinHooks.Clear()
}
process {
$StepFiles = & $SafeCommands['Get-ChildItem'] $StepPath -Filter "*.?teps.ps1" -Include "*.[sS]teps.ps1" -Recurse
foreach ($StepFile in $StepFiles) {
$invokeTestScript = {
[CmdletBinding()]
param (
[Parameter(Position = 0)]
[string] $Path
)
& $Path
}
Set-ScriptBlockScope -ScriptBlock $invokeTestScript -SessionState $Pester.SessionState
& $invokeTestScript $StepFile.FullName
}
& $SafeCommands['Write-Verbose'] "Loaded $($Script:GherkinStepDefinitions.Count) step definitions from $(@($StepFiles).Count) steps file(s)"
}
}
function Import-GherkinFeature {
<#
.SYNOPSIS
Internal function to import a Gherkin feature file. Wraps Gherkin.Parse
.PARAMETER Path
The path to the feature file to import
.PARAMETER Pester
Internal Pester object. For internal use only
.PARAMETER NoMultiline
Controls whether or not StepDefinition DocStrings and DataTables are printed to the console during
the test run.
.PARAMETER Expand
Controls whether or not Scenario Outline example scenarios are displayed fully expanded instead of
just printing the secnario outline and scenario example table. This can be useful to determine
exactly which step of a scenario outline example scenario failed.
#>
[CmdletBinding()]
param(
[Parameter(Position = 0, Mandatory = $True)]
[string]$Path,
[Parameter(Position = 1, Mandatory = $True)]
[PSObject]$Pester,
[switch]$NoMultiline,
[switch]$Expand
)
$AddMember = $SafeCommands['Add-Member']
$CompareObject = $SafeCommands['Compare-Object']
$GetUnique = $SafeCommands['Get-Unique']
$MeasureObject = $SafeCommands['Measure-Object']
$NewObject = $SafeCommands['New-Object']
$SelectObject = $SafeCommands['Select-Object']
$WhereObject = $SafeCommands['Where-Object']
$WriteWarning = $SafeCommands['Write-Warning']
$Background = $null
$Parser = & $NewObject Gherkin.Parser
$Feature = $Parser.Parse($Path).Feature | Convert-Tags
# If the entire feature is excluded by tags, then don't process it any further.
if ($Pester.ExcludeTagFilter -and @(& $CompareObject $Feature.Tags $Pester.ExcludeTagFilter -IncludeEqual -ExcludeDifferent).Length -gt 0) {
return
}
$Scenarios = @(
:scenarios foreach ($Child in $Feature.Children) {
$Child = $Child | & $AddMember -MemberType NoteProperty -Name FeaturePath -value $Path -PassThru
switch ($Child) {
{ $Child -is [Gherkin.Ast.Scenario] -or $Child -is [Gherkin.Ast.ScenarioOutline] } {
$ScenarioDef = $Child | Convert-Tags $Feature.Tags; break
}
{ $Child -is [Gherkin.Ast.Background] } {
$Background = $Child | & $AddMember -MemberType NoteProperty -Name Result -Value Passed -PassThru
continue scenarios
}
default {
& $WriteWarning "Unexpected Feature Child: $_"; break
}
}
if ($ScenarioDef -is [Gherkin.Ast.ScenarioOutline]) {
# If ExcludeTags were specified, check the scenario outline's tags before further processing
# the scenario outline.
if ($Pester.ExcludeTagFilter -and @(& $CompareObject $ScenarioDef.Tags $Pester.ExcludeTagFilter -IncludeEqual -ExcludeDifferent).Count -gt 0) {
continue scenarios
}
$ScenarioDefExamples = @(
foreach ($ExampleSet in $ScenarioDef.Examples) {
# Get the coulmn names from the scenario outline table so we can replace step text table tokens later
# when creating the scenario outline example scenarios.
${Column Names} = @($ExampleSet.TableHeader.Cells | & $SelectObject -ExpandProperty Value)
$NamesPattern = "<(?:$(${Column Names} -join "|"))>"
$ExampleSetScenarios = @()
$ExampleSetScenarios += @(
if ($Expand) {
$ExampleSet = $ExampleSet | & $AddMember -PassThru -MemberType NoteProperty -Name TableHeaderRow -Value "| $(
for ($j = 0; $j -lt $ExampleSet.TableHeader.Cells.Length; $j++) {
"$($ExampleSet.Tableheader.Cells[$j].Value) |"
}
)"
foreach ($Row in $ExampleSet.TableBody) {
# Generate example scenario name
$ExampleScenarioName = "| $(@($Row.Cells | & $SelectObject -ExpandProperty Value) -join ' | ') |"
# Replace Step Text scenario outline tokens with data from the example scenario row
$ExampleScenarioSteps = foreach ($Step in $ScenarioDef.Steps) {
[string]$StepText = $Step.Text
if ($StepText -match $NamesPattern) {
for ($n = 0; $n -lt ${Column Names}.Length; $n++) {
$Name = ${Column Names}[$n]
if ($Row.Cells[$n].Value -and $StepText -match "<${Name}>") {
$StepText = $StepText -replace "<${Name}>", $Row.Cells[$n].Value
}
}
}
if ($StepText -ne $Step.Text) {
& $NewObject Gherkin.Ast.Step $Step.Location, $Step.Keyword.Trim(), $StepText, $Step.Argument
}
else {
$Step
}
}
$ScenarioKeyword = Get-Translation 'scenario' $Feature.Language
& $NewObject Gherkin.Ast.Scenario $ExampleSet.Tags, $Row.Location, $ScenarioKeyword, $ExampleScenarioName, $null, $ExampleScenarioSteps |
& $AddMember -MemberType NoteProperty -Name Result -Value Passed -PassThru |
& $AddMember -MemberType NoteProperty -Name Expand -Value $Expand -PassThru |
& $AddMember -MemberType NoteProperty -Name ExampleSet -Value $ExampleSet -PassThru |
Convert-Tags $ScenarioDef.Tags
}
}
else {
$ExampleSetRows = [Gherkin.Ast.TableRow[]]@($ExampleSet.TableHeader)
foreach ($r in $ExampleSet.TableBody) { $ExampleSetRows += $r }
$TableColumnWidths = Get-TableColumnWidths $ExampleSetRows
$ExampleSet = $ExampleSet | & $AddMember -PassThru -MemberType NoteProperty -Name TableHeaderRow -Value "| $(
for ($j = 0; $j -lt $ExampleSet.TableHeader.Cells.Length; $j++) {
"{0,$(-$TableColumnWidths[$j])} |" -f $ExampleSet.Tableheader.Cells[$j].Value
}
)"
foreach ($Row in $ExampleSet.TableBody) {
$ExampleScenarioName = "| $(
for ($j = 0; $j -lt $Row.Cells.Length; $j++) {
"{0,$(-$TableColumnWidths[$j])} |" -f $Row.Cells[$j].Value
}
)"
# Replace Step Text scenario outline tokens with data from the example
# scenario row
$ExampleScenarioSteps = foreach ($Step in $ScenarioDef.Steps) {
[string]$StepText = $Step.Text
if ($StepText -match $NamesPattern) {
for ($n = 0; $n -lt ${Column Names}.Length; $n++) {
$Name = ${Column Names}[$n]
if ($Row.Cells[$n].Value -and $StepText -match "<${Name}>") {
$StepText = $StepText -replace "<${Name}>", $Row.Cells[$n].Value
}
}
}
if ($StepText -ne $Step.Text) {
$StepLocation = $Step.Location
& $NewObject Gherkin.Ast.Step $null, $Step.Keyword.Trim(), $StepText, $Step.Argument |
& $AddMember -MemberType NoteProperty -Name Location -Value $StepLocation -Force -PassThru
}
else {
$Step
}
}
$ExampleScenarioLocation = $Row.Location |
& $AddMember -MemberType NoteProperty -Name Path -Value $Path -PassThru
& $NewObject Gherkin.Ast.Scenario $ExampleSet.Tags, $ExampleScenarioLocation, $null, $ExampleScenarioName, $null, $ExampleScenarioSteps |
& $AddMember -MemberType NoteProperty -Name Result -Value Passed -PassThru |
& $AddMember -MemberType NoteProperty -Name Expand -Value $Expand -PassThru |
& $AddMember -MemberType NoteProperty -Name ExampleSet -Value $ExampleSet -PassThru |
Convert-Tags $ScenarioDef.Tags
}
}
)
if ($ExampleSetScenarios.Length -eq 0) { continue scenarios }
# Filter the example scenarios.
# Test the name filter first, since it will probably return one single item.
if ($Pester.TestNameFilter) {
$ExampleSetScenarios = foreach ($f in $Pester.TestNameFilter) {
$f = $f.Trim()
$ExampleSetScenarios | & $WhereObject {
$n = $_.Name.Trim()
$r = $n -like $f
$r = $r -or ($n -replace '(\s)\s+','$1') -like $f
$r -or $n -like ($f -replace '(\s)\s+','$1')
}
}
$ExampleSetScenarios = @($ExampleSetScenarios | & $GetUnique)
}
# If Include tags were specified, then only include scenarios having one or more of those tags.
if ($Pester.TagFilter) {
$ExampleSetScenarios = @(
$ExampleSetScenarios | & $WhereObject {
& $CompareObject $_.Tags $Pester.TagFilter -IncludeEqual -ExcludeDifferent }
)
}
# If ExcludeTags were specified, then exclude any example scenarios whose tags match any exclude tag.
if ($Pester.ExcludeTagFilter) {
$ExampleSetScenarios = @(
$ExampleSetScenarios | & $WhereObject {
!(& $CompareObject $_.Tags $Pester.ExcludeTagFilter -IncludeEqual -ExcludeDifferent) }
)
}
$ExampleSet |
& $AddMember -MemberType NoteProperty -Name Scenarios -Value $ExampleSetScenarios -PassThru |
& $AddMember -MemberType NoteProperty -Name ScenarioOutline -Value $ScenarioDef -PassThru
}
) | & $WhereObject { $_.Scenarios }
$ScenarioDef = $ScenarioDef | & $AddMember -MemberType NoteProperty -Name Examples -Value $ScenarioDefExamples -Force -PassThru
# Return the secnario outline iff. there are any example scenarios in any of the example sets.
# I.e. if all scenarios were filtered out of the scenario outline, don't return an empty scenario outline.
if (($ScenarioDef.Examples | & $SelectObject -ExpandProperty Scenarios | & $MeasureObject).Count -eq 0) {
continue scenarios
}
# It's possible only some of the examples sets are empty due to secnario filtering.
# THerefore, likewise, only return those Scenario Outline ExampleSets that contain example
# scenarios to be executed.
$ExampleSets = @($ScenarioDef.Examples | & $WhereObject { $_.Scenarios.Length -gt 0 })
& $NewObject Gherkin.Ast.ScenarioOutline $null, $ScenarioDef.Location, $ScenarioDef.Keyword.Trim(), $ScenarioDef.Name, $ScenarioDef.Description, $ScenarioDef.Steps, $null |
& $AddMember -MemberType NoteProperty -Name Examples -Value $ExampleSets -Force -PassThru |
& $AddMember -MemberType NoteProperty -Name Expand -Value $Expand -PassThru |
Convert-Tags $ScenarioDef.Tags
}
else {
# Apply filters to the scenario.
# Test the name filter first, since it will probably most quickly determine whethe or not to
# run the secnario at all.
if ($Pester.TestNameFilter -and @($Pester.TestNameFilter | & $WhereObject { $ScenarioDef.Name -like $_.Trim() }).Length -eq 0) {
continue scenarios
}
# If include tags were specified, then only include the scenario if it has one or more of
# those tags.
if ($Pester.TagFilter -and @(& $CompareObject $ScenarioDef.Tags $Pester.TagFilter -IncludeEqual -ExcludeDifferent).Length -eq 0) {
continue scenarios
}
# If ExcludeTags were specified, then exclude any example scenarios whose tags match any
# exclude tag.
if ($Pester.ExcludeTagFilter -and @(& $CompareObject $ScenarioDef.Tags $Pester.ExcludeTagFilter -IncludeEqual -ExcludeDifferent).Length -gt 0) {
continue scenarios
}
$ScenarioDef |
& $AddMember -MemberType NoteProperty -Name Result -Value Passed -PassThru |
& $AddMember -MemberType NoteProperty -Name Expand -Value $False -PassThru |
& $AddMember -MemberType NoteProperty -Name IsExampleSetScenario -Value $False -PassThru
}
}
)
$Scenarios = @($Scenarios | & $WhereObject { $null -ne $_})
$Feature = $Feature |
& $AddMember -MemberType NoteProperty -Name Scenarios -Value $Scenarios -Force -PassThru |
& $AddMember -MemberType NoteProperty -Name Background -Value $Background -Force -PassThru
if ($Feature.Scenarios -and $Feature.Scenarios.Length) {
$Feature
}
}
function Invoke-GherkinFeature {
<#
.SYNOPSIS
Internal function to (parse and) run a whole feature file
.PARAMETER FeatureFile
The feature file to invoke.
.PARAMETER Pester
Internal Pester object. For internal use only.
.PARAMETER NoMultiline
Controls whether or not Step Definition DocStrings and DataTables are displayed to the console
during the test run.
.PARAMETER Expand
Controls whether or not Scenario Outline example scenarios are displayed fully expanded instead of
just printing the scenario outline and table. This can be useful to determine exactly which step
of a scenrio outline example scenario is failing.
#>
[CmdletBinding()]
param(
[Alias('PSPath', 'Path')]
[Parameter(Position = 0, Mandatory = $True, ValueFromPipeline = $True, ValueFromPipelineByPropertyName = $True)]
[IO.FileInfo]$FeatureFile,
[Parameter(Position = 1, Mandatory = $True)]
[PSObject]$Pester,
[switch]$NoMultiline,
[switch]$Expand
)
# Make sure broken tests don't leave you in space:
$CWD = [Environment]::CurrentDirectory
$Location = & $SafeCommands['Get-Location']
[Environment]::CurrentDirectory = & $SafeCommands['Get-Location'] -PSProvider FileSystem
try {
$Parent = & $SafeCommands['Split-Path'] $FeatureFile.FullName
Import-GherkinSteps -StepPath $Parent -Pester $pester
$Feature = Import-GherkinFeature $FeatureFile.FullName $Pester -Expand:$Expand -NoMultiline:$NoMultiline
}
catch [Gherkin.ParserException] {
& $SafeCommands['Write-Error'] -Exception $_.Exception -Message "Skipped '$($FeatureFile.FullName)' because of parser error.`n$(($_.Exception.Errors | & $SafeCommands['Select-Object'] -Expand Message) -join "`n`n")"
continue
}
if (!$Feature) { return }
$null = $Pester.Features.Add($Feature)
try {
# To create a more user-friendly test report, we use the feature name for the test group
$Pester.EnterTestGroup($Feature.Name, 'Feature')
Invoke-GherkinHook BeforeEachFeature $Feature.Name $Feature.Tags
# If there is a feature background, the first executed scenario in the feature will result in the
# results of the Background execution being displayed. Future background executions for scenarios in
# the feature will not be displayed.
$Script:PrintGherkinFeatureBackground = $True
# Reset indentation level for displaying feature information on the console.
$Script:GherkinIndentationLevel = 0
$Feature | Write-Feature $Pester
foreach ($ScenarioDef in $Feature.Scenarios) {
# Reset indentation level for displaying scenario information on the console.
$Script:GherkinIndentationLevel = 1
if ($ScenarioDef -is [Gherkin.Ast.ScenarioOutline]) {
try {
$Pester.EnterTestGroup($ScenarioDef.Name, 'Scenario Outline')
Invoke-GherkinExamples $Pester $Feature.Background $ScenarioDef -NoMultiline:$NoMultiline
} finally {
$Pester.LeaveTestGroup($ScenarioDef.Name, 'Scenario Outline')
}
}
else {
Invoke-GherkinScenario $Pester $Feature.Background $ScenarioDef -NoMultiline:$NoMultiline
}
}
}
catch {
$firstStackTraceLine = $_.ScriptStackTrace -split '\r?\n$' | & $SafeCommands['Select-Object'] -First 1
$Pester.AddTestResult("Error occurred in test script '$($Feature.Path)'", 'Failed', $null, $_.Exception.Message, $firstStackTraceLine, $null, $null, $_)
# This is a hack to ensure that XML output is valid for now. The test-suite names come from the Describe attribute of the TestResult
# objects, and a blank name is invalid NUnit XML. This will go away when we promote test scripts to have their own test-suite nodes,
# planned for v4.0
$Pester.TestResult[-1].Describe = "Error in $($Feature.Path)"
$Pester.TestResult[-1] | Write-GherkinStepResult -Pester $Pester
}
finally {
Invoke-GherkinHook AfterEachFeature $Feature.Name $Feature.Tags
if ($Pester.CurrentTestGroup) {
$Pester.LeaveTestGroup($Feature.Name, 'Feature')
}
$Location | & $SafeCommands['Set-Location']
[Environment]::CurrentDirectory = $CWD
}
}
function Invoke-GherkinExamples {
[CmdletBinding()]
Param (
[Parameter(Position = 0, Mandatory = $True)]
[PSObject]$Pester,
[Parameter(Position = 1)]
#[Gherkin.Ast.Background]
$Background,
[Parameter(Position = 2, ValueFromPipeline = $True)]
#[Gherkin.Ast.ScenarioOutline]
$ScenarioOutline,
[switch]$NoMultiline
)
$Script:PrintGherkinScenarioOutline = $True
foreach ($ExampleSet in $ScenarioOutline.Examples) {
try {
$Script:PrintGherkinExampleSet = $True
foreach ($Scenario in $ExampleSet.Scenarios) {
Invoke-GherkinScenario $Pester $Background $Scenario -NoMultiline:$NoMultiline
}
}
finally {
$Script:GherkinIndentationLevel--
}
}
}
function Find-StepDefinition {
[CmdletBinding()]
[OutputType([ScriptBlock])]
Param (
[Parameter(Position = 0, Mandatory = $True)]
[PSObject]$Pester,
[Parameter(Position = 1, Mandatory = $True, ValueFromPipeline = $True)]
[Gherkin.Ast.Step]$Step
)
$AddMember = $SafeCommands['Add-Member']
$SelectObject = $SafeCommands['Select-Object']
$SortObject = $SafeCommands['Sort-Object']
$StepDefinitionRegex = $(
foreach ($StepDefinitionRegex in $Script:GherkinStepDefinitions.Keys) {
if ($Step.Text -match "^${StepDefinitionRegex}$") {
$StepDefinitionRegex | & $AddMember -MemberType NoteProperty -Name MatchCount -Value $Matches.Count -PassThru
break
}
}
) | & $SortObject MatchCount | & $SelectObject -First 1
if ($StepDefinitionRegex) {
New-Object PSObject -Property @{
PSTypeName = 'Pester.Gherkin.StepDefinition'
Regex = $StepDefinitionRegex
ScriptBlock = $Script:GherkinStepDefinitions.$StepDefinitionRegex
}
}
}
function Invoke-GherkinScenario {
<#
.SYNOPSIS
Internal function to (parse and) run a single scenario
#>
[CmdletBinding()]
param(
[Parameter(Position = 0, Mandatory = $True)]
[PSObject]$Pester,
[Parameter(Position = 1)]
#[Gherkin.Ast.Background] # <-- If you do this, PSv2 corerces away the PSObject wrapper
$Background, # <-- For Pester v5, this will not be an isue.
[Parameter(Position = 2, Mandatory = $True)]
#[Gherkin.Ast.Scenario] # <-- If you do this, PSv2 corerces away the PSObject wrapper
$Scenario, # <-- For Pester v5, this will not be an isue.
[switch]$NoMultiline
)
try {
$Pester.EnterTestGroup($Scenario.Name, 'Scenario')
$Pester.EnterTest()
# Setup "the World", as it's called in Ruby Cucumber, by creating a clean variable and mock scope and
# a new TestDrive.
$Script:GherkinScenarioScope = New-Module Scenario { }
$Script:GherkinSessionState = Set-SessionStateHint -PassThru -Hint Scenario -SessionState $Script:GherkinScenarioScope.SessionState
$Script:MockTable = @{ }
New-TestDrive
Invoke-GherkinHook BeforeEachScenario $Scenario.Name $Scenario.Tags
if ($Background) {
if ($Script:PrintGherkinFeatureBackground) {
$Background | Write-Background $Pester
}
$Background | Invoke-GherkinStep $Pester $Script:GherkinSessionState -NoMultiline:$NoMultiline
# Don't move this line above the call to `Invoke-GherkinStep` or the background steps results
# will not print to the console.
$Script:PrintGherkinFeatureBackground = $False
# Since feature background steps run as part of every scenario, the outcome of the background
# steps contributes to the outcome of the scenario as a whole.
$Scenario.Result = $Background.Result
}
if ($Scenario.ExampleSet) {
if ($Script:PrintGherkinScenarioOutline) {
$Scenario.ExampleSet.ScenarioOutline | Write-ScenarioOutline $Pester
$Script:PrintGherkinScenarioOutline = $False
}
if ($Script:PrintGherkinExampleSet) {
$Scenario.ExampleSet | Write-ExampleSet $Pester
$Script:PrintGherkinExampleSet = $False
}
}
if (!$Scenario.ExampleSet -or $Scenario.Expand) {
$Scenario | Write-Scenario $Pester
}
$Scenario | Invoke-GherkinStep $Pester $Script:GherkinSessionState -NoMultiline:$NoMultiline
if ($Scenario.ExampleSet -and !$Scenario.Expand) {
$Scenario | Write-Scenario $Pester
}
Invoke-GherkinHook AfterEachScenario $Scenario.Name $Scenario.Tags
}
catch {
$firstStackTraceLine = $_.ScriptStackTrace -split '\r?\n' | & $SafeCommands['Select-Object'] -First 1
$Pester.AddTestResult("Error occurred in scenario '$($Scenario.Name)'", "Failed", $null, $_.Exception.Message, $firstStackTraceLine, $null, $null, $_)
# This is a hack to ensure that XML output is valid for now. The test-suite names come from the Describe attribute of the TestResult
# objects, and a blank name is invalid NUnit XML. This will go away when we promote test scripts to have their own test-suite nodes,
# planned for v4.0
$Pester.TestResult[-1].Describe = "Error in $($Scenario.Name)"
$Pester.TestResult[-1] | Write-GherkinStepResult -Pester $Pester
} finally {
Remove-TestDrive
Exit-MockScope
$Pester.LeaveTest()
$Pester.LeaveTestGroup($Scenario.Name, 'Scenario')
}
}
function Find-GherkinStep {
<#
.SYNOPSIS
Find a step implmentation that matches a given step
.DESCRIPTION
Searches the *.Steps.ps1 files in the BasePath (current working directory, by default)
Returns the step(s) that match
.PARAMETER Step
The text from feature file
.PARAMETER BasePath
The path to search for step implementations.
.EXAMPLE
```ps
Find-GherkinStep -Step 'And the module is imported'
Step Source Implementation
---- ------ --------------
And the module is imported .\module.Steps.ps1: line 39 ...
```
#>
[CmdletBinding()]
param(
[string]$Step,
[string]$BasePath = $Pwd
)
$OriginalGherkinSteps = $Script:GherkinStepDefinitions
try {
Import-GherkinSteps $BasePath -Pester $PSCmdlet
$KeyWord, $StepText = $Step -split "(?<=^(?:Given|When|Then|And|But))\s+"
if (!$StepText) {
$StepText = $KeyWord
}
& $SafeCommands['Write-Verbose'] "Searching for '$StepText' in $($Script:GherkinStepDefinitions.Count) steps"
$(
foreach ($StepCommand in $Script:GherkinStepDefinitions.Keys) {
& $SafeCommands['Write-Verbose'] "... $StepCommand"
if ($StepText -match "^${StepCommand}$") {
& $SafeCommands['Write-Verbose'] "Found match: $StepCommand"
$StepCommand | & $SafeCommands['Add-Member'] -MemberType NoteProperty -Name MatchCount -Value $Matches.Count -PassThru
}
}
) | & $SafeCommands['Sort-Object'] MatchCount | & $SafeCommands['Select-Object'] @{
Name = 'Step'
Expression = { $Step }
}, @{
Name = 'Source'
Expression = { $Script:GherkinStepDefinitions["$_"].Source }
}, @{
Name = 'Implementation'
Expression = { $Script:GherkinStepDefinitions["$_"] }
} -First 1
# $StepText = "{0} {1} {2}" -f $Step.Keyword.Trim(), $Step.Text, $Script:GherkinStepDefinitions[$StepCommand].Source
}
finally {
$Script:GherkinStepDefinitions = $OriginalGherkinSteps
}
}
function Invoke-GherkinStep {
<#
.SYNOPSIS
Run a single gherkin step, given the text from the feature file
.PARAMETER Pester
Pester state object. For internal use only
.PARAMETER ScenarioState
Gherkin state object. For internal use only
.PARAMETER ScenarioDefinition
An array of Gherkin.Ast.ScenarioDefinition objects, which is the absract base class for
Gherkin.Ast.Background, Gherkin.Ast.ScenarioOutline and Gherkin.Ast.Scenario. Typically, you will
pass the Feature Background and the current Scenario into this function to execute the scenario
steps.
.PARAMETER NoMultiline
If specified, instructs Pester Gherkin to not print DocString and DataTable step arguments to the
console.
#>
[CmdletBinding()]
Param (
[Parameter(Position = 0, Mandatory = $True)]
[PSObject]$Pester,
[Parameter(Position = 1, Mandatory = $True)]
[System.Management.Automation.SessionState]$ScenarioState,
[Parameter(Position = 2, Mandatory = $True, ValueFromPipeline = $True)]
[AllowNull()]
#[Gherkin.Ast.ScenarioDefinition[]] # <-- If you do this, PSv2 corerces away the PSObject wrapper
$ScenarioDefinition, # <-- For Pester v5, this will not be an isue.
[switch]$NoMultiline
)
Begin {
$GetMember = $SafeCommands['Get-Member']
$NewObject = $SafeCommands['New-Object']
$ScenarioResult = 'Passed'
}
Process {
foreach ($ScenarioDef in $ScenarioDefinition) {
# For PowerShell 2.0, need to explicitly check for !$ScenarioDef, otherwise, PowerShell just
# keeps going and ends up failing the step (and the whole scenario)!
if (!$ScenarioDef) {
continue
}
if ($ScenarioDef.Result -ne 'Passed') {
# This only happens when the ScenarioDef is a Background and it was previously run and one of
# its steps was not 'Passed'. Performing this check can avoid doing a lot of extra processing.
$ScenarioResult = $ScenarioDef.Result
}
foreach ($Step in $ScenarioDef.Steps) {
try {
$StepDefinition = Find-StepDefinition $Pester $Step
if (!$StepDefinition) {
$FeaturePath = if ($ScenarioDef | & $GetMember -Name ExampleSet) {
$ScenarioDef.ExampleSet.ScenarioOutline.FeaturePath
} else {
$ScenarioDef.FeaturePath
}
$Step | Set-StepUndefined $FeaturePath
}
elseif ($ScenarioResult -eq 'Passed') {
$PesterErrorRecord = $null
$Elapsed = 0
$NamedArguments, $Parameters = Get-StepParameters $Step $StepDefinition.Regex
if ($NamedArguments.Count) {
$ScriptBlock = { . $StepDefinition.ScriptBlock @NamedArguments @Parameters }
}
else {
$ScriptBlock = { . $StepDefinition.ScriptBlock @Parameters }
}
Set-ScriptBlockScope -ScriptBlock $StepDefinition.ScriptBlock -SessionState $ScenarioState
try {
$StopWatch = & $NewObject System.Diagnostics.StopWatch
$StopWatch.Start()
$null = & $ScriptBlock
}
catch {
if ('PesterAssertionFailed', 'PesterGherkinStepPending' -contains $_.FullyQualifiedErrorId) {
$PesterErrorRecord = $_
$PesterErrorRecord.TargetObject.Step = $Step
$PesterErrorrecord.TargetObject.FeaturePath = $ScenarioDef.FeaturePath
}
else {
$FeaturePath = if ($ScenarioDef | & $GetMember -Name ExampleSet) {
$ScenarioDef.ExampleSet.ScenarioOutline.FeaturePath
} else {
$ScenarioDef.FeaturePath
}
$PesterErrorRecord = New-StepFailedErrorRecord $Step $FeaturePath $_
}
}
finally {
$StopWatch.Stop()
$Elapsed = $StopWatch.Elapsed
}
}
else {
$FeaturePath = if ($ScenarioDef | & $GetMember -Name ExampleSet) {
$ScenarioDef.ExampleSet.ScenarioOutline.FeaturePath
} else {
$ScenarioDef.FeaturePath
}
$Step | Set-StepSkipped $FeaturePath
}
}
catch {
$PesterErrorRecord = $_
}
# Convert unnamed arguments to "named" arguments
for ($p = 0; $p -lt $Parameters.Count; $p++) {
$NamedArguments."Unnamed-$p" = $Parameters[$p]
}
# Normally, PesterErrorRecord is an ErrorRecord. Sometimes, it's an exception which HAS an ErrorRecord
if ($PesterErrorRecord.ErrorRecord) {
$PesterErrorRecord = $PesterErrorRecord.ErrorRecord
$PesterErrorRecord.TargetObject.FeaturePath = $ScenarioDef.FeaturePath
}
# Convert the error to a Pester TestResult customized for Gherkin
$StepResult = ConvertTo-GherkinStepResult -ErrorRecord $PesterErrorRecord -Strict:$Pester.Strict
# Scenarios are either Passed, Failed, Pending, or Undefined.
# Skipped steps mean some other condition above has already occurred for an earlier step.
# So, don't set the scenario result. I.e. a scenario is never skipped.
if ($StepResult.Result -ne 'Skipped') {
$ScenarioResult = $StepResult.Result
}
# Add the step result to the list of results during this run.
$DisplayText = "{0} {1}" -f $Step.Keyword.Trim(), $Step.Text
$Pester.AddTestResult($DisplayText, $StepResult.Result, $Elapsed, $StepResult.FailureMessage, $StepResult.StackTrace, $null, $NamedArguments, $PesterErrorRecord)
# TODO: Get rid of "display" concerns from both this function and the TestResult object.
# * NOTE:
# * Because there are mixed concerns, and the information present in TestResult is not enough to
# * know how a step definition execution result should be displayed for Gherkin, and because
# * display data _really_ doesn't belong in TestResult, for now, until the concerns are separated,
# * let Write-GherkinStepResult accept a parameter for the step definition's multiline argument,
# * if any.
if ($ScenarioDef -isnot [Gherkin.Ast.Background] -or $Script:PrintGherkinFeatureBackground) {
if (!$ScenarioDef.ExampleSet -or $ScenarioDef.Expand) {
if (!$NoMultiline -and $Step.Argument) {
$Pester.TestResult[-1] | Write-GherkinStepResult $Pester $Step.Argument
}
else {
$Pester.TestResult[-1] | Write-GherkinStepResult $Pester
}
}
}
}
$ScenarioDef.Result = $ScenarioResult
}
}
}
function Get-StepParameters {
<#
.SYNOPSIS
Internal function for determining parameters for a step implementation
.PARAMETER Step
The parsed step from the feature file
.PARAMETER CommandName
The text of the best matching step
#>
param($Step, $CommandName)
$Null = $Step.Text -match $CommandName
$NamedArguments = @{ }
$Parameters = @{ }
foreach ($kv in $Matches.GetEnumerator()) {
switch ($kv.Name -as [int]) {
0 {
} # toss zero (where it matches the whole string)
$null {
$NamedArguments.($kv.Name) = $ExecutionContext.InvokeCommand.ExpandString($kv.Value)
}
default {
$Parameters.([int]$kv.Name) = $ExecutionContext.InvokeCommand.ExpandString($kv.Value)
}
}
}
$Parameters = @($Parameters.GetEnumerator() | & $SafeCommands['Sort-Object'] Name | & $SafeCommands['Select-Object'] -ExpandProperty Value)
# TODO: Convert parsed tables to tables....
if ($Step.Argument -is [Gherkin.Ast.DataTable]) {
$NamedArguments.Table = $Step.Argument.Rows | ConvertTo-HashTableArray
}
if ($Step.Argument -is [Gherkin.Ast.DocString]) {
# trim empty matches if we're attaching DocStringArgument
$Parameters = @( $Parameters | & $SafeCommands['Where-Object'] { $_.Length } ) + $Step.Argument.Content
}
return @($NamedArguments, $Parameters)
}
function Get-TableColumnWidths {
[CmdletBinding()]
[OutputType([int[]])]
Param (
[Parameter(Position = 0, Mandatory = $True)]
[Gherkin.Ast.TableRow[]]$Rows
)
Begin {
$MeasureObject = $SafeCommands['Measure-Object']
$SelectObject = $SafeCommands['Select-Object']
}
Process {
$TableRows = @(
foreach ($r in $Rows) {
, [string[]]@($r.Cells | & $SelectObject -ExpandProperty Value)
}
)
# Check if the table has more than one column. If so, we need to transpose the table so we can
# ascertain, for ecah row, the widest column width.
if ($TableRows[0].Length -gt 1) {
$TransposedTableRows = @(
for ($i = $TableRows[0].Length - 1; $i -ge 0; $i--) {
, [string[]]@(for ($j = 0; $j -lt $TableRows.Length; $j++) { $TableRows[$j][$i] })
}
)
[Array]::Reverse($TransposedTableRows)
, [int[]]@(
foreach ($TransposedRow in $TransposedTableRows) {
$TransposedRow |
& $MeasureObject -Property Length -Maximum |
& $SelectObject -ExpandProperty Maximum
}
)
}
else {
[int[]]@(
@(
foreach ($Row in $TableRows) {
$Row |
& $MeasureObject -Property Length -Maximum |
& $SelectObject -ExpandProperty Maximum
}
) | & $MeasureObject -Maximum | & $SelectObject -ExpandProperty Maximum
)
}
}
}
function Convert-Tags {
<#
.SYNOPSIS
Internal function for tagging Gherkin feature files (including inheritance from the feature)
#>
[CmdletBinding()]
param(
[Parameter(ValueFromPipeline = $true)]
$InputObject,
[Parameter(Position = 0)]
[string[]]$BaseTags = @()
)
process {
# Adapt the Gherkin .Tags property to the way we prefer it...
[string[]]$Tags = foreach ($tag in $InputObject.Tags | & $SafeCommands['Where-Object'] { $_ }) {
$tag.Name.TrimStart("@")
}
$InputObject | & $SafeCommands['Add-Member'] -MemberType NoteProperty -Name Tags -Value ([string[]]($Tags + $BaseTags)) -Force -PassThru
}
}
function ConvertTo-HashTableArray {
<#
.SYNOPSIS
Internal function for converting Gherkin AST tables to arrays of hashtables for splatting
#>
[CmdletBinding()]
param(
[Parameter(ValueFromPipeline = $true)]
[Gherkin.Ast.TableRow[]]$InputObject
)
begin {
${Column Names} = @()
${Result Table} = @()
}
process {
# Convert the first table row into headers:
${InputObject Rows} = @($InputObject)
if (!${Column Names}) {
& $SafeCommands['Write-Verbose'] "Reading Names from Header"
${InputObject Header}, ${InputObject Rows} = ${InputObject Rows}
${Column Names} = @(${InputObject Header}.Cells | & $SafeCommands['Select-Object'] -ExpandProperty Value)
}
if ( $null -ne ${InputObject Rows} ) {
& $SafeCommands['Write-Verbose'] "Processing $(${InputObject Rows}.Length) Rows"
foreach (${InputObject row} in ${InputObject Rows}) {
${Pester Result} = @{ }
for ($n = 0; $n -lt ${Column Names}.Length; $n++) {
${Pester Result}.Add(${Column Names}[$n], ${InputObject row}.Cells[$n].Value)
}
${Result Table} += @(${Pester Result})
}
}
}
end {
${Result Table}
}
}
function Get-Translations($TranslationKey, $Language) {
<#
.SYNOPSIS
Internal function to get all translations for a translation key and language
.PARAMETER TranslationKey
The key name inside the language in gherkin-languages.json, e.g. 'scenarioOutline'
.PARAMETER Language
The used language, e.g. 'en'
.OUTPUTS
System.String[] an array of all the translations
#>
if (-not (Test-Path variable:Script:GherkinLanguagesJson)) {
$Script:GherkinLanguagesJson = ConvertFrom-Json2 (Get-Content "${Script:PesterRoot}/lib/Gherkin/gherkin-languages.json" | Out-String)
# We override the fixed values for 'Describe' and 'Context' of Gherkin.psd1 or Output.ps1 since the language aware keywords
# (e.g. 'Feature'/'Funktionalität' or 'Scenario'/'Szenario') are provided by Gherkin.dll and we do not want to duplicate them.
$Script:ReportStrings.Describe = "{0}" # instead of 'Feature: {0}' or 'Describing {0}'
$Script:ReportStrings.Context = "{0}" # instead of 'Scenario: {0}' or 'Context {0}'
}
$foundTranslations = $Script:GherkinLanguagesJson."$Language"."$TranslationKey"
if (-not $foundTranslations) {
Write-Warning "Translation key '$TranslationKey' is invalid"
}
return , $foundTranslations
}
function ConvertFrom-Json2([string] $jsonString) {
<#
.SYNOPSIS
Internal function to convert from JSON even for PowerShell 2
.PARAMETER jsonString
The JSON content as string
.OUTPUTS
the JSON content as array
#>
if ($PSVersionTable.PSVersion.Major -le 2) {
# On PowerShell <= 2 we use JavaScriptSerializer
Add-Type -Assembly System.Web.Extensions
return , (New-Object System.Web.Script.Serialization.JavaScriptSerializer).DeserializeObject($jsonString)
}
else {
# On PowerShell > 2 we use the built-in ConvertFrom-Json cmdlet
return ConvertFrom-Json $jsonString
}
}
function Get-Translation($TranslationKey, $Language, $Index = -1) {
<#
.SYNOPSIS
Internal function to get the first translation for a translation key and language
.PARAMETER TranslationKey
The key name inside the language in gherkin-languages.json, e.g. 'scenarioOutline'
.PARAMETER Language
The used language, e.g. 'en'
.PARAMETER Index
The index in the array of JSON values
If -1 is used for Index (the default value), this function will choose the most common translation of the JSON values
.OUTPUTS
System.String the chosen translation
#>
$translations = (Get-Translations $TranslationKey $Language)
if (-not $translations) {
return
}
if ($Index -lt 0 -or $Index -ge $translations.Length) {
# Fallback: if the index is not in range, we choose the most common translation
# Normally, the most common translation will be found at index one, but under some keys the index is zero.
$Index = if ($TranslationKey -eq "scenarioOutline" -or $TranslationKey -eq "feature" -or $TranslationKey -eq "examples") {
0
}
else {
1
}
}
return $translations[$Index]
}
function Test-Keyword($Keyword, $TranslationKey, $Language) {
<#
.SYNOPSIS
Internal function to check if the given keyword matches one of the translations for a translation key and language
.PARAMETER Keyword
The keyword, e.g. 'Scenario Outline'
.PARAMETER TranslationKey
The key name inside the language in gherkin-languages.json, e.g. 'scenarioOutline'
.PARAMETER Language
The used language, e.g. 'en'
.OUTPUTS
System.Boolean true, if the keyword matches one of the translations, false otherwise
#>
return (Get-Translations $TranslationKey $Language) -contains $Keyword
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUlWVB4hph2or3iBNyoNqRW0+f
# KDmgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQQDExdEaWdpQ2VydCBUaW1lc3RhbXAgMjAyMTCCASIwDQYJKoZIhvcN
# AQEBBQADggEPADCCAQoCggEBAMLmYYRnxYr1DQikRcpja1HXOhFCvQp1dU2UtAxQ
# tSYQ/h3Ib5FrDJbnGlxI70Tlv5thzRWRYlq4/2cLnGP9NmqB+in43Stwhd4CGPN4
# bbx9+cdtCT2+anaH6Yq9+IRdHnbJ5MZ2djpT0dHTWjaPxqPhLxs6t2HWc+xObTOK
# fF1FLUuxUOZBOjdWhtyTI433UCXoZObd048vV7WHIOsOjizVI9r0TXhG4wODMSlK
# XAwxikqMiMX3MFr5FK8VX2xDSQn9JiNT9o1j6BqrW7EdMMKbaYK02/xWVLwfoYer
# vnpbCiAvSwnJlaeNsvrWY4tOpXIc7p96AXP4Gdb+DUmEvQECAwEAAaOCAbgwggG0
# MA4GA1U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SEEyIEFzc3VyZWQgSUQgVGltZXN0YW1waW5n
# IENBAhANQkrgvjqI/2BAIc4UAPDdMA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODAzWjAv
# BgkqhkiG9w0BCQQxIgQgJhdFmWGIEXyTZ68XXaWFLuI7vUts6syJEpyfQnQj0Ekw
# DQYJKoZIhvcNAQEBBQAEggEAj6QvExYgWLt2Gg9c0K4u3Eg4LxVzSR4JzVkTZF5D
# Wq1/7YVrJqi+pQWXTRAwmx0bpdjBjMDS1UV1lwZ+UF4a8fzKPZ+xngzXU/H+7BCb
# bPFsmBdDoAAbLYqpod8pvtS4LRdA/kBnwWlGdQ/Ie8hwaVi+ugHL1oE6b0zkyod/
# ITacX7OnM4d+ISiBYe5YTuhczHlyAxgeiJwA2JRTdd3B7KZf2DED8/IqTMsqrldl
# 50ncwJnyXtdiSzf6nyMqWx0Ge6ONv1TO4TMdwZaUaLSW/DZNaDii4HGuu/dQMoo5
# Da2psS9I8bmOny3CWwd2DmgX5Xou6IUQoV5MQbtgcUtA5w==
# SIG # End signature block
function New-StepErrorRecord {
[CmdletBinding()]
[OutputType([System.Management.Automation.ErrorRecord])]
Param (
[Parameter(Position = 0, Mandatory = $True)]
[string]$ErrorId,
[Parameter(Position = 1, Mandatory = $True)]
[string]$Message,
[Parameter(Position = 2, Mandatory = $True)]
[System.Management.Automation.Errorcategory]$ErrorCategory,
[Parameter(Position = 3, Mandatory = $True, ValueFromPipeline = $True)]
[Object]$TargetObject
)
$Exception = New-Object Exception $Message
New-Object System.Management.Automation.ErrorRecord $Exception, $ErrorId, $ErrorCategory, $TargetObject
}
function New-StepFailedErrorRecord {
[CmdletBinding()]
[OutputType([System.Management.Automation.ErrorRecord])]
Param(
[Parameter(Position = 0, Mandatory = $True)]
[Gherkin.Ast.Step]$Step,
[Parameter(Position = 1, Mandatory = $True)]
[string]$FeaturePath,
[Parameter(Position = 2, Mandatory = $True, ValueFromPipeline = $True)]
[System.Management.Automation.ErrorRecord]$ErrorRecord
)
$Message = if ($ErrorRecord.TargetObject) {
$ErrorRecord.TargetObject
}
else {
$ErrorRecord.Exception.Message
}
$ErrorDetails = @{
ErrorId = 'PesterGherkinStepFailed'
Message = $Message
ErrorCategory = $ErrorRecord.CategoryInfo.Category
TargetObject = @{
File = $ErrorRecord.InvocationInfo.ScriptName
Line = $ErrorRecord.InvocationInfo.ScriptLineNumber
LineText = $ErrorRecord.InvocationInfo.Line
FeaturePath = $FeaturePath
ScriptStackTrace = $ErrorRecord.ScriptStackTrace
Step = $Step
}
}
New-StepErrorRecord @ErrorDetails
}
function New-StepPendingErrorRecord {
[CmdletBinding()]
[OutputType([System.Management.Automation.ErrorRecord])]
Param(
[Parameter(Position = 0, Mandatory = $True)]
[string]$LineText,
[Parameter(Position = 1, Mandatory = $True)]
[string]$StepDefinitionFilePath,
[Parameter(Position = 2, Mandatory = $True)]
[int]$Line
)
$ErrorDetails = @{
ErrorId = 'PesterGherkinStepPending'
Message = 'TODO: (Pester::Pending)'
ErrorCategory = [System.Management.Automation.ErrorCategory]::NotImplemented
TargetObject = @{
File = $StepDefinitionFilePath
Line = $Line
LineText = $LineText
}
}
New-StepErrorRecord @ErrorDetails
}
function New-StepSkippedErrorRecord {
[CmdletBinding()]
[OutputType([System.Management.Automation.ErrorRecord])]
Param(
[Parameter(Position = 0, Mandatory = $True)]
[string]$LineText,
[Parameter(Position = 1, Mandatory = $True)]
[string]$StepDefinitionFilePath,
[Parameter(Position = 2, Mandatory = $True)]
[int]$Line,
[Parameter(Position = 3, Mandatory = $True)]
[string]$FeaturePath,
[Parameter(Position = 4, Mandatory = $True)]
[Gherkin.Ast.Step]$Step
)
$ErrorDetails = @{
ErrorId = 'PesterGherkinStepSkipped'
Message = 'Step skipped due to previous failing, pending, or undefined steps.'
ErrorCategory = [System.Management.Automation.ErrorCategory]::ObjectNotFound
TargetObject = @{
File = $StepDefinitionFilePath
Line = $Line
LineText = $LineText
FeaturePath = $FeaturePath
Step = $Step
}
}
New-StepErrorRecord @ErrorDetails
}
function New-UndefinedStepErrorRecord {
[CmdletBinding()]
[OutputType([System.Management.Automation.ErrorRecord])]
Param (
[Parameter(Position = 0, Mandatory = $True)]
[string]$LineText,
[Parameter(Position = 1, Mandatory = $True)]
[string]$StepDefinitionFilePath,
[Parameter(Position = 2, Mandatory = $True)]
[int]$Line,
[Parameter(Position = 3, Mandatory = $True)]
[string]$FeaturePath,
[Parameter(Position = 4, Mandatory = $True)]
[Gherkin.Ast.Step]$Step
)
$ErrorDetails = @{
ErrorId = 'PesterGherkinStepUndefined'
Message = 'No matching step definition found.'
ErrorCategory = [System.Management.Automation.ErrorCategory]::ObjectNotFound
TargetObject = @{
File = $StepDefinitionFilePath
Line = $Line
LineText = $LineText
FeaturePath = $FeaturePath
Step = $Step
}
}
New-StepErrorRecord @ErrorDetails
}
function Set-StepPending {
<#
.SYNOPSIS
Using Set-StepPending inside of Step Definition ScriptBlocks will cause those steps to be marked as
Pending by the Pester Gherkin test runner.
.DESCRIPTION
If Set-StepPending is used inside of a Step Definition ScriptBlock, the step will be marked as pending,
as well as any scenarios making use of the step which are not already failed.
.EXAMPLE Mark a Gherkin step as Pending
Given '^this step is not yet implemented$' {
Set-StepPending
}
If you define a step definition such as the above, the output for this step will be:
Given this step is not yet implemented
TODO: (Pester:Pending)
#>
[CmdletBinding()]Param()
Assert-DescribeInProgress -CommandName Set-StepPending
$PendingStepDetails = @{
StepDefinitionFilePath = $MyInvocation.ScriptName
Line = $MyInvocation.ScriptLineNumber
LineText = $MyInvocation.Line.TrimEnd([System.Environment]::NewLine)
}
throw (New-StepPendingErrorRecord @PendingStepDetails)
}
function Set-StepSkipped {
<#
.SYNOPSIS
Sets a step as skipped.
.DESCRIPTION
This function creates an ErrorRecord with an Exception object, allowing Pester to
capture a stack trace for a skipped step, which could be a useful aid in debugging
the Pester test framework, more so than debugging user tests. Otherwise, all that
would be necessary is to call New-StepSkippedErrorRecord.
.EXAMPLE Mark a Gherkin step as Skipped
$Step | Set-StepSkipped $Scenario.FeaturePath
This is called in the Gherkin Pester test runner to set a step as skipped,
which provides a stack trace to aid in debugging Pester more than the test suite itself.
#>
[CmdletBinding()]
Param(
[Parameter(Position = 0, Mandatory = $True)]
[string]$FeaturePath,
[Parameter(Position = 1, Mandatory = $True, ValueFromPipeline = $True)]
[Gherkin.Ast.Step]$Step
)
Assert-DescribeInProgress -CommandName Set-StepUndefined
$SkippedStepDetails = @{
StepDefinitionFilePath = $MyInvocation.ScriptName
Line = $MyInvocation.ScriptLineNumber
LineText = $MyInvocation.Line.TrimEnd([System.Environment]::NewLine)
Step = $Step
FeaturePath = $FeaturePath
}
throw (New-StepSkippedErrorRecord @SkippedStepDetails)
}
function Set-StepUndefined {
<#
.SYNOPSIS
Sets a step as undefined.
.DESCRIPTION
This function creates an ErrorRecord with an Exception object, allowing Pester to
capture a stack trace for an undefined step, which could be a useful aid in debugging
the Pester test framework, more so than debugging user tests. Otherwise, all that
would be necessary is to call New-UndefiniedStepErrorRecord.
.EXAMPLE Mark a Gherkin step as Undefined
$Step | Set-StepUndefined $Scenario.FeaturePath
This is called in the Gherkin Pester test runner to set a step as undefined,
which provides a stack trace to aid in debugging Pester more than the test suite itself.
#>
[CmdletBinding()]
Param(
[Parameter(Position = 0, Mandatory = $true)]
[string]$FeaturePath,
[Parameter(Position = 1, Mandatory = $True, ValueFromPipeline = $True)]
[Gherkin.Ast.Step]$Step
)
Assert-DescribeInProgress -CommandName Set-StepUndefined
$UndefinedStepDetails = @{
StepDefinitionFilePath = $MyInvocation.ScriptName
Line = $MyInvocation.ScriptLineNumber
LineText = $MyInvocation.Line.TrimEnd([System.Environment]::NewLine)
Step = $Step
FeaturePath = $FeaturePath
}
throw (New-UndefinedStepErrorRecord @UndefinedStepDetails)
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDg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3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODAzWjAv
# BgkqhkiG9w0BCQQxIgQgj6/qn3ZwFIHYC7rxIGorj40CBs9BwCgYR2+cHYgEXJIw
# DQYJKoZIhvcNAQEBBQAEggEAnyDKHZGQYzPU5e9NevFdzM5KJgN4Fk9iqN15x6Qx
# zjs60mJ6jEGR3zLxz8nmtyoaJuK8t85XqfdgMCn9Z5ljURjcK50Pn3ypx9hQ2vNP
# I76gNpfv+JREbt73HClZ5jnduTffF5Mumqt9CCkj5QG1pHj5KbZSEAw5eMsVJFCn
# 5LbjB9dssQAbddUdG+WvR2A6oM4lntjveXL22toqnEtD0yyh1PRH+AD++lJ7JtgK
# lllZY5KPvtQfYCUdXUmLLCnBngjrA+/wo5DlFzy5f+n4d1dk/7bZcTUei+4O4tOD
# 9s1kS1m7eck43KyKNPQzRMpqOOcwqlfIB/Fi7r51ja1MKw==
# SIG # End signature block
function ConvertTo-GherkinStepResult {
param(
[String] $Name,
[Nullable[TimeSpan]] $Time,
[System.Management.Automation.ErrorRecord] $ErrorRecord,
[switch]$Strict
)
$GetMember = $SafeCommands['Get-Member']
$SelectObject = $SafeCommands['Select-Object']
$WhereObject = $SafeCommands['Where-Object']
$StackTraceFormatString = "at <{0}>, {1}: line {2}"
$StepResult = [PSCustomObject]@{
Name = $Name
Time = $Time
FailureMessage = ''
StackTrace = ''
ErrorRecord = $null
Success = $false
Result = 'Failed'
}
if (-not $ErrorRecord) {
$StepResult.Result = 'Passed'
$StepResult.Success = $true
$StepResult
return
}
# Convert the exception messages
$Exception = $ErrorRecord.Exception
$ExceptionLines = @()
while ($Exception) {
if ('PesterGherkinStepUndefined','PesterGherkinStepPending' -notcontains $ErrorRecord.FullyQualifiedErrorId) {
$ExceptionName = "$($Exception.GetType().Name): "
}
if ($Exception.Message) {
$MessageLines = $Exception.Message.Split([string[]]($([System.Environment]::NewLine), "\n", "`n"), [System.StringSplitOptions]::RemoveEmptyEntries)
}
if ($ErrorRecord.FullyQualifiedErrorId -ne 'PesterAssertionFailed' -and @($MessageLines).Length -gt 0) {
$MessageLines[0] = "${ExceptionName}$($MessageLines[0])"
}
[array]::Reverse($MessageLines)
$ExceptionLines += $MessageLines
$Exception = $Exception.InnerException
}
[array]::Reverse($ExceptionLines)
$StepResult.FailureMessage += $ExceptionLines
# Convert the Stack Trace, if present (there might be none if we are raising the error ourselves).
$StackTraceLines = @(
# For PowerShell v2, the ErrorRecord will not have a ScriptStackTrace property
if ( -not ($ErrorRecord | & $GetMember -Name ScriptStackTrace) ) {
$StackTraceFormatString -f 'ScriptBlock', $ErrorRecord.TargetObject.File, $ErrorRecord.TargetObject.Line
} else {
# TODO: this is a workaround see https://github.com/pester/Pester/pull/886
if ($null -ne $ErrorRecord.ScriptStackTrace) {
$ErrorRecord.ScriptStackTrace.Split([Environment]::NewLine, [System.StringSplitOptions]::RemoveEmptyEntries)
} elseif ($ErrorRecord.TargetObject -and $ErrorRecord.TargetObject.ScriptStackTrace) {
$ErrorRecord.TargetObject.ScriptStackTrace.Split([Environment]::NewLine, [System.StringSplitOptions]::RemoveEmptyEntries)
}
}
)
# For Gherkin tests, when an assertion fails, the failed assertion function calls show up in the stack
# trace before the step definition script block because the assertion's called in the ScriptBlock. BUT,
# we want the ScriptBlock in the stack trace (whith it's attendant line number) to report back to the
# user. So, here we filter out those lines from the ScriptStackTrace.
if ($ErrorRecord.FullyQualifiedErrorId -eq 'PesterAssertionFailed' -and (-not $global:PesterDebugPreference_ShowFullErrors)) {
$StackTraceLines = $StackTraceLines | & $WhereObject {
$_ -notmatch '^at (Should<End>|Invoke-(Legacy)?Assertion), .*(\\|/)Functions(\\|/)(Assertions(\\|/)Should\.ps1|.*\.ps1): line \d*$'
}
}
# Since we may need to take special action to make the stack trace nice,
# check here if we're running in "Strict" mode and set the result to Failed if we are.
if (!$Strict) {
switch ($ErrorRecord.FullyQualifiedErrorId) {
'PesterGherkinStepUndefined' { $StepResult.Result = 'Inconclusive'; break }
'PesterGherkinStepPending' { $StepResult.Result = 'Pending'; break }
'PesterGherkinStepSkipped' { $StepResult.Result = 'Skipped'; break }
}
}
$Count = 0
# Omit lines which are internal to Pester
$Patterns = [string[]]@(
'^at (Invoke-Test|Context|Describe|InModuleScope|Invoke-Pester), .*(\\|/)Functions(\\|/).*\.ps1: line \d*$',
'^at Assert-MockCalled, .*(\\|/)Functions(\\|/)Mock\.ps1: line \d*$',
'^at (<ScriptBlock>|Invoke-Gherkin.*), (<No file>|.*(\\|/)Functions(\\|/).*\.ps1): line \d*$'
)
foreach ($line in $StackTraceLines) {
$LineMatchesAPattern = $null -ne ($Patterns | & $WhereObject { $line -match $_ })
if ($LineMatchesAPattern) {
break
}
$Count ++
}
$StepResult.StackTrace += @(
if (-not ($ExecutionContext.SessionState.PSVariable.GetValue('PesterDebugPreference_ShowFullErrors'))) {
if ($ErrorRecord.TargetObject -and $ErrorRecord.TargetObject.ContainsKey('FeaturePath')) {
$FeatureLine = $ErrorRecord.TargetObject.Step.Location.Line
$FeaturePath = $ErrorRecord.TargetObject.FeaturePath
@($StackTraceLines | & $SelectObject -First $Count) + @($StackTraceFormatString -f 'Feature', $FeaturePath, $FeatureLine)
}
}
) -join "`n"
$StepResult.ErrorRecord = $ErrorRecord
$StepResult
}
function Write-Background {
[CmdletBinding()]
Param (
[Parameter(Position = 0, Mandatory = $True)]
[PSObject]$Pester,
[Parameter(Position = 1, Mandatory = $True, ValueFromPipeline = $True)]
#[Gherkin.Ast.Background]
$Background
)
process {
if (-not ($Pester.Show | Has-Flag Context)) {
return
}
$WriteHost = $SafeCommands['Write-Host']
$Margin = $Script:Reportstrings.Margin * $Script:GherkinIndentationLevel
$BackgroundText = "${Margin}$($Script:ReportStrings.Background)" -f $Background.Keyword, $Background.Name
& $WriteHost
& $WriteHost $BackgroundText -ForegroundColor $Script:ReportTheme.Background
if ($Background.Description) {
& $WriteHost $Background.Description -ForegroundColor $Script:ReportTheme.BackgroundDescription
}
}
}
function Write-ExampleSet {
[CmdletBinding()]
param (
[Parameter(Position = 0, Mandatory = $True)]
[PSObject]$Pester,
[Parameter(Position = 1, Mandatory = $True, ValueFromPipeline = $True)]
#[Gherkin.Ast.Examples]
$ExampleSet
)
process {
if (-not ($Pester.Show | Has-Flag Context)) {
return
}
$WriteHost = $SafeCommands['Write-Host']
$Margin = $Script:Reportstrings.Margin * $Script:GherkinIndentationLevel++
$ExampleSetText = "${Margin}$($Script:ReportStrings.Examples)" -f $ExampleSet.Keyword, $ExampleSet.Name
& $WriteHost
& $WriteHost $ExampleSetText -ForegroundColor $Script:ReportTheme.Examples
if ($ExampleSet.Descripion) {
& $WriteHost $ExampleSet.Descripion -ForegroundColor $Script:ReportTheme.ExamplesDescription
}
if (!$ExampleSet.Scenarios[0].Expand) {
$Margin = $Script:ReportStrings.Margin * $Script:GherkinIndentationLevel
& $WriteHost "${Margin}|" -ForegroundColor $Script:ReportTheme.TableCellDivider -NoNewLine
foreach ($cellvalue in ($ExampleSet.TableHeaderRow.Trim('|') -split '\|')) {
& $WriteHost $cellValue -ForegroundColor $Script:ReportTheme.ScenarioOutlineTableHeaderCell -NoNewLine
& $WriteHost '|' -ForegroundColor $Script:ReportTheme.TableCellDivider -NoNewLine
}
& $WriteHost
}
}
}
function Write-Feature {
[CmdletBinding()]
param (
[Parameter(Position = 0, Mandatory = $True)]
[PSObject]$Pester,
[Parameter(Position = 1, Mandatory = $True, ValueFromPipeline = $True)]
#[Gherkin.Ast.Feature]
$Feature
)
process {
if (-not ( $Pester.Show | Has-Flag Describe)) {
return
}
$WriteHost = $SafeCommands['Write-Host']
$FgFeatureName = $Script:ReportTheme.Feature
$FgFeatureDescription = $Script:ReportTheme.FeatureDescription
$Margin = $Script:ReportStrings.Margin * $Script:GherkinIndentationLevel++
$FeatureText = "${Margin}$($Script:ReportStrings.Feature)" -f $Feature.Keyword, $Feature.Name
& $WriteHost
& $WriteHost $FeatureText -ForegroundColor $FgFeatureName
if ($Feature.Description) {
& $WriteHost $Feature.Description -ForegroundColor $FgFeatureDescription
}
}
}
function Write-ScenarioOutline {
[CmdletBinding()]
param (
[Parameter(Position = 0, Mandatory = $True)]
[PSObject]$Pester,
[Parameter(Position = 1, Mandatory = $True, ValueFromPipeline = $True)]
#[Gherkin.Ast.ScenarioOutline]
$ScenarioOutline
)
process {
if (-not ( $Pester.Show | Has-Flag Context)) {
return
}
$WriteHost = $SafeCommands['Write-Host']
$FgName = $Script:ReportTheme.ScenarioOutline
$FgDescription = $Script:ReportTheme.ScenarioOutlineDescription
$Margin = $Script:ReportStrings.Margin * $Script:GherkinIndentationLevel++
$ScenarioOutlineText = "${Margin}$($Script:ReportStrings.ScenarioOutline)" -f $ScenarioOutline.Keyword, $ScenarioOutline.Name
& $WriteHost
& $WriteHost $ScenarioOutlineText -ForegroundColor $FgName
if ($ScenarioOutline.Description) {
& $WriteHost $ScenarioOutline.Description -ForegroundColor $FgDescription
}
$Margin = $Script:ReportStrings.Margin * $Script:GherkinIndentationLevel
foreach ($Step in $ScenarioOutline.Steps) {
& $WriteHost "${Margin}$($Step.Keyword.Trim()) $($Step.Text.Trim())" -ForegroundColor $Script:ReportTheme.ScenarioOutlineStep
}
}
}
function Write-Scenario {
param (
[Parameter(Position = 0, Mandatory = $True)]
[PSObject]$Pester,
[Parameter(Position = 1, Mandatory = $True, ValueFromPipeline = $True)]
#[Gherkin.Ast.Scenario]
$Scenario
)
process {
if (-not ( $Pester.Show | Has-Flag Context)) {
return
}
$WhereObject = $SafeCommands['Where-Object']
$WriteHost = $SafeCommands['Write-Host']
$FgScenarioName = $Script:ReportTheme.Scenario
$FgScenarioDescription = $Script:ReportTheme.ScenarioDescription
if (!$Scenario.ExampleSet -or $Scenario.Expand) {
$Margin = $Script:ReportStrings.Margin * $Script:GherkinIndentationLevel
$ScenarioText = "${Margin}$($Script:ReportStrings.Scenario)" -f $Scenario.Keyword, $Scenario.Name
& $WriteHost
& $WriteHost $ScenarioText -ForegroundColor $FgScenarioName
if ($Scenario.Description) {
& $WriteHost $Scenario.Description -ForegroundColor $FgScenarioDescription
}
}
else {
$FgColor = switch ($Scenario.Result) {
'Passed' { $Script:ReportTheme.Pass; break }
'Failed' { $Script:ReportTheme.Fail; break }
'Skipped' { $Script:ReportTheme.Skipped; break }
'Pending' { $Script:ReportTheme.Pending; break }
'Inconclusive' { $Script:ReportTheme.Undefined; break }
}
$FgTableSep = $Script:ReportTheme.TableCellDivider
$Margin = $Script:ReportStrings.Margin * $Script:GherkinIndentationLevel
& $WriteHost "${Margin}|" -ForegroundColor $FgTableSep -NoNewLine
foreach ($Cell in ($Scenario.Name.Trim('|') -split '\|')) {
& $WriteHost $Cell -ForegroundColor $FgColor -NoNewLine
& $WriteHost '|' -ForegroundColor $FgTableSep -NoNewLine
}
& $WriteHost
if ($Scenario.Result -eq 'Failed') {
# Find the failing test result belonging to this scenario and show the error/stack trace.
$Pester.TestResult | & $WhereObject {
$ContextNameParts = $_.Context -split '\\'
$Result = $ContextNameParts[$ContextNameParts.Length - 1] -eq $Scenario.Name
$Result -and $_.Result -eq 'Failed'
} |
ForEach-Object {
Write-GherkinStepErrorText $_.FailureMessage $_.StackTrace ($Script:GherkinIndentationLevel + 1) $Script:ReportTheme.Fail
}
}
}
}
}
function Write-GherkinStepResult {
[CmdletBinding()]
param (
[Parameter(Position = 0, Mandatory = $True)]
[PSObject]$Pester,
[Parameter(Position = 1)]
[Gherkin.Ast.StepArgument]$MultilineArgument,
[Parameter(Position = 2, Mandatory = $True, ValueFromPipeline = $True)]
[PSObject]$StepResult
)
process {
$Quiet = $Pester.Show -eq [Pester.OutputTypes]::None
$OutputType = [Pester.OutputTypes] $StepResult.Result
$WriteToScreen = $Pester.Show | Has-Flag $OutputType
$SkipOutput = $Quiet -or (-not $WriteToScreen)
if ($SkipOutput) { return }
$WhereObject = $SafeCommands['Where-Object']
if (-not ($OutputType | Has-Flag 'Default, Summary')) {
$WriteStepParams = @{
StepResult = $StepResult
MultilineArgument = $MultilineArgument
}
$ErrorTextParams = @{
FailureMessage = $StepResult.FailureMessage
IndentationLevel = $Script:GherkinIndentationLevel + 2
}
switch ($StepResult.Result) {
Passed {
$WriteStepParams.StepTextColor = $Script:ReportTheme.Pass
$WriteStepParams.StepArgumentColor = $Script:ReportTheme.PassArgument
$WriteStepParams.StepDurationColor = $Script:ReportTheme.PassTime
Write-GherkinStepText @WriteStepParams
break
}
Inconclusive {
$WriteStepParams.StepTextColor = [ConsoleColor]$Script:ReportTheme.Undefined
$WriteStepParams.StepDurationColor = $Script:ReportTheme.UndefinedTime
Write-GherkinStepText @WriteStepParams
$ErrorTextParams.FailureMessage = ">>> $($ErrorTextParams.FailureMessage)"
$ErrorTextParams.StackTrace = $StepResult.StackTrace -split '\r?\n' | & $WhereObject {
$ExecutionContext.SessionState.PSVariable.GetValue('PesterDebugPreference_ShowFullErrors') -or $_ -notmatch '^at Set-StepUndefined'
}
$ErrorTextParams.ForegroundColor = $Script:ReportTheme.Undefined
Write-GherkinStepErrorText @ErrorTextParams
break
}
Pending {
$WriteStepParams.StepTextColor = $Script:ReportTheme.Pending
$WriteStepParams.StepArgumentColor = $Script:ReportTheme.PendingArgument
$WriteStepParams.StepDurationColor = $Script:ReportTheme.PendingTime
Write-GherkinStepText @WriteStepParams
$ErrorTextParams.StackTrace = $StepResult.StackTrace -split '\r?\n' | & $WhereObject {
$ExecutionContext.SessionState.PSVariable.GetValue('PesterdebugPreference_ShowFullErrors') -or $_ -notmatch '^at Set-StepPending'
}
$ErrorTextParams.ForegroundColor = $Script:ReportTheme.Pending
Write-GherkinStepErrortext @ErrorTextParams
break
}
Skipped {
$WriteStepParams.StepTextColor = $Script:ReportTheme.Skipped
$WriteStepParams.StepArgumentColor = $Script:ReportTheme.SkippedArgument
$WriteStepParams.StepDurationColor = $Script:ReportTheme.SkippedTime
Write-GherkinStepText @WriteStepParams
if ($ExecutionContext.SessionState.PSVariable.GetValue('PesterDebugPreference_ShowFullErrors')) {
$ErrorTextParams.StackTrace = $StepResult.StackTrace -split '\r?\n'
$ErrorTextParams.ForeGroundColor = $Script:ReportTheme.Skipped
Write-GherkinStepErrorText @ErrorTextParams
}
break
}
Failed {
$WriteStepParams.StepTextColor = $Script:ReportTheme.Fail
$WriteStepParams.StepArgumentColor = $Script:ReportTheme.FailArgument
$WriteStepParams.StepDurationColor = $Script:ReportTheme.FailTime
Write-GherkinStepText @WriteStepParams
$ErrorTextParams.StackTrace = $StepResult.StackTrace
$ErrorTextParams.ForegroundColor = $Script:ReportTheme.Fail
Write-GherkinStepErrortext @ErrorTextParams
break
}
}
}
}
}
function Write-GherkinStepErrorText {
[CmdletBinding()]
Param (
[Parameter(Position = 0, Mandatory = $True)]
[string]$FailureMessage,
[Parameter(Position = 1, Mandatory = $True)]
[string[]]$StackTrace,
[Parameter(Position = 2, Mandatory = $True)]
[int]$IndentationLevel,
[Parameter(Position = 3, Mandatory = $True)]
[ConsoleColor]$ForegroundColor
)
Process {
$ForEachObject = $SafeCommands['ForEach-Object']
$WriteHost = $SafeCommands['Write-Host']
$Margin = $Script:ReportStrings.Margin * $IndentationLevel
$StackTrace | & $ForEachObject -Begin {
$OutputLines = @($FailureMessage -split '\r?\n' | & $ForEachObject { "${Margin}$_" })
} -Process {
$OutputLines += $_ -replace '(?m)^', $Margin
} -End {
& $WriteHost "$($OutputLines -join [Environment]::NewLine)" -ForegroundColor $ForegroundColor
}
}
}
function Get-GherkinStepTextParts {
[CmdletBinding()]
[OutputType([hashtable[]])]
Param (
[Parameter(Position = 0, Mandatory = $True, ValueFromPipeline = $True)]
[PSObject]$StepResult
)
Process {
$StepText = $StepResult.Name
$StepParameters = $StepResult.Parameters
$Result = $StepResult.Result
# Split the step text into pieces, where the pieces are either generic step text, or input to the step
# definition. This will allow "highlighting" of the replaceable text parameters of the step
# definition.
$StepTextParts = [hashtable[]]@()
if ($Result -ne 'Inconclusive' -and $StepParameters.Keys.Count) {
$startingFromIndex = 0
foreach ($v in $StepParameters.Values) {
$indexOfValue = $StepText.Substring($startingFromIndex).IndexOf($v)
if ($indexOfValue -lt 0) {
$StepTextParts += [hashtable[]]@(@{ Type = 'Text'; Value = $StepText.Substring($startingFromIndex) })
$startingFromIndex += $StepTextParts[-1].Value.Length
break;
}
$StepTextParts += [hashtable[]]@(
@{ Type = 'Text'; Value = $StepText.Substring($startingFromIndex, $indexOfValue) },
@{ Type = 'Argument'; Value = $v }
)
$startingFromIndex += $indexOfValue + $v.Length
}
if ($startingfromIndex -lt ($StepText.Length - 1)) {
$StepTextParts += [hashtable[]]@(@{ Type = 'Text'; Value = $StepText.Substring($startingFromIndex) })
}
}
else {
$StepTextParts += [hashtable[]]@(@{ Type = 'Text'; Value = $StepText })
}
$StepTextParts
}
}
function Write-GherkinStepText {
[CmdletBinding()]
Param (
[Parameter(Position = 0)]
[ConsoleColor]$StepTextColor = [ConsoleColor]::Gray,
[Parameter(Position = 1)]
[ConsoleColor]$StepArgumentColor = [ConsoleColor]::Gray,
[Parameter(Position = 2)]
[ConsoleColor]$StepDurationColor = [ConsoleColor]::DarkGray,
[Parameter(Position = 3, Mandatory = $True, ValueFromPipeline = $True)]
[PSObject]$StepResult,
[Gherkin.Ast.StepArgument]$MultilineArgument
)
Process {
$ForEachObject = $SafeCommands['ForEach-Object']
$WriteHost = $SafeCommands['Write-Host']
$Margin = $Script:ReportStrings.Margin * ($Script:GherkinIndentationLevel + 1)
$StepResult |
Get-GherkinStepTextParts |
& $ForEachObject {
$FgColor = switch ($_.Type) {
'Text' { $StepTextColor; break }
'Argument' { $StepArgumentColor; break }
}
& $WriteHost -ForegroundColor $FgColor "${Margin}$($_.Value)" -NoNewline
# After we print the first part, we don't need the indentation anymore.
$Margin = ''
}
& $WriteHost -ForegroundColor $StepDurationColor " $(Get-HumanTime $StepResult.Time.TotalSeconds)"
if ($MultilineArgument) {
if ($MultilineArgument -is [Gherkin.Ast.DataTable]) {
Write-GherkinMultilineArgument $MultilineArgument
}
else {
Write-GherkinMultilineArgument $MultilineArgument $StepTextColor
}
}
}
}
filter Write-GherkinMultilineArgument {
[CmdletBinding(DefaultParameterSetName = 'DataTable')]
Param (
[Parameter(Position = 0, Mandatory = $True, ValueFromPipeline = $True, ParameterSetName = 'DataTable')]
[Gherkin.Ast.DataTable]$DataTable,
[Parameter(Position = 0, Mandatory = $True, ValueFromPipeline = $True, ParameterSetName = 'DocString')]
[Gherkin.Ast.DocString]$DocString,
[Parameter(Position = 1, Mandatory = $True, ParameterSetName = 'DocString')]
[ConsoleColor]$ForegroundColor = [ConsoleColor]::Gray
)
Process {
$Margin = $Script:ReportStrings.Margin * ($Script:GherkinIndentationLevel + 2)
if ($PSCmdlet.ParameterSetName -eq 'DataTable') {
$FgDiv = $Script:ReportTheme.TableCellDivider
$FgVal = $Script:ReportTheme.TableCellValue
$TableColumnWidths = Get-TableColumnWidths $DataTable.Rows
foreach ($Row in $DataTable.Rows) {
& $WriteHost -ForegroundColor $FgDiv "${Margin}|" -NoNewline
for ($ci = 0; $ci -lt $Row.Cells.Length; $ci++) {
& $WriteHost -ForegroundColor $FgVal (" {0,$(-$TableColumnWidths[$ci])} " -f $Row.Cells[$ci].Value) -NoNewline
& $WriteHost -ForegroundColor $FgDiv '|' -NoNewLine
}
& $WriteHost
}
}
else {
$DocString.Content -split '\r?\n' | ForEach-Object -Begin {
& $WriteHost -ForegroundColor $ForegroundColor "${Margin}`"`"`""
} -Process {
& $WriteHost -ForegroundColor $ForegroundColor "${Margin}${_}"
} -End {
& $WriteHost -ForegroundColor $ForegroundColor "${Margin}`"`"`""
}
}
}
}
function Write-GherkinReport {
[CmdletBinding()]
Param (
[Parameter(Position = 0, Mandatory = $True, ValueFromPipeline = $True)]
[PSObject]$Pester
)
begin {
$WriteHost = $SafeCommands['Write-Host']
}
process {
if (-not ($Pester.Show | Has-Flag Summary)) {
return
}
$Passed = $Script:ReportTheme.Pass
$Failure = $Script:ReportTheme.Fail
$Skipped = $Script:ReportTheme.Skipped
$Pending = $Script:ReportTheme.Pending
$Undefined = $Script:ReportTheme.Undefined
$PassedScenarioCount = $Pester.PassedScenarios.Count
$FailedScenarioCount = $Pester.FailedScenarios.Count
$PendingScenarioCount = $Pester.PendingScenarios.Count
$UndefinedScenarioCount = $Pester.UndefinedScenarios.Count
$TotalScenarioCount = $PassedScenarioCount + $FailedScenarioCount + $PendingScenarioCount + $UndefinedScenarioCount
$ScenarioSummaryCounts = [string[]]@($Script:ReportStrings.ScenarioSummary -f $TotalScenarioCount)
if ($TotalScenarioCount -eq 1) {
$ScenarioSummaryCounts[0] = $ScenarioSummaryCounts[0] -replace 'scenarios', 'scenario'
}
$ScenarioSummaryCounts += @(
($Script:ReportStrings.ScenariosFailed -f $FailedScenarioCount),
($Script:ReportStrings.ScenariosUndefined -f $UndefinedScenarioCount),
($Script:ReportStrings.ScenariosPending -f $PendingScenarioCount),
($Script:ReportStrings.ScenariosPassed -f $PassedScenarioCount)
)
$ScenarioSummaryData = foreach ($count in $ScenarioSummaryCounts) {
$null = $count -match '^(?<ScenarioCount>\d+) (?<Result>failed|undefined|skipped|pending|passed|scenarios? \()'
if ($Matches) {
switch ($Matches.Result) {
failed { $Foreground = $Failure; break }
undefined { $Foreground = $Undefined; break }
pending { $Foreground = $Pending; break }
passed { $Foreground = $Passed; break }
default { $Foreground = $Script:ReportTheme.Foreground; break }
}
if ($Matches.ScenarioCount -gt 0) {
[PSCustomObject]@{ Foreground = $Foreground; Text = $count }
}
}
}
& $WriteHost
for ($i = 0; $i -lt $ScenarioSummaryData.Length; $i++) {
$SummaryData = $ScenarioSummaryData[$i]
if ($i -eq $ScenarioSummaryData.Length - 1) {
& $WriteHost ($SummaryData.Text -replace ', ') -ForegroundColor $SummaryData.Foreground -NoNewLine
& $WriteHost ')' -ForegroundColor $Script:ReportTheme.Foreground
}
else {
& $WriteHost $SummaryData.Text -ForegroundColor $SummaryData.Foreground -NoNewLine
if ($i) {
& $WriteHost ', ' -Foreground $Script:ReportTheme.Foreground -NoNewLine
}
}
}
$StepSummaryCounts = [string[]]@($Script:ReportStrings.StepsSummary -f $Pester.TotalCount)
if ($Pester.TotalCount -eq 1) {
$StepSummaryCounts[0] = $StepSummaryCounts[0] -replace 'steps', 'step'
}
$StepSummaryCounts += @(
($Script:ReportStrings.StepsFailed -f $Pester.FailedCount),
($Script:ReportStrings.StepsUndefined -f $Pester.InconclusiveCount),
($Script:ReportStrings.StepsSkipped -f $Pester.SkippedCount),
($Script:ReportStrings.StepsPending -f $Pester.PendingCount),
($Script:ReportStrings.StepsPassed -f $Pester.PassedCount)
)
$StepSummaryData = foreach ($count in $StepSummaryCounts) {
$null = $count -match '^(?<StepCount>\d+) (?<Result>failed|undefined|skipped|pending|passed|steps? \()'
switch ($Matches.Result) {
failed { $Foreground = $Failure; break }
undefined { $Foreground = $Undefined; break }
skipped { $Foreground = $Skipped; break }
pending { $Foreground = $Pending; break }
passed { $Foreground = $Passed; break }
default { $Foreground = $Script:ReportTheme.Foreground; break }
}
if ($Matches.StepCount -gt 0) {
[PSCustomObject]@{ Foreground = $Foreground; Text = $count }
}
}
for ($i = 0; $i -lt $StepSummaryData.Length; $i++) {
$SummaryData = $StepSummaryData[$i]
if ($i -eq $StepSummaryData.Length - 1) {
& $WriteHost ($SummaryData.Text -replace ', ') -Foreground $SummaryData.Foreground -NoNewLine
& $WriteHost ')' -Foreground $Script:ReportTheme.Foreground
}
else {
& $WriteHost $SummaryData.Text -Foreground $SummaryData.Foreground -NoNewLine
if ($i) {
& $WriteHost ', ' -Foreground $Script:ReportTheme.Foreground -NoNewLine
}
}
}
& $WriteHost (
$Script:ReportStrings.Timing -f (
$Pester.TestResult |
Select-Object -ExpandProperty Time |
ForEach-Object -Begin {
$TotalTime = [TimeSpan]::Zero
} -Process {
$TotalTime += $_
} -End { $TotalTime }
)
) -ForegroundColor $Script:ReportTheme.Foreground
& $WriteHost
# TODO: Can we create a method that would auto-generate the Step Definition script blocks to the console for undefined steps?
# You can implement step definitions for undefined steps with these snippets:
#
# Given "the input '(.*?)'" {
# param($arg1)
# Set-TestPending
# }
}
}
# SIG # Begin signature block
# MII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GAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODAzWjAv
# BgkqhkiG9w0BCQQxIgQgLPy62Mb5MHMKGC8C9m9f6PpA0xZKrQqM8rdQ3CMgDCow
# DQYJKoZIhvcNAQEBBQAEggEAU6S0rFPxoEXyoWydI7a8eWOXTA3TOvW5O23chUy0
# gbxEJggbqhrsJ9aTjy3EFMckhYPNSXJ/T+OKvGjvoo2h34ZxHbgbZUg+S66LfMmR
# uYIyMtw3GQcH1IbjQA2sbNK/EdTdysDb7SCgwS3lrcOJuENWPAwqBLe9+5SdUIUT
# cAD5JWBIfw0YSUSnvjnfCto+fkbczZsX1KfvzwY+++a+E66dpLMXpcuH1n5k0NQX
# qZ5SmeBwyMGoPV/Hv2qKK3TGmARY3piiLYjvWyfJRe2txQ6JnIcBeJP91Lh7Dbkw
# ouauMyaBOq/OQ+mGquzqZh/N4bnKEIuGRlV5g7HrNRZZKQ==
# SIG # End signature block
function BeforeEachFeature {
<#
.SYNOPSIS
Defines a ScriptBlock hook to run before each feature to set up the test environment
.DESCRIPTION
BeforeEachFeature hooks are run before each feature that is in (or above) the folder where the hook is defined.
This is a convenience method, provided because unlike traditional RSpec Pester,
there is not a simple test script where you can put setup and clean up.
.PARAMETER Tags
Optional tags. If set, this hook only runs for features with matching tags
.PARAMETER Script
The ScriptBlock to run for the hook
.LINK
https://pester.dev/docs/commands/AfterEachFeature
.LINK
https://pester.dev/docs/commands/BeforeEachScenario
.LINK
https://pester.dev/docs/commands/AfterEachScenario
#>
[CmdletBinding(DefaultParameterSetName = "All")]
param(
[Parameter(Mandatory = $True, Position = 0, ParameterSetName = "Tags")]
[String[]]$Tags = @(),
[Parameter(Mandatory = $True, Position = 1, ParameterSetName = "Tags")]
[Parameter(Mandatory = $True, Position = 0, ParameterSetName = "All")]
[ScriptBlock]$Script
)
# This shouldn't be necessary, but PowerShell 2 is BAF
if ($PSCmdlet.ParameterSetName -eq "Tags") {
${Script:GherkinHooks}.BeforeEachFeature += @( @{ Tags = $Tags; Script = $Script } )
}
else {
${Script:GherkinHooks}.BeforeEachFeature += @( @{ Tags = @(); Script = $Script } )
}
}
function AfterEachFeature {
<#
.SYNOPSIS
Defines a ScriptBlock hook to run at the very end of a test run
.DESCRIPTION
AfterEachFeature hooks are run after each feature that is in (or above) the folder where the hook is defined.
This is a convenience method, provided because unlike traditional RSpec Pester,
there is not a simple test script where you can put setup and clean up.
.PARAMETER Tags
Optional tags. If set, this hook only runs for features with matching tags.
.PARAMETER Script
The ScriptBlock to run for the hook
.LINK
https://pester.dev/docs/commands/BeforeEachFeature
.LINK
https://pester.dev/docs/commands/BeforeEachScenario
.LINK
https://pester.dev/docs/commands/AfterEachScenario
#>
[CmdletBinding(DefaultParameterSetName = "All")]
param(
[Parameter(Mandatory = $True, Position = 0, ParameterSetName = "Tags")]
[String[]]$Tags = @(),
[Parameter(Mandatory = $True, Position = 1, ParameterSetName = "Tags")]
[Parameter(Mandatory = $True, Position = 0, ParameterSetName = "All")]
[ScriptBlock]$Script
)
# This shouldn't be necessary, but PowerShell 2 is BAF
if ($PSCmdlet.ParameterSetName -eq "Tags") {
${Script:GherkinHooks}.AfterEachFeature += @( @{ Tags = $Tags; Script = $Script } )
}
else {
${Script:GherkinHooks}.AfterEachFeature += @( @{ Tags = @(); Script = $Script } )
}
}
function BeforeEachScenario {
<#
.SYNOPSIS
Defines a ScriptBlock hook to run before each scenario to set up the test environment
.DESCRIPTION
BeforeEachScenario hooks are run before each scenario that is in (or above) the folder where the hook is defined.
You should not normally need this, because it overlaps significantly with the "Background" feature in the gherkin language.
This is a convenience method, provided because unlike traditional RSpec Pester,
there is not a simple test script where you can put setup and clean up.
.PARAMETER Tags
Optional tags. If set, this hook only runs for features with matching tags
.PARAMETER Script
The ScriptBlock to run for the hook
.LINK
https://pester.dev/docs/commands/AfterEachScenario
.LINK
https://pester.dev/docs/commands/BeforeEachFeature
.LINK
https://pester.dev/docs/commands/AfterEachFeature
#>
[CmdletBinding(DefaultParameterSetName = "All")]
param(
[Parameter(Mandatory = $True, Position = 0, ParameterSetName = "Tags")]
[String[]]$Tags = @(),
[Parameter(Mandatory = $True, Position = 1, ParameterSetName = "Tags")]
[Parameter(Mandatory = $True, Position = 0, ParameterSetName = "All")]
[ScriptBlock]$Script
)
# This shouldn't be necessary, but PowerShell 2 is BAF
if ($PSCmdlet.ParameterSetName -eq "Tags") {
${Script:GherkinHooks}.BeforeEachScenario += @( @{ Tags = $Tags; Script = $Script } )
}
else {
${Script:GherkinHooks}.BeforeEachScenario += @( @{ Tags = @(); Script = $Script } )
}
}
function AfterEachScenario {
<#
.SYNOPSIS
Defines a ScriptBlock hook to run after each scenario to set up the test environment
.DESCRIPTION
AfterEachScenario hooks are run after each Scenario that is in (or above) the folder where the hook is defined.
This is a convenience method, provided because unlike traditional RSpec Pester,
there is not a simple test script where you can put setup and clean up.
.PARAMETER Tags
Optional tags. If set, this hook only runs for features with matching tags
.PARAMETER Script
The ScriptBlock to run for the hook
.LINK
https://pester.dev/docs/commands/BeforeEachScenario
.LINK
https://pester.dev/docs/commands/BeforeEachFeature
.LINK
https://pester.dev/docs/commands/AfterEachFeature
#>
[CmdletBinding(DefaultParameterSetName = "All")]
param(
[Parameter(Mandatory = $True, Position = 0, ParameterSetName = "Tags")]
[String[]]$Tags = @(),
[Parameter(Mandatory = $True, Position = 1, ParameterSetName = "Tags")]
[Parameter(Mandatory = $True, Position = 0, ParameterSetName = "All")]
[ScriptBlock]$Script
)
# This shouldn't be necessary, but PowerShell 2 is BAF
if ($PSCmdlet.ParameterSetName -eq "Tags") {
${Script:GherkinHooks}.AfterEachScenario += @( @{ Tags = $Tags; Script = $Script } )
}
else {
${Script:GherkinHooks}.AfterEachScenario += @( @{ Tags = @(); Script = $Script } )
}
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWz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TIyODA0WjAv
# BgkqhkiG9w0BCQQxIgQgxThM88JaHAkhZqkLxVEujDVcdV4uPMWlvFkOxT5Jo3Uw
# DQYJKoZIhvcNAQEBBQAEggEAlL0EZDl+cvc1NapZ/5B0X5fdox1jn7r3u2sfmN4n
# RSbk5vXRq4jkLXse2ofDpvz9Vb3PPVBqV2PpJTkFWjkHpGkJWiMjLpKNIuy2waxS
# SVNCoQpzN86I6iRTRBUWU1qVJe17a22fY9JNVuWADYLhrYlxsfV9ekeE37SDV091
# a4bh/tvj26HulsLAEoB4vgYuFSOTJ+hmxZHhg/qeJ9l9ZvnHQ600/w3wlpA0nyCF
# WRyjQECuljk8bfta9PUqCz6tKBqTipNy9WBpDLPUukeXBHwFULnXOGap0lYaZ2Cu
# oKXHplFXgs6+8FqLn2BTZifCEJaodAncPg+VseFc/M/Ocg==
# SIG # End signature block
function GherkinStep {
<#
.SYNOPSIS
A step in a test, also known as a Given, When, or Then
.DESCRIPTION
Pester doesn't technically distinguish between the three kinds of steps.
However, we strongly recommend that you do!
These words were carefully selected to convey meaning which is crucial to get you into the BDD mindset.
In BDD, we drive development by not first stating the requirements, and then defining steps which can be
executed in a manner that is similar to unit tests.
.PARAMETER Name
The name of a gherkin step is actually a regular expression, from which capturing groups
are cast and passed to the parameters in the ScriptBlock
.PARAMETER Test
The ScriptBlock which defines this step. May accept parameters from regular expression
capturing groups (named or not), or from tables or multiline strings.
.EXAMPLE
```ps
# Gherkin Steps need to be placed in a *.Step.ps1 file
# filename: copyfile.Step.ps1
Given 'we have a destination folder' {
mkdir testdrive:\target -ErrorAction SilentlyContinue
'testdrive:\target' | Should Exist
}
When 'we call Copy-Item' {
{ Copy-Item testdrive:\source\something.txt testdrive:\target } | Should Not Throw
}
Then 'we have a new file in the destination' {
'testdrive:\target\something.txt' | Should Exist
}
# Steps need to allign with feature specifications in a *.feature file
# filename: copyfile.feature
Feature: You can copy one file
Scenario: The file exists, and the target folder exists
Given we have a source file
And we have a destination folder
When we call Copy-Item
Then we have a new file in the destination
And the new file is the same as the original file
```
.EXAMPLE
```ps
# This example shows a complex regex match that can be used for multiple lines in the feature specification
# The named match is mapped to the script parameter
# filename: namedregex.Step.ps1
Given 'we have a (?<name>\S*) function' {
param($name)
"$psscriptroot\..\MyModule\*\$name.ps1" | Should Exist
}
# filename: namedregex.feature
Scenario: basic feature support
Given we have public functions
And we have a New-Node function
And we have a New-Edge function
And we have a New-Graph function
And we have a New-Subgraph function
```
.LINK
https://sites.google.com/site/unclebobconsultingllc/the-truth-about-bdd
#>
param(
[Parameter(Mandatory = $True, Position = 0)]
[String]$Name,
[Parameter(Mandatory = $True, Position = 1)]
[ScriptBlock]$Test
)
# We need to be able to look up where this step is defined
$Definition = (& $SafeCommands["Get-PSCallStack"])[1]
$RelativePath = & $SafeCommands["Resolve-Path"] $Definition.ScriptName -relative
$Source = "{0}: line {1}" -f $RelativePath, $Definition.ScriptLineNumber
$Script:GherkinStepDefinitions.${Name} = $Test | & $SafeCommands["Add-Member"] -MemberType NoteProperty -Name Source -Value $Source -PassThru
}
Set-Alias Given GherkinStep
Set-Alias When GherkinStep
Set-Alias Then GherkinStep
Set-Alias And GherkinStep
Set-Alias But GherkinStep
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQURFXi4u8r1t4byMD4XE4w6ZNy
# V+qgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN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aBHFnZjil
# IvEWOWpcuPiP4rKY/dHq8fLXEZ7jhasZF8uGhCQilIfvybQ1tiOX7RGGJVTCbArk
# pcGtBYf6VwFoqsa6FRk9o+ZPMzcX9I2I0i/dRYTB5RQwdQ==
# SIG # End signature block
function In {
<#
.SYNOPSIS
A convenience function that executes a script from a specified path.
.DESCRIPTION
Before the script block passed to the execute parameter is invoked,
the current location is set to the path specified. Once the script
block has been executed, the location will be reset to the location
the script was in prior to calling In.
.PARAMETER Path
The path that the execute block will be executed in.
.PARAMETER Execute
The script to be executed in the path provided.
#>
[CmdletBinding()]
param(
$Path,
[ScriptBlock] $Execute
)
Assert-DescribeInProgress -CommandName In
$old_pwd = $pwd
& $SafeCommands['Push-Location'] $Path
$pwd = $Path
try {
Write-ScriptBlockInvocationHint -Hint "In" -ScriptBlock $Execute
& $Execute
}
finally {
& $SafeCommands['Pop-Location']
$pwd = $old_pwd
}
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUCxjkdNdJuDWNr+T6A/IJKgFr
# QJagghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQQDExdEaWdpQ2VydCBUaW1lc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#
.SYNOPSIS
Allows you to execute parts of a test script within the
scope of a PowerShell script module.
.DESCRIPTION
By injecting some test code into the scope of a PowerShell
script module, you can use non-exported functions, aliases
and variables inside that module, to perform unit tests on
its internal implementation.
InModuleScope may be used anywhere inside a Pester script,
either inside or outside a Describe block.
.PARAMETER ModuleName
The name of the module into which the test code should be
injected. This module must already be loaded into the current
PowerShell session.
.PARAMETER ScriptBlock
The code to be executed within the script module.
.EXAMPLE
```ps
# The script module:
function PublicFunction
{
# Does something
}
function PrivateFunction
{
return $true
}
Export-ModuleMember -Function PublicFunction
# The test script:
Import-Module MyModule
InModuleScope MyModule {
Describe 'Testing MyModule' {
It 'Tests the Private function' {
PrivateFunction | Should -Be $true
}
}
}
```
Normally you would not be able to access "PrivateFunction" from
the PowerShell session, because the module only exported
"PublicFunction". Using InModuleScope allowed this call to
"PrivateFunction" to work successfully.
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string]
$ModuleName,
[Parameter(Mandatory = $true)]
[scriptblock]
$ScriptBlock
)
if ($null -eq (& $SafeCommands['Get-Variable'] -Name Pester -ValueOnly -ErrorAction $script:IgnoreErrorPreference)) {
# User has executed a test script directly instead of calling Invoke-Pester
$sessionState = Set-SessionStateHint -PassThru -Hint "Caller - Captured in InModuleScope" -SessionState $PSCmdlet.SessionState
$Pester = New-PesterState -Path (& $SafeCommands['Resolve-Path'] .) -TestNameFilter $null -TagFilter @() -ExcludeTagFilter @() -SessionState $sessionState
$script:mockTable = @{ }
}
$module = Get-ScriptModule -ModuleName $ModuleName -ErrorAction Stop
$originalState = $Pester.SessionState
$originalScriptBlockScope = Get-ScriptBlockScope -ScriptBlock $ScriptBlock
try {
$sessionState = Set-SessionStateHint -PassThru -Hint "Module - $($module.Name)" -SessionState $module.SessionState
$Pester.SessionState = $sessionState
Set-ScriptBlockScope -ScriptBlock $ScriptBlock -SessionState $sessionState
do {
Write-ScriptBlockInvocationHint -Hint "InModuleScope" -ScriptBlock $ScriptBlock
& $ScriptBlock
} until ($true)
}
finally {
$Pester.SessionState = $originalState
Set-ScriptBlockScope -ScriptBlock $ScriptBlock -SessionStateInternal $originalScriptBlockScope
}
}
function Get-ScriptModule {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string] $ModuleName
)
try {
$modules = @(& $SafeCommands['Get-Module'] -Name $ModuleName -All -ErrorAction Stop)
}
catch {
throw "No module named '$ModuleName' is currently loaded."
}
$scriptModules = @($modules | & $SafeCommands['Where-Object'] { $_.ModuleType -eq 'Script' })
if ($modules.Count -eq 0) {
throw "No module named '$ModuleName' is currently loaded."
}
if ($scriptModules.Count -gt 1) {
throw "Multiple Script modules named '$ModuleName' are currently loaded. Make sure to remove any extra copies of the module from your session before testing."
}
if ($scriptModules.Count -eq 0) {
$actualTypes = @(
$modules |
& $SafeCommands['Where-Object'] { $_.ModuleType -ne 'Script' } |
& $SafeCommands['Select-Object'] -ExpandProperty ModuleType -Unique
)
$actualTypes = $actualTypes -join ', '
throw "Module '$ModuleName' is not a Script module. Detected modules of the following types: '$actualTypes'"
}
return $scriptModules[0]
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUhEUFP+FHQMReLAuWmI9pQdVx
# 1omgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDEL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kRUsCAnpoh0il9E+Zz
# 7923mCYoqljhEnnNg8yL8wd19cl8bgLbnGNHGbGHcTGUhA==
# SIG # End signature block
function It {
<#
.SYNOPSIS
Validates the results of a test inside of a Describe block.
.DESCRIPTION
The It command is intended to be used inside of a Describe or Context Block.
If you are familiar with the AAA pattern (Arrange-Act-Assert), the body of
the It block is the appropriate location for an assert. The convention is to
assert a single expectation for each It block. The code inside of the It block
should throw a terminating error if the expectation of the test is not met and
thus cause the test to fail. The name of the It block should expressively state
the expectation of the test.
In addition to using your own logic to test expectations and throw exceptions,
you may also use Pester's Should command to perform assertions in plain language.
You can intentionally mark It block result as inconclusive by using Set-TestInconclusive
command as the first tested statement in the It block.
.PARAMETER Name
An expressive phrase describing the expected test outcome.
.PARAMETER Test
The script block that should throw an exception if the
expectation of the test is not met.If you are following the
AAA pattern (Arrange-Act-Assert), this typically holds the
Assert.
.PARAMETER Pending
Use this parameter to explicitly mark the test as work-in-progress/not implemented/pending when you
need to distinguish a test that fails because it is not finished yet from a tests
that fail as a result of changes being made in the code base. An empty test, that is a
test that contains nothing except whitespace or comments is marked as Pending by default.
.PARAMETER Skip
Use this parameter to explicitly mark the test to be skipped. This is preferable to temporarily
commenting out a test, because the test remains listed in the output. Use the Strict parameter
of Invoke-Pester to force all skipped tests to fail.
.PARAMETER TestCases
Optional array of hashtable (or any IDictionary) objects. If this parameter is used,
Pester will call the test script block once for each table in the TestCases array,
splatting the dictionary to the test script block as input. If you want the name of
the test to appear differently for each test case, you can embed tokens into the Name
parameter with the syntax 'Adds numbers <A> and <B>' (assuming you have keys named A and B
in your TestCases hashtables.)
.EXAMPLE
```ps
function Add-Numbers($a, $b) {
return $a + $b
}
Describe "Add-Numbers" {
It "adds positive numbers" {
$sum = Add-Numbers 2 3
$sum | Should -Be 5
}
It "adds negative numbers" {
$sum = Add-Numbers (-2) (-2)
$sum | Should -Be (-4)
}
It "adds one negative number to positive number" {
$sum = Add-Numbers (-2) 2
$sum | Should -Be 0
}
It "concatenates strings if given strings" {
$sum = Add-Numbers two three
$sum | Should -Be "twothree"
}
}
```
.EXAMPLE
```ps
function Add-Numbers($a, $b) {
return $a + $b
}
Describe "Add-Numbers" {
$testCases = @(
@{ a = 2; b = 3; expectedResult = 5 }
@{ a = -2; b = -2; expectedResult = -4 }
@{ a = -2; b = 2; expectedResult = 0 }
@{ a = 'two'; b = 'three'; expectedResult = 'twothree' }
)
It 'Correctly adds <a> and <b> to get <expectedResult>' -TestCases $testCases {
param ($a, $b, $expectedResult)
$sum = Add-Numbers $a $b
$sum | Should -Be $expectedResult
}
}
```
.LINK
https://pester.dev/docs/commands/Describe
.LINK
https://pester.dev/docs/commands/Context
.LINK
https://pester.dev/docs/commands/Set-TestInconclusive
.LINK
https://pester.dev/docs/commands/Should
#>
[CmdletBinding(DefaultParameterSetName = 'Normal')]
param(
[Parameter(Mandatory = $true, Position = 0)]
[string] $Name,
[Parameter(Position = 1)]
[ScriptBlock] $Test = { },
[System.Collections.IDictionary[]] $TestCases,
[Parameter(ParameterSetName = 'Pending')]
[Switch] $Pending,
[Parameter(ParameterSetName = 'Skip')]
[Alias('Ignore')]
[Switch] $Skip
)
ItImpl -Pester $pester -OutputScriptBlock ${function:Write-PesterResult} @PSBoundParameters
}
function ItImpl {
[CmdletBinding(DefaultParameterSetName = 'Normal')]
param(
[Parameter(Mandatory = $true, Position = 0)]
[string]$Name,
[Parameter(Position = 1)]
[ScriptBlock] $Test,
[System.Collections.IDictionary[]] $TestCases,
[Parameter(ParameterSetName = 'Pending')]
[Switch] $Pending,
[Parameter(ParameterSetName = 'Skip')]
[Alias('Ignore')]
[Switch] $Skip,
$Pester,
[scriptblock] $OutputScriptBlock
)
Assert-DescribeInProgress -CommandName It
# Jumping through hoops to make strict mode happy.
if ($PSCmdlet.ParameterSetName -ne 'Skip') {
$Skip = $false
}
if ($PSCmdlet.ParameterSetName -ne 'Pending') {
$Pending = $false
}
#unless Skip or Pending is specified you must specify a ScriptBlock to the Test parameter
if (-not ($PSBoundParameters.ContainsKey('test') -or $Skip -or $Pending)) {
If ($Name.Contains("`n")) {
throw "Name parameter has multiple lines and no script block is provided. (Have you provided a name for the test group?)"
}
else {
throw 'No test script block is provided. (Have you put the open curly brace on the next line?)'
}
}
#the function is called with Pending or Skipped set the script block if needed
if ($null -eq $Test) {
$Test = { }
}
#mark empty Its as Pending
if ($PSVersionTable.PSVersion.Major -le 2 -and
$PSCmdlet.ParameterSetName -eq 'Normal' -and
[String]::IsNullOrEmpty((Remove-Comments $Test.ToString()) -replace "\s")) {
$Pending = $true
}
elseIf ($PSVersionTable.PSVersion.Major -gt 2) {
#[String]::IsNullOrWhitespace is not available in .NET version used with PowerShell 2
# AST is not available also
$testIsEmpty =
[String]::IsNullOrEmpty($Test.Ast.BeginBlock.Statements) -and
[String]::IsNullOrEmpty($Test.Ast.ProcessBlock.Statements) -and
[String]::IsNullOrEmpty($Test.Ast.EndBlock.Statements)
if ($PSCmdlet.ParameterSetName -eq 'Normal' -and $testIsEmpty) {
$Pending = $true
}
}
$pendingSkip = @{ }
if ($PSCmdlet.ParameterSetName -eq 'Skip') {
$pendingSkip['Skip'] = $Skip
}
else {
$pendingSkip['Pending'] = $Pending
}
if ($null -ne $TestCases -and $TestCases.Count -gt 0) {
foreach ($testCase in $TestCases) {
$expandedName = [regex]::Replace($Name, '<([^>]+)>', {
$capture = $args[0].Groups[1].Value
if ($testCase.Contains($capture)) {
$value = $testCase[$capture]
# skip adding quotes to non-empty strings to avoid adding junk to the
# test name in case you want to expand captures like 'because' or test name
if ($value -isnot [string] -or [string]::IsNullOrEmpty($value)) {
Format-Nicely $value
}
else {
$value
}
}
else {
"<$capture>"
}
})
$splat = @{
Name = $expandedName
Scriptblock = $Test
Parameters = $testCase
ParameterizedSuiteName = $Name
OutputScriptBlock = $OutputScriptBlock
}
Invoke-Test @splat @pendingSkip
}
}
else {
Invoke-Test -Name $Name -ScriptBlock $Test @pendingSkip -OutputScriptBlock $OutputScriptBlock
}
}
function Invoke-Test {
[CmdletBinding(DefaultParameterSetName = 'Normal')]
param (
[Parameter(Mandatory = $true)]
[string] $Name,
[Parameter(Mandatory = $true)]
[ScriptBlock] $ScriptBlock,
[scriptblock] $OutputScriptBlock,
[System.Collections.IDictionary] $Parameters,
[string] $ParameterizedSuiteName,
[Parameter(ParameterSetName = 'Pending')]
[Switch] $Pending,
[Parameter(ParameterSetName = 'Skip')]
[Alias('Ignore')]
[Switch] $Skip
)
if ($null -eq $Parameters) {
$Parameters = @{ }
}
try {
if ($Skip) {
$Pester.AddTestResult($Name, "Skipped", $null)
}
elseif ($Pending) {
$Pester.AddTestResult($Name, "Pending", $null)
}
else {
#todo: disabling the progress for now, it adds a lot of overhead and breaks output on linux, we don't have a good way to disable it by default, or to show it after delay see: https://github.com/pester/Pester/issues/846
# & $SafeCommands['Write-Progress'] -Activity "Running test '$Name'" -Status Processing
$errorRecord = $null
try {
$pester.EnterTest()
Invoke-TestCaseSetupBlocks
do {
Write-ScriptBlockInvocationHint -Hint "It" -ScriptBlock $ScriptBlock
$null = & $ScriptBlock @Parameters
} until ($true)
}
catch {
$errorRecord = $_
}
finally {
#guarantee that the teardown action will run and prevent it from failing the whole suite
try {
if (-not ($Skip -or $Pending)) {
Invoke-TestCaseTeardownBlocks
}
}
catch {
$errorRecord = $_
}
$pester.LeaveTest()
}
$result = ConvertTo-PesterResult -Name $Name -ErrorRecord $errorRecord
$orderedParameters = Get-OrderedParameterDictionary -ScriptBlock $ScriptBlock -Dictionary $Parameters
$Pester.AddTestResult( $result.Name, $result.Result, $null, $result.FailureMessage, $result.StackTrace, $ParameterizedSuiteName, $orderedParameters, $result.ErrorRecord )
#todo: disabling progress reporting see above & $SafeCommands['Write-Progress'] -Activity "Running test '$Name'" -Completed -Status Processing
}
}
finally {
Exit-MockScope -ExitTestCaseOnly
}
if ($null -ne $OutputScriptBlock) {
$Pester.testresult[-1] | & $OutputScriptBlock
}
}
function Get-OrderedParameterDictionary {
[OutputType([System.Collections.IDictionary])]
param (
[scriptblock] $ScriptBlock,
[System.Collections.IDictionary] $Dictionary
)
$parameters = Get-ParameterDictionary -ScriptBlock $ScriptBlock
$orderedDictionary = & $SafeCommands['New-Object'] System.Collections.Specialized.OrderedDictionary
foreach ($parameterName in $parameters.Keys) {
$value = $null
if ($Dictionary.ContainsKey($parameterName)) {
$value = $Dictionary[$parameterName]
}
$orderedDictionary[$parameterName] = $value
}
return $orderedDictionary
}
function Get-ParameterDictionary {
param (
[scriptblock] $ScriptBlock
)
$guid = [Guid]::NewGuid().Guid
try {
& $SafeCommands['Set-Content'] function:\$guid $ScriptBlock
$metadata = [System.Management.Automation.CommandMetadata](& $SafeCommands['Get-Command'] -Name $guid -CommandType Function)
return $metadata.Parameters
}
finally {
if (& $SafeCommands['Test-Path'] function:\$guid) {
& $SafeCommands['Remove-Item'] function:\$guid
}
}
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUiJe2aw81vEgh/eBVEk1OxGvc
# smmgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQQDExdEaWdpQ2VydCBUaW1lc3RhbXAgMjAyMTCCASIwDQYJKoZIhvcN
# AQEBBQADggEPAD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IJA1U1/X6nYnlaiNnHSB0FmShcbITHyiX
# WwUCFDWvnQjuFryMbkDkOTwqbWENTIZU6qGp1lR2zs+llAWD8ZcCocUloH0f4e08
# EQmof48HPPYBvlgDan7uIWR6EWFOCzApcHcCFJ0RAzl96hab+y/xpl3HS2cUg62M
# mor0mPId7NoUIfmhkQigImvyjZBHz+W3eBYbO1SCmpSDHxx6jvSbwnTy/9sg4aGC
# AjAwggIsBgkqhkiG9w0BCQYxggIdMIICGQIBATCBhjByMQswCQYDVQQGEwJVUzEV
# MBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29t
# MTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgVGltZXN0YW1waW5n
# IENBAhANQkrgvjqI/2BAIc4UAPDdMA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODA1WjAv
# BgkqhkiG9w0BCQQxIgQgR1U8s9VqeByQjMAyMEBu/3BT8PSvY0RZz+mihD2i0sMw
# DQYJKoZIhvcNAQEBBQAEggEATgooKDuVEpH7OJAwh5hsRHGWkxmhlAOSNMi0lx00
# PZUPCs/uFolc85gVF2gQ9WG+K3B1q72leyFsTTBcITFrWGRkvHca/jtZzMczaYgr
# 3nlJLpPUelPFQIPP8lz/1jiXnqR+LAcari17xadr6AO9YaWqKDwgYzvhWYN8fV1K
# ILr2wvUoBLh1u5M2DWiFcQB009FdRAfUea9RT7W/rG02YRGbeQ0pX3X1vAg1lPyx
# Tjbw/ZkQ2WQeGDnzxfOXNkrJxRHoRr5gfvvRGpKUtmgN3+n8FDMmXyihgMSsh8a1
# BoiSULO790CuNHfSmxuUZNGYt14iwAVIa5URMghCG+TP0w==
# SIG # End signature block
function Mock {
<#
.SYNOPSIS
Mocks the behavior of an existing command with an alternate
implementation.
.DESCRIPTION
This creates new behavior for any existing command within the scope of a
Describe or Context block. The function allows you to specify a script block
that will become the command's new behavior.
Optionally, you may create a Parameter Filter which will examine the
parameters passed to the mocked command and will invoke the mocked
behavior only if the values of the parameter values pass the filter. If
they do not, the original command implementation will be invoked instead
of a mock.
You may create multiple mocks for the same command, each using a different
ParameterFilter. ParameterFilters will be evaluated in reverse order of
their creation. The last one created will be the first to be evaluated.
The mock of the first filter to pass will be used. The exception to this
rule are Mocks with no filters. They will always be evaluated last since
they will act as a "catch all" mock.
Mocks can be marked Verifiable. If so, the Assert-VerifiableMock command
can be used to check if all Verifiable mocks were actually called. If any
verifiable mock is not called, Assert-VerifiableMock will throw an
exception and indicate all mocks not called.
If you wish to mock commands that are called from inside a script module,
you can do so by using the -ModuleName parameter to the Mock command. This
injects the mock into the specified module. If you do not specify a
module name, the mock will be created in the same scope as the test script.
You may mock the same command multiple times, in different scopes, as needed.
Each module's mock maintains a separate call history and verified status.
.PARAMETER CommandName
The name of the command to be mocked.
.PARAMETER MockWith
A ScriptBlock specifying the behavior that will be used to mock CommandName.
The default is an empty ScriptBlock.
NOTE: Do not specify param or dynamicparam blocks in this script block.
These will be injected automatically based on the signature of the command
being mocked, and the MockWith script block can contain references to the
mocked commands parameter variables.
.PARAMETER Verifiable
When this is set, the mock will be checked when Assert-VerifiableMock is
called.
.PARAMETER ParameterFilter
An optional filter to limit mocking behavior only to usages of
CommandName where the values of the parameters passed to the command
pass the filter.
This ScriptBlock must return a boolean value. See examples for usage.
.PARAMETER ModuleName
Optional string specifying the name of the module where this command
is to be mocked. This should be a module that _calls_ the mocked
command; it doesn't necessarily have to be the same module which
originally implemented the command.
.PARAMETER RemoveParameterType
Optional parameter that removes a type of a parameter in the fuction
declaration. This is useful when you are testing a function that has a
strongly typed parameter but you are not able to create an object of the
required type.
This parameter applies only to the first definintion of a mock within the
current scope. If there are multiple mocks with the same name, any subsequent
configuration of parameters will be ingored, including parameter validation
described below.
.PARAMETER RemoveParameterValidation
Optional parameter that removes validation from a parameter in the fuction
declaration. This is useful when you are testing a function that validates
it's input, but you are unable to satisfy the validation.
This parameter applies only to the first definintion of a mock within the
current scope. If there are multiple mocks with the same name, any subsequent
configuration of parameters will be ingored, including parameter types described
above.
.EXAMPLE
Mock Get-ChildItem { return @{FullName = "A_File.TXT"} }
Using this Mock, all calls to Get-ChildItem will return a hashtable with a
FullName property returning "A_File.TXT"
.EXAMPLE
Mock Get-ChildItem { return @{FullName = "A_File.TXT"} } -ParameterFilter { $Path -and $Path.StartsWith($env:temp) }
This Mock will only be applied to Get-ChildItem calls within the user's temp directory.
.EXAMPLE
Mock Set-Content {} -Verifiable -ParameterFilter { $Path -eq "some_path" -and $Value -eq "Expected Value" }
When this mock is used, if the Mock is never invoked and Assert-VerifiableMock is called, an exception will be thrown. The command behavior will do nothing since the ScriptBlock is empty.
.EXAMPLE
```ps
Mock Get-ChildItem { return @{FullName = "A_File.TXT"} } -ParameterFilter { $Path -and $Path.StartsWith($env:temp\1) }
Mock Get-ChildItem { return @{FullName = "B_File.TXT"} } -ParameterFilter { $Path -and $Path.StartsWith($env:temp\2) }
Mock Get-ChildItem { return @{FullName = "C_File.TXT"} } -ParameterFilter { $Path -and $Path.StartsWith($env:temp\3) }
```
Multiple mocks of the same command may be used. The parameter filter determines which is invoked. Here, if Get-ChildItem is called on the "2" directory of the temp folder, then B_File.txt will be returned.
.EXAMPLE
```ps
Mock Get-ChildItem { return @{FullName="B_File.TXT"} } -ParameterFilter { $Path -eq "$env:temp\me" }
Mock Get-ChildItem { return @{FullName="A_File.TXT"} } -ParameterFilter { $Path -and $Path.StartsWith($env:temp) }
Get-ChildItem $env:temp\me
```
Here, both mocks could apply since both filters will pass. A_File.TXT will be returned because it was the most recent Mock created.
.EXAMPLE
```ps
Mock Get-ChildItem { return @{FullName = "B_File.TXT"} } -ParameterFilter { $Path -eq "$env:temp\me" }
Mock Get-ChildItem { return @{FullName = "A_File.TXT"} }
Get-ChildItem c:\windows
```
Here, A_File.TXT will be returned. Since no filter was specified, it will apply to any call to Get-ChildItem that does not pass another filter.
.EXAMPLE
```ps
Mock Get-ChildItem { return @{FullName = "B_File.TXT"} } -ParameterFilter { $Path -eq "$env:temp\me" }
Mock Get-ChildItem { return @{FullName = "A_File.TXT"} }
Get-ChildItem $env:temp\me
```
Here, B_File.TXT will be returned. Even though the filterless mock was created more recently. This illustrates that filterless Mocks are always evaluated last regardless of their creation order.
.EXAMPLE
Mock Get-ChildItem { return @{FullName = "A_File.TXT"} } -ModuleName MyTestModule
Using this Mock, all calls to Get-ChildItem from within the MyTestModule module
will return a hashtable with a FullName property returning "A_File.TXT"
.EXAMPLE
```ps
Get-Module -Name ModuleMockExample | Remove-Module
New-Module -Name ModuleMockExample -ScriptBlock {
function Hidden { "Internal Module Function" }
function Exported { Hidden }
Export-ModuleMember -Function Exported
} | Import-Module -Force
Describe "ModuleMockExample" {
It "Hidden function is not directly accessible outside the module" {
{ Hidden } | Should -Throw
}
It "Original Hidden function is called" {
Exported | Should -Be "Internal Module Function"
}
It "Hidden is replaced with our implementation" {
Mock Hidden { "Mocked" } -ModuleName ModuleMockExample
Exported | Should -Be "Mocked"
}
}
```
This example shows how calls to commands made from inside a module can be
mocked by using the -ModuleName parameter.
.LINK
https://pester.dev/docs/commands/Assert-MockCalled
.LINK
https://pester.dev/docs/commands/Assert-VerifiableMock
.LINK
https://pester.dev/docs/commands/Describe
.LINK
https://pester.dev/docs/commands/Context
.LINK
https://pester.dev/docs/commands/It
.LINK
https://pester.dev/docs/commands/Should
.LINK
https://pester.dev/docs/usage/mocking
#>
[CmdletBinding()]
param(
[string]$CommandName,
[ScriptBlock]$MockWith = { },
[switch]$Verifiable,
[ScriptBlock]$ParameterFilter = { $True },
[string]$ModuleName,
[string[]]$RemoveParameterType,
[string[]]$RemoveParameterValidation
)
Assert-DescribeInProgress -CommandName Mock
Set-ScriptBlockHint -Hint "Unbound MockWith - Captured in Mock" -ScriptBlock $MockWith
Set-ScriptBlockHint -Hint "Unbound ParameterFilter - Captured in Mock" -ScriptBlock $ParameterFilter
$contextInfo = Validate-Command $CommandName $ModuleName
$CommandName = $contextInfo.Command.Name
if ($contextInfo.Session.Module -and $contextInfo.Session.Module.Name) {
$ModuleName = $contextInfo.Session.Module.Name
}
else {
$ModuleName = ''
}
if (Test-IsClosure -ScriptBlock $MockWith) {
# If the user went out of their way to call GetNewClosure(), go ahead and leave the block bound to that
# dynamic module's scope.
$mockWithCopy = $MockWith
}
else {
Write-Hint "Unbinding ScriptBlock from '$(Get-ScriptBlockHint $MockWith)'"
$mockWithCopy = [scriptblock]::Create($MockWith.ToString())
Set-ScriptBlockHint -ScriptBlock $mockWithCopy -Hint "Unbound ScriptBlock from Mock"
Set-ScriptBlockScope -ScriptBlock $mockWithCopy -SessionState $contextInfo.Session
}
$block = @{
Mock = $mockWithCopy
Filter = $ParameterFilter
Verifiable = $Verifiable
Scope = $pester.CurrentTestGroup
}
$mock = $mockTable["$ModuleName||$CommandName"]
if (-not $mock) {
$metadata = $null
$originalMetadata = $null
$cmdletBinding = ''
$paramBlock = ''
$dynamicParamBlock = ''
$dynamicParamScriptBlock = $null
if ($contextInfo.Command.psobject.Properties['ScriptBlock'] -or $contextInfo.Command.CommandType -eq 'Cmdlet') {
$metadata = [System.Management.Automation.CommandMetaData]$contextInfo.Command
$null = $metadata.Parameters.Remove('Verbose')
$null = $metadata.Parameters.Remove('Debug')
$null = $metadata.Parameters.Remove('ErrorAction')
$null = $metadata.Parameters.Remove('WarningAction')
$null = $metadata.Parameters.Remove('ErrorVariable')
$null = $metadata.Parameters.Remove('WarningVariable')
$null = $metadata.Parameters.Remove('OutVariable')
$null = $metadata.Parameters.Remove('OutBuffer')
# Some versions of PowerShell may include dynamic parameters here
# We will filter them out and add them at the end to be
# compatible with both earlier and later versions
$dynamicParams = $metadata.Parameters.Values | & $SafeCommands['Where-Object'] { $_.IsDynamic }
if ($null -ne $dynamicParams) {
$dynamicparams | & $SafeCommands['ForEach-Object'] { $null = $metadata.Parameters.Remove($_.name) }
}
$cmdletBinding = [Management.Automation.ProxyCommand]::GetCmdletBindingAttribute($metadata)
if ($global:PSVersionTable.PSVersion.Major -ge 3 -and $contextInfo.Command.CommandType -eq 'Cmdlet') {
if ($cmdletBinding -ne '[CmdletBinding()]') {
$cmdletBinding = $cmdletBinding.Insert($cmdletBinding.Length - 2, ',')
}
$cmdletBinding = $cmdletBinding.Insert($cmdletBinding.Length - 2, 'PositionalBinding=$false')
}
# Will modify $metadata object in-place
$originalMetadata = $metadata
$metadata = Repair-ConflictingParameters -Metadata $metadata -RemoveParameterType $RemoveParameterType -RemoveParameterValidation $RemoveParameterValidation
$paramBlock = [Management.Automation.ProxyCommand]::GetParamBlock($metadata)
if ($contextInfo.Command.CommandType -eq 'Cmdlet') {
$dynamicParamBlock = "dynamicparam { Get-MockDynamicParameter -CmdletName '$($contextInfo.Command.Name)' -Parameters `$PSBoundParameters }"
}
else {
$dynamicParamStatements = Get-DynamicParamBlock -ScriptBlock $contextInfo.Command.ScriptBlock
if ($dynamicParamStatements -match '\S') {
$metadataSafeForDynamicParams = [System.Management.Automation.CommandMetaData]$contextInfo.Command
foreach ($param in $metadataSafeForDynamicParams.Parameters.Values) {
$param.ParameterSets.Clear()
}
$paramBlockSafeForDynamicParams = [System.Management.Automation.ProxyCommand]::GetParamBlock($metadataSafeForDynamicParams)
$comma = if ($metadataSafeForDynamicParams.Parameters.Count -gt 0) {
','
}
else {
''
}
$dynamicParamBlock = "dynamicparam { Get-MockDynamicParameter -ModuleName '$ModuleName' -FunctionName '$CommandName' -Parameters `$PSBoundParameters -Cmdlet `$PSCmdlet }"
$code = @"
$cmdletBinding
param(
[object] `${P S Cmdlet}$comma
$paramBlockSafeForDynamicParams
)
`$PSCmdlet = `${P S Cmdlet}
$dynamicParamStatements
"@
$dynamicParamScriptBlock = [scriptblock]::Create($code)
$sessionStateInternal = Get-ScriptBlockScope -ScriptBlock $contextInfo.Command.ScriptBlock
if ($null -ne $sessionStateInternal) {
Set-ScriptBlockScope -ScriptBlock $dynamicParamScriptBlock -SessionStateInternal $sessionStateInternal
}
}
}
}
$EscapeSingleQuotedStringContent =
if ($global:PSVersionTable.PSVersion.Major -ge 5) {
{ [System.Management.Automation.Language.CodeGeneration]::EscapeSingleQuotedStringContent($args[0]) }
}
else {
{ $args[0] -replace "['‘’‚‛]", '$&$&' }
}
$newContent = & $SafeCommands['Get-Content'] function:\MockPrototype
$newContent = $newContent -replace '#FUNCTIONNAME#', (& $EscapeSingleQuotedStringContent $CommandName)
$newContent = $newContent -replace '#MODULENAME#', (& $EscapeSingleQuotedStringContent $ModuleName)
$canCaptureArgs = 'true'
if ($contextInfo.Command.CommandType -eq 'Cmdlet' -or
($contextInfo.Command.CommandType -eq 'Function' -and $contextInfo.Command.CmdletBinding)) {
$canCaptureArgs = 'false'
}
$newContent = $newContent -replace '#CANCAPTUREARGS#', $canCaptureArgs
$code = @"
$cmdletBinding
param ( $paramBlock )
$dynamicParamBlock
begin
{
`${mock call state} = @{}
$($newContent -replace '#BLOCK#', 'Begin' -replace '#INPUT#')
}
process
{
$($newContent -replace '#BLOCK#', 'Process' -replace '#INPUT#', '-InputObject @($input)')
}
end
{
$($newContent -replace '#BLOCK#', 'End' -replace '#INPUT#')
}
"@
$mockScript = [scriptblock]::Create($code)
$mock = @{
OriginalCommand = $contextInfo.Command
Blocks = @()
CommandName = $CommandName
SessionState = $contextInfo.Session
Scope = $pester.CurrentTestGroup
PesterState = $pester
Metadata = $metadata
OriginalMetadata = $originalMetadata
CallHistory = @()
DynamicParamScriptBlock = $dynamicParamScriptBlock
Aliases = @()
BootstrapFunctionName = 'PesterMock_' + [Guid]::NewGuid().Guid
}
$mockTable["$ModuleName||$CommandName"] = $mock
Invoke-CommonSetupInMockScope -Mock $mock -MockScript $MockScript -CommandName $CommandName
}
if ($null -ne $mock.Metadata -and $null -ne $block.Filter) {
$block.Filter = New-BlockWithoutParameterAliases -Metadata $mock.Metadata -Block $block.Filter
}
$mock.Blocks = @(
# trim the script to avoid errors when formatting adds spaces around the default
# filter script, this only affects powershell v2, newer powershell trims it
# automatically
$mock.Blocks | & $SafeCommands['Where-Object'] { $_.Filter.ToString().Trim() -eq '$True' }
if ($block.Filter.ToString().Trim() -eq '$True') {
$block
}
$mock.Blocks | & $SafeCommands['Where-Object'] { $_.Filter.ToString().Trim() -ne '$True' }
if ($block.Filter.ToString().Trim() -ne '$True') {
$block
}
)
}
function Assert-VerifiableMock {
<#
.SYNOPSIS
Checks if any Verifiable Mock has not been invoked. If so, this will throw an exception.
.DESCRIPTION
This can be used in tandem with the -Verifiable switch of the Mock
function. Mock can be used to mock the behavior of an existing command
and optionally take a -Verifiable switch. When Assert-VerifiableMock
is called, it checks to see if any Mock marked Verifiable has not been
invoked. If any mocks have been found that specified -Verifiable and
have not been invoked, an exception will be thrown.
.EXAMPLE
```ps
Mock Set-Content {} -Verifiable -ParameterFilter {$Path -eq "some_path" -and $Value -eq "Expected Value"}
{ ...some code that never calls Set-Content some_path -Value "Expected Value"... }
Assert-VerifiableMock
```
This will throw an exception and cause the test to fail.
.EXAMPLE
```ps
Mock Set-Content {} -Verifiable -ParameterFilter {$Path -eq "some_path" -and $Value -eq "Expected Value"}
Set-Content some_path -Value "Expected Value"
Assert-VerifiableMock
```
This will not throw an exception because the mock was invoked.
#>
[CmdletBinding()]param()
Assert-DescribeInProgress -CommandName Assert-VerifiableMock
$unVerified = @{ }
$mockTable.Keys | & $SafeCommands['ForEach-Object'] {
$m = $_;
$mockTable[$m].blocks |
& $SafeCommands['Where-Object'] { $_.Verifiable } |
& $SafeCommands['ForEach-Object'] { $unVerified[$m] = $_ }
}
if ($unVerified.Count -gt 0) {
foreach ($mock in $unVerified.Keys) {
$array = $mock -split '\|\|'
$function = $array[1]
$module = $array[0]
$message = "$([System.Environment]::NewLine) Expected $function "
if ($module) {
$message += "in module $module "
}
$message += "to be called with $($unVerified[$mock].Filter)"
}
throw $message
}
}
function Assert-MockCalled {
<#
.SYNOPSIS
Checks if a Mocked command has been called a certain number of times
and throws an exception if it has not.
.DESCRIPTION
This command verifies that a mocked command has been called a certain number
of times. If the call history of the mocked command does not match the parameters
passed to Assert-MockCalled, Assert-MockCalled will throw an exception.
.PARAMETER CommandName
The mocked command whose call history should be checked.
.PARAMETER ModuleName
The module where the mock being checked was injected. This is optional,
and must match the ModuleName that was used when setting up the Mock.
.PARAMETER Times
The number of times that the mock must be called to avoid an exception
from throwing.
.PARAMETER Exactly
If this switch is present, the number specified in Times must match
exactly the number of times the mock has been called. Otherwise it
must match "at least" the number of times specified. If the value
passed to the Times parameter is zero, the Exactly switch is implied.
.PARAMETER ParameterFilter
An optional filter to qualify which calls should be counted. Only those
calls to the mock whose parameters cause this filter to return true
will be counted.
.PARAMETER ExclusiveFilter
Like ParameterFilter, except when you use ExclusiveFilter, and there
were any calls to the mocked command which do not match the filter,
an exception will be thrown. This is a convenient way to avoid needing
to have two calls to Assert-MockCalled like this:
Assert-MockCalled SomeCommand -Times 1 -ParameterFilter { $something -eq $true }
Assert-MockCalled SomeCommand -Times 0 -ParameterFilter { $something -ne $true }
.PARAMETER Scope
An optional parameter specifying the Pester scope in which to check for
calls to the mocked command. For RSpec style tests, Assert-MockCalled will find
all calls to the mocked command in the current Context block (if present),
or the current Describe block (if there is no active Context), by default. Valid
values are Describe, Context and It. If you use a scope of Describe or
Context, the command will identify all calls to the mocked command in the
current Describe / Context block, as well as all child scopes of that block.
For Gherkin style tests, Assert-MockCalled will find all calls to the mocked
command in the current Scenario block or the current Feature block (if there is
no active Scenario), by default. Valid values for Gherkin style tests are Feature
and Scenario. If you use a scope of Feature or Scenario, the command will identify
all calls to the mocked command in the current Feature / Scenario block, as well
as all child scopes of that block.
.EXAMPLE
```ps
PS C:\> Mock Set-Content {}
{... Some Code ...}
PS C:\> Assert-MockCalled Set-Content
```
This will throw an exception and cause the test to fail if Set-Content is not called in Some Code.
.EXAMPLE
```ps
PS C:\> Mock Set-Content -parameterFilter {$path.StartsWith("$env:temp\")}
{... Some Code ...}
PS C:\> Assert-MockCalled Set-Content 2 { $path -eq "$env:temp\test.txt" }
```
This will throw an exception if some code calls Set-Content on $path=$env:temp\test.txt less than 2 times
.EXAMPLE
```ps
PS C:\> Mock Set-Content {}
{... Some Code ...}
PS C:\> Assert-MockCalled Set-Content 0
```
This will throw an exception if some code calls Set-Content at all
.EXAMPLE
```ps
PS C:\> Mock Set-Content {}
{... Some Code ...}
PS C:\> Assert-MockCalled Set-Content -Exactly 2
```
This will throw an exception if some code does not call Set-Content Exactly two times.
.EXAMPLE
```ps
Describe 'Assert-MockCalled Scope behavior' {
Mock Set-Content { }
It 'Calls Set-Content at least once in the It block' {
{... Some Code ...}
Assert-MockCalled Set-Content -Exactly 0 -Scope It
}
}
```
Checks for calls only within the current It block.
.EXAMPLE
```ps
Describe 'Describe' {
Mock -ModuleName SomeModule Set-Content { }
{... Some Code ...}
It 'Calls Set-Content at least once in the Describe block' {
Assert-MockCalled -ModuleName SomeModule Set-Content
}
}
```
Checks for calls to the mock within the SomeModule module. Note that both the Mock
and Assert-MockCalled commands use the same module name.
.EXAMPLE
Assert-MockCalled Get-ChildItem -ExclusiveFilter { $Path -eq 'C:\' }
Checks to make sure that Get-ChildItem was called at least one time with
the -Path parameter set to 'C:\', and that it was not called at all with
the -Path parameter set to any other value.
.NOTES
The parameter filter passed to Assert-MockCalled does not necessarily have to match the parameter filter
(if any) which was used to create the Mock. Assert-MockCalled will find any entry in the command history
which matches its parameter filter, regardless of how the Mock was created. However, if any calls to the
mocked command are made which did not match any mock's parameter filter (resulting in the original command
being executed instead of a mock), these calls to the original command are not tracked in the call history.
In other words, Assert-MockCalled can only be used to check for calls to the mocked implementation, not
to the original.
#>
[CmdletBinding(DefaultParameterSetName = 'ParameterFilter')]
param(
[Parameter(Mandatory = $true, Position = 0)]
[string]$CommandName,
[Parameter(Position = 1)]
[int]$Times = 1,
[Parameter(ParameterSetName = 'ParameterFilter', Position = 2)]
[ScriptBlock]$ParameterFilter = { $True },
[Parameter(ParameterSetName = 'ExclusiveFilter', Mandatory = $true)]
[scriptblock] $ExclusiveFilter,
[Parameter(Position = 3)]
[string] $ModuleName,
[Parameter(Position = 4)]
[ValidateScript( {
if ([uint32]::TryParse($_, [ref] $null) -or
$_ -eq 'Describe' -or
$_ -eq 'Context' -or
$_ -eq 'It' -or
$_ -eq 'Feature' -or
$_ -eq 'Scenario') {
return $true
}
throw "Scope argument must either be an unsigned integer, or one of the words 'Describe', 'Context', 'It', 'Feature', or 'Scenario'."
})]
[string] $Scope,
[switch]$Exactly
)
if ($PSCmdlet.ParameterSetName -eq 'ParameterFilter') {
$filter = $ParameterFilter
$filterIsExclusive = $false
}
else {
$filter = $ExclusiveFilter
$filterIsExclusive = $true
}
Assert-DescribeInProgress -CommandName Assert-MockCalled
if (-not $PSBoundParameters.ContainsKey('ModuleName') -and $null -ne $pester.SessionState.Module) {
$ModuleName = $pester.SessionState.Module.Name
}
$contextInfo = Validate-Command $CommandName $ModuleName
$CommandName = $contextInfo.Command.Name
$mock = $script:mockTable["$ModuleName||$CommandName"]
$moduleMessage = ''
if ($ModuleName) {
$moduleMessage = " in module $ModuleName"
}
if (-not $mock) {
throw "You did not declare a mock of the $commandName Command${moduleMessage}."
}
if (-not $PSBoundParameters.ContainsKey('Scope')) {
$scope = 1
}
$matchingCalls = & $SafeCommands['New-Object'] System.Collections.ArrayList
$nonMatchingCalls = & $SafeCommands['New-Object'] System.Collections.ArrayList
foreach ($historyEntry in $mock.CallHistory) {
if (-not (Test-MockCallScope -CallScope $historyEntry.Scope -DesiredScope $Scope)) {
continue
}
$params = @{
ScriptBlock = $filter
BoundParameters = $historyEntry.BoundParams
ArgumentList = $historyEntry.Args
Metadata = $mock.Metadata
}
if ($null -ne $mock.Metadata -and $null -ne $params.ScriptBlock) {
$params.ScriptBlock = New-BlockWithoutParameterAliases -Metadata $mock.Metadata -Block $params.ScriptBlock
}
if (Test-ParameterFilter @params) {
$null = $matchingCalls.Add($historyEntry)
}
else {
$null = $nonMatchingCalls.Add($historyEntry)
}
}
$lineText = $MyInvocation.Line.TrimEnd("$([System.Environment]::NewLine)")
$line = $MyInvocation.ScriptLineNumber
if ($matchingCalls.Count -ne $times -and ($Exactly -or ($times -eq 0))) {
$failureMessage = "Expected ${commandName}${moduleMessage} to be called $times times exactly but was called $($matchingCalls.Count) times"
throw ( New-ShouldErrorRecord -Message $failureMessage -Line $line -LineText $lineText)
}
elseif ($matchingCalls.Count -lt $times) {
$failureMessage = "Expected ${commandName}${moduleMessage} to be called at least $times times but was called $($matchingCalls.Count) times"
throw ( New-ShouldErrorRecord -Message $failureMessage -Line $line -LineText $lineText)
}
elseif ($filterIsExclusive -and $nonMatchingCalls.Count -gt 0) {
$failureMessage = "Expected ${commandName}${moduleMessage} to only be called with with parameters matching the specified filter, but $($nonMatchingCalls.Count) non-matching calls were made"
throw ( New-ShouldErrorRecord -Message $failureMessage -Line $line -LineText $lineText)
}
}
function Test-MockCallScope {
[CmdletBinding()]
param (
[object] $CallScope,
[string] $DesiredScope
)
if ($null -eq $CallScope) {
# This indicates a call from the current test case ("It" block), which always passes Test-MockCallScope
return $true
}
$testGroups = $pester.TestGroups
[Array]::Reverse($testGroups)
$target = 0
$isNumberedScope = [int]::TryParse($DesiredScope, [ref] $target)
# The Describe / Context stuff here is for backward compatibility. May be deprecated / removed in the future.
$actualScopeNumber = -1
$describe = -1
$context = -1
for ($i = 0; $i -lt $testGroups.Count; $i++) {
if ($CallScope -eq $testGroups[$i]) {
$actualScopeNumber = $i
if ($isNumberedScope) {
break
}
}
if ($describe -lt 0 -and 'Describe', 'Feature' -contains $testGroups[$i].Hint) {
$describe = $i
}
if ($context -lt 0 -and 'Context', 'Scenario' -contains $testGroups[$i].Hint) {
$context = $i
}
}
if ($actualScopeNumber -lt 0) {
# this should never happen; if we get here, it's a Pester bug.
throw "Pester error: Corrupted mock call history table."
}
if ($isNumberedScope) {
# For this, we consider scope 0 to be the current test case / It block, scope 1 to be the first Test Group up the stack, etc.
# $actualScopeNumber currently off by one from that scale (zero-indexed for test groups only; we already checked for the 0 case
# farther up, which only applies if $CallScope is $null).
return $target -gt $actualScopeNumber
}
else {
if ('Describe', 'Feature' -contains $DesiredScope) {
return $describe -ge $actualScopeNumber
}
if ('Context', 'Scenario' -contains $DesiredScope) {
return $context -ge $actualScopeNumber
}
}
return $false
}
function Exit-MockScope {
param (
[switch] $ExitTestCaseOnly
)
if ($null -eq $mockTable) {
return
}
$removeMockStub =
{
param (
[string] $CommandName,
[string[]] $Aliases
)
if ($ExecutionContext.InvokeProvider.Item.Exists("Function:\$CommandName", $true, $true)) {
$ExecutionContext.InvokeProvider.Item.Remove("Function:\$CommandName", $false, $true, $true)
}
foreach ($alias in $Aliases) {
if ($ExecutionContext.InvokeProvider.Item.Exists("Alias:$alias", $true, $true)) {
$ExecutionContext.InvokeProvider.Item.Remove("Alias:$alias", $false, $true, $true)
}
}
}
$mockKeys = [string[]]$mockTable.Keys
foreach ($mockKey in $mockKeys) {
$mock = $mockTable[$mockKey]
$shouldRemoveMock = (-not $ExitTestCaseOnly) -and (ShouldRemoveMock -Mock $mock -ActivePesterState $pester)
if ($shouldRemoveMock) {
$null = Invoke-InMockScope -SessionState $mock.SessionState -ScriptBlock $removeMockStub -ArgumentList $mock.BootstrapFunctionName, $mock.Aliases
$mockTable.Remove($mockKey)
}
elseif ($mock.PesterState -eq $pester) {
if (-not $ExitTestCaseOnly) {
$mock.Blocks = @($mock.Blocks | & $SafeCommands['Where-Object'] { $_.Scope -ne $pester.CurrentTestGroup })
}
$testGroups = @($pester.TestGroups)
$parentTestGroup = $null
if ($testGroups.Count -gt 1) {
$parentTestGroup = $testGroups[-2]
}
foreach ($historyEntry in $mock.CallHistory) {
if ($ExitTestCaseOnly) {
if ($null -eq $historyEntry.Scope) {
$historyEntry.Scope = $pester.CurrentTestGroup
}
}
elseif ($parentTestGroup) {
if ($historyEntry.Scope -eq $pester.CurrentTestGroup) {
$historyEntry.Scope = $parentTestGroup
}
}
}
}
}
}
function ShouldRemoveMock($Mock, $ActivePesterState) {
if ($ActivePesterState -ne $mock.PesterState) {
return $false
}
if ($mock.Scope -eq $ActivePesterState.CurrentTestGroup) {
return $true
}
# These two should conditions should _probably_ never happen, because the above condition should
# catch it, but just in case:
if ($ActivePesterState.TestGroups.Count -eq 1) {
return $true
}
if ($ActivePesterState.TestGroups[-2].Hint -eq 'Root') {
return $true
}
return $false
}
function Validate-Command([string]$CommandName, [string]$ModuleName) {
$module = $null
$command = $null
$scriptBlock = {
$command = $ExecutionContext.InvokeCommand.GetCommand($args[0], 'All')
while ($null -ne $command -and $command.CommandType -eq [System.Management.Automation.CommandTypes]::Alias) {
$command = $command.ResolvedCommand
}
return $command
}
if ($ModuleName) {
$module = Get-ScriptModule -ModuleName $ModuleName -ErrorAction Stop
$command = & $module $scriptBlock $CommandName
}
$session = $pester.SessionState
if (-not $command) {
Set-ScriptBlockScope -ScriptBlock $scriptBlock -SessionState $session
$command = & $scriptBlock $commandName
}
if (-not $command) {
throw ([System.Management.Automation.CommandNotFoundException] "Could not find Command $commandName")
}
if ($module) {
$session = Set-SessionStateHint -PassThru -Hint "Module - $($module.Name)" -SessionState ( & $module { $ExecutionContext.SessionState } )
}
$hash = @{Command = $command; Session = $session }
if ($command.CommandType -eq 'Function') {
foreach ($mock in $mockTable.Values) {
if ($command.Name -eq $mock.BootstrapFunctionName) {
return @{
Command = $mock.OriginalCommand
Session = $mock.SessionState
}
}
}
}
return $hash
}
function MockPrototype {
if ($PSVersionTable.PSVersion.Major -ge 3) {
[string] ${ignore preference} = 'Ignore'
}
else {
[string] ${ignore preference} = 'SilentlyContinue'
}
#todo: remove pester\safegetcommand and use .net calls to get the variable instead?
${get Variable Command} = & (Pester\SafeGetCommand) -Name Get-Variable -Module Microsoft.PowerShell.Utility -CommandType Cmdlet
[object] ${a r g s} = $null
if (${#CANCAPTUREARGS#}) {
${a r g s} = & ${get Variable Command} -Name args -ValueOnly -Scope Local -ErrorAction ${ignore preference}
}
if ($null -eq ${a r g s}) {
${a r g s} = @()
}
${p s cmdlet} = & ${get Variable Command} -Name PSCmdlet -ValueOnly -Scope Local -ErrorAction ${ignore preference}
#todo: Add session state hint - once we are calling this in the Pester state
${session state} = if (${p s cmdlet}) {
${p s cmdlet}.SessionState
}
# todo: lookup Pester state and invoke it in there to remote Invoke-Mock from the public Api
# @{mock call state} initialization is injected only into the begin block by the code that uses this prototype.
Invoke-Mock -CommandName '#FUNCTIONNAME#' -ModuleName '#MODULENAME#' -BoundParameters $PSBoundParameters -ArgumentList ${a r g s} -CallerSessionState ${session state} -FromBlock '#BLOCK#' -MockCallState ${mock call state} #INPUT#
}
function Invoke-Mock {
<#
.SYNOPSIS
This command is used by Pester's Mocking framework. You do not need to call it directly.
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string]
$CommandName,
[Parameter(Mandatory = $true)]
[hashtable] $MockCallState,
[string]
$ModuleName,
[hashtable]
$BoundParameters = @{ },
[object[]]
$ArgumentList = @(),
[object] $CallerSessionState,
[ValidateSet('Begin', 'Process', 'End')]
[string] $FromBlock,
[object] $InputObject
)
$detectedModule = $ModuleName
$mock = FindMock -CommandName $CommandName -ModuleName ([ref]$detectedModule)
if ($null -eq $mock) {
# If this ever happens, it's a bug in Pester. The scriptBlock that calls Invoke-Mock should be removed at the same time as the entry in the mock table.
throw "Internal error detected: Mock for '$CommandName' in module '$ModuleName' was called, but does not exist in the mock table."
}
switch ($FromBlock) {
Begin {
$MockCallState['InputObjects'] = & $SafeCommands['New-Object'] System.Collections.ArrayList
$MockCallState['ShouldExecuteOriginalCommand'] = $false
$MockCallState['BeginBoundParameters'] = $BoundParameters.Clone()
$MockCallState['BeginArgumentList'] = $ArgumentList
return
}
Process {
$block = $null
if ($detectedModule -eq $ModuleName) {
$block = FindMatchingBlock -Mock $mock -BoundParameters $BoundParameters -ArgumentList $ArgumentList
}
if ($null -ne $block) {
ExecuteBlock -Block $block `
-CommandName $CommandName `
-ModuleName $ModuleName `
-BoundParameters $BoundParameters `
-ArgumentList $ArgumentList `
-Mock $mock
return
}
else {
$MockCallState['ShouldExecuteOriginalCommand'] = $true
if ($null -ne $InputObject) {
$null = $MockCallState['InputObjects'].AddRange(@($InputObject))
}
return
}
}
End {
if ($MockCallState['ShouldExecuteOriginalCommand']) {
$MockCallState['BeginBoundParameters'] = Reset-ConflictingParameters -BoundParameters $MockCallState['BeginBoundParameters']
if ($MockCallState['InputObjects'].Count -gt 0) {
$scriptBlock = {
param ($Command, $ArgumentList, $BoundParameters, $InputObjects)
$InputObjects | & $Command @ArgumentList @BoundParameters
}
}
else {
$scriptBlock = {
param ($Command, $ArgumentList, $BoundParameters, $InputObjects)
& $Command @ArgumentList @BoundParameters
}
}
$state = if ($CallerSessionState) {
$CallerSessionState
}
else {
$mock.SessionState
}
Set-ScriptBlockScope -ScriptBlock $scriptBlock -SessionState $state
# In order to mock Set-Variable correctly we need to write the variable
# two scopes above
if ( $mock.OriginalCommand -like "Set-Variable" ) {
if ($MockCallState['BeginBoundParameters'].Keys -notcontains "Scope") {
$MockCallState['BeginBoundParameters'].Add( "Scope", 2)
}
# local is the same as scope 0, in that case we also write to scope 2
elseif ("Local", "0" -contains $MockCallState['BeginBoundParameters'].Scope) {
$MockCallState['BeginBoundParameters'].Scope = 2
}
elseif ($MockCallState['BeginBoundParameters'].Scope -match "\d+") {
$MockCallState['BeginBoundParameters'].Scope = 2 + $matches[0]
}
else {
# not sure what the user did, but we won't change it
}
}
Write-ScriptBlockInvocationHint -Hint "Mock - Original Command" -ScriptBlock $scriptBlock
& $scriptBlock -Command $mock.OriginalCommand `
-ArgumentList $MockCallState['BeginArgumentList'] `
-BoundParameters $MockCallState['BeginBoundParameters'] `
-InputObjects $MockCallState['InputObjects']
}
}
}
}
function FindMock {
param (
[string] $CommandName,
[ref] $ModuleName
)
$mock = $mockTable["$($ModuleName.Value)||$CommandName"]
if ($null -eq $mock) {
$mock = $mockTable["||$CommandName"]
if ($null -ne $mock) {
$ModuleName.Value = ''
}
}
return $mock
}
function FindMatchingBlock {
param (
[object] $Mock,
[hashtable] $BoundParameters = @{ },
[object[]] $ArgumentList = @()
)
for ($idx = $mock.Blocks.Length; $idx -gt 0; $idx--) {
$block = $mock.Blocks[$idx - 1]
$params = @{
ScriptBlock = $block.Filter
BoundParameters = $BoundParameters
ArgumentList = $ArgumentList
Metadata = $mock.Metadata
}
if (Test-ParameterFilter @params) {
return $block
}
}
return $null
}
function ExecuteBlock {
param (
[object] $Block,
[object] $Mock,
[string] $CommandName,
[string] $ModuleName,
[hashtable] $BoundParameters = @{ },
[object[]] $ArgumentList = @()
)
$Block.Verifiable = $false
$scope = if ($pester.InTest) {
$null
}
else {
$pester.CurrentTestGroup
}
$Mock.CallHistory += @{CommandName = "$ModuleName||$CommandName"; BoundParams = $BoundParameters; Args = $ArgumentList; Scope = $scope }
$scriptBlock = {
param (
[Parameter(Mandatory = $true)]
[scriptblock]
${Script Block},
[hashtable]
$___BoundParameters___ = @{ },
[object[]]
$___ArgumentList___ = @(),
[System.Management.Automation.CommandMetadata]
${Meta data},
[System.Management.Automation.SessionState]
${Session State},
${R e p o r t S c o p e},
${M o d u l e N a m e}
)
# This script block exists to hold variables without polluting the test script's current scope.
# Dynamic parameters in functions, for some reason, only exist in $PSBoundParameters instead
# of being assigned a local variable the way static parameters do. By calling Set-DynamicParameterVariable,
# we create these variables for the caller's use in a Parameter Filter or within the mock itself, and
# by doing it inside this temporary script block, those variables don't stick around longer than they
# should.
Set-DynamicParameterVariable -SessionState ${Session State} -Parameters $___BoundParameters___ -Metadata ${Meta data}
# Name property is not present on Application Command metadata in PowerShell 2
& ${R e p o r t S c o p e} -ModuleName ${M o d u l e N a m e} -CommandName $(try {
${Meta data}.Name
}
catch {
}) -ScriptBlock ${Script Block}
& ${Script Block} @___BoundParameters___ @___ArgumentList___
}
Set-ScriptBlockScope -ScriptBlock $scriptBlock -SessionState $mock.SessionState
$splat = @{
'Script Block' = $block.Mock
'___ArgumentList___' = $ArgumentList
'___BoundParameters___' = $BoundParameters
'Meta data' = $mock.Metadata
'Session State' = $mock.SessionState
'R e p o r t S c o p e' = { param ($CommandName, $ModuleName, $ScriptBlock)
Write-ScriptBlockInvocationHint -Hint "Mock - of command $CommandName$(if ($ModuleName) { "from module $ModuleName"})" -ScriptBlock $ScriptBlock }
}
# the real scriptblock is passed to the other one, we are interested in the mock, not the wrapper, so I pass $block.Mock, and not $scriptBlock
Write-ScriptBlockInvocationHint -Hint "Mock - of command $CommandName$(if ($ModuleName) { "from module $ModuleName"})" -ScriptBlock ($block.Mock)
& $scriptBlock @splat
}
function Invoke-InMockScope {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[System.Management.Automation.SessionState]
$SessionState,
[Parameter(Mandatory = $true)]
[scriptblock]
$ScriptBlock,
[Parameter(ValueFromRemainingArguments = $true)]
[object[]]
$ArgumentList = @()
)
if ($SessionState.Module) {
$SessionState.Module.Invoke($ScriptBlock, $ArgumentList)
}
else {
Set-ScriptBlockScope -ScriptBlock $ScriptBlock -SessionState $SessionState
Write-ScriptBlockInvocationHint -Hint "Mock - InMockScope" -ScriptBlock $ScriptBlock
& $ScriptBlock @ArgumentList
}
}
function Test-ParameterFilter {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[scriptblock]
$ScriptBlock,
[System.Collections.IDictionary]
$BoundParameters,
[object[]]
$ArgumentList,
[System.Management.Automation.CommandMetadata]
$Metadata
)
if ($null -eq $BoundParameters) {
$BoundParameters = @{ }
}
if ($null -eq $ArgumentList) {
$ArgumentList = @()
}
$paramBlock = Get-ParamBlockFromBoundParameters -BoundParameters $BoundParameters -Metadata $Metadata
$scriptBlockString = "
$paramBlock
Set-StrictMode -Off
$ScriptBlock
"
Write-Hint "Unbinding ScriptBlock from '$(Get-ScriptBlockHint $ScriptBlock)'"
$cmd = [scriptblock]::Create($scriptBlockString)
Set-ScriptBlockHint -ScriptBlock $cmd -Hint "Unbound ScriptBlock from Test-ParameterFilter"
Set-ScriptBlockScope -ScriptBlock $cmd -SessionState $pester.SessionState
Write-ScriptBlockInvocationHint -Hint "Mock - Parameter filter" -ScriptBlock $cmd
& $cmd @BoundParameters @ArgumentList
}
function Get-ParamBlockFromBoundParameters {
param (
[System.Collections.IDictionary] $BoundParameters,
[System.Management.Automation.CommandMetadata] $Metadata
)
$params = foreach ($paramName in $BoundParameters.get_Keys()) {
if (IsCommonParameter -Name $paramName -Metadata $Metadata) {
continue
}
"`${$paramName}"
}
$params = $params -join ','
if ($null -ne $Metadata) {
$cmdletBinding = [System.Management.Automation.ProxyCommand]::GetCmdletBindingAttribute($Metadata)
}
else {
$cmdletBinding = ''
}
return "$cmdletBinding param ($params)"
}
function IsCommonParameter {
param (
[string] $Name,
[System.Management.Automation.CommandMetadata] $Metadata
)
if ($null -ne $Metadata) {
if ([System.Management.Automation.Internal.CommonParameters].GetProperty($Name)) {
return $true
}
if ($Metadata.SupportsShouldProcess -and [System.Management.Automation.Internal.ShouldProcessParameters].GetProperty($Name)) {
return $true
}
if ($PSVersionTable.PSVersion.Major -ge 3 -and $Metadata.SupportsPaging -and [System.Management.Automation.PagingParameters].GetProperty($Name)) {
return $true
}
if ($Metadata.SupportsTransactions -and [System.Management.Automation.Internal.TransactionParameters].GetProperty($Name)) {
return $true
}
}
return $false
}
function Set-DynamicParameterVariable {
<#
.SYNOPSIS
This command is used by Pester's Mocking framework. You do not need to call it directly.
#>
param (
[Parameter(Mandatory = $true)]
[System.Management.Automation.SessionState]
$SessionState,
[hashtable]
$Parameters,
[System.Management.Automation.CommandMetadata]
$Metadata
)
if ($null -eq $Parameters) {
$Parameters = @{ }
}
foreach ($keyValuePair in $Parameters.GetEnumerator()) {
$variableName = $keyValuePair.Key
if (-not (IsCommonParameter -Name $variableName -Metadata $Metadata)) {
if ($ExecutionContext.SessionState -eq $SessionState) {
& $SafeCommands['Set-Variable'] -Scope 1 -Name $variableName -Value $keyValuePair.Value -Force -Confirm:$false -WhatIf:$false
}
else {
$SessionState.PSVariable.Set($variableName, $keyValuePair.Value)
}
}
}
}
function Get-DynamicParamBlock {
param (
[scriptblock] $ScriptBlock
)
if ($PSVersionTable.PSVersion.Major -le 2) {
$flags = [System.Reflection.BindingFlags]'Instance, NonPublic'
$dynamicParams = [scriptblock].GetField('_dynamicParams', $flags).GetValue($ScriptBlock)
if ($null -ne $dynamicParams) {
return $dynamicParams.ToString()
}
}
else {
If ( $ScriptBlock.AST.psobject.Properties.Name -match "Body") {
if ($null -ne $ScriptBlock.Ast.Body.DynamicParamBlock) {
$statements = $ScriptBlock.Ast.Body.DynamicParamBlock.Statements |
& $SafeCommands['Select-Object'] -ExpandProperty Extent |
& $SafeCommands['Select-Object'] -ExpandProperty Text
return $statements -join "$([System.Environment]::NewLine)"
}
}
}
}
function Get-MockDynamicParameter {
<#
.SYNOPSIS
This command is used by Pester's Mocking framework. You do not need to call it directly.
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $true, ParameterSetName = 'Cmdlet')]
[string] $CmdletName,
[Parameter(Mandatory = $true, ParameterSetName = 'Function')]
[string] $FunctionName,
[Parameter(ParameterSetName = 'Function')]
[string] $ModuleName,
[System.Collections.IDictionary] $Parameters,
[object] $Cmdlet
)
switch ($PSCmdlet.ParameterSetName) {
'Cmdlet' {
Get-DynamicParametersForCmdlet -CmdletName $CmdletName -Parameters $Parameters
}
'Function' {
Get-DynamicParametersForMockedFunction -FunctionName $FunctionName -ModuleName $ModuleName -Parameters $Parameters -Cmdlet $Cmdlet
}
}
}
function Get-DynamicParametersForCmdlet {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string] $CmdletName,
[ValidateScript( {
if ($PSVersionTable.PSVersion.Major -ge 3 -and
$null -ne $_ -and
$_.GetType().FullName -ne 'System.Management.Automation.PSBoundParametersDictionary') {
throw 'The -Parameters argument must be a PSBoundParametersDictionary object ($PSBoundParameters).'
}
return $true
})]
[System.Collections.IDictionary] $Parameters
)
try {
$command = & $SafeCommands['Get-Command'] -Name $CmdletName -CommandType Cmdlet -ErrorAction Stop
if (@($command).Count -gt 1) {
throw "Name '$CmdletName' resolved to multiple Cmdlets"
}
}
catch {
$PSCmdlet.ThrowTerminatingError($_)
}
if ($null -eq $command.ImplementingType.GetInterface('IDynamicParameters', $true)) {
return
}
if ('5.0.10586.122' -lt $PSVersionTable.PSVersion) {
# Older version of PS required Reflection to do this. It has run into problems on occasion with certain cmdlets,
# such as ActiveDirectory and AzureRM, so we'll take advantage of the newer PSv5 engine features if at all possible.
if ($null -eq $Parameters) {
$paramsArg = @()
}
else {
$paramsArg = @($Parameters)
}
$command = $ExecutionContext.InvokeCommand.GetCommand($CmdletName, [System.Management.Automation.CommandTypes]::Cmdlet, $paramsArg)
$paramDictionary = [System.Management.Automation.RuntimeDefinedParameterDictionary]::new()
foreach ($param in $command.Parameters.Values) {
if (-not $param.IsDynamic) {
continue
}
if ($Parameters.ContainsKey($param.Name)) {
continue
}
$dynParam = [System.Management.Automation.RuntimeDefinedParameter]::new($param.Name, $param.ParameterType, $param.Attributes)
$paramDictionary.Add($param.Name, $dynParam)
}
return $paramDictionary
}
else {
if ($null -eq $Parameters) {
$Parameters = @{ }
}
$cmdlet = & $SafeCommands['New-Object'] $command.ImplementingType.FullName
$flags = [System.Reflection.BindingFlags]'Instance, Nonpublic'
$context = $ExecutionContext.GetType().GetField('_context', $flags).GetValue($ExecutionContext)
[System.Management.Automation.Cmdlet].GetProperty('Context', $flags).SetValue($cmdlet, $context, $null)
foreach ($keyValuePair in $Parameters.GetEnumerator()) {
$property = $cmdlet.GetType().GetProperty($keyValuePair.Key)
if ($null -eq $property -or -not $property.CanWrite) {
continue
}
$isParameter = [bool]($property.GetCustomAttributes([System.Management.Automation.ParameterAttribute], $true))
if (-not $isParameter) {
continue
}
$property.SetValue($cmdlet, $keyValuePair.Value, $null)
}
try {
# This unary comma is important in some cases. On Windows 7 systems, the ActiveDirectory module cmdlets
# return objects from this method which implement IEnumerable for some reason, and even cause PowerShell
# to throw an exception when it tries to cast the object to that interface.
# We avoid that problem by wrapping the result of GetDynamicParameters() in a one-element array with the
# unary comma. PowerShell enumerates that array instead of trying to enumerate the goofy object, and
# everyone's happy.
# Love the comma. Don't delete it. We don't have a test for this yet, unless we can get the AD module
# on a Server 2008 R2 build server, or until we write some C# code to reproduce its goofy behavior.
, $cmdlet.GetDynamicParameters()
}
catch [System.NotImplementedException] {
# Some cmdlets implement IDynamicParameters but then throw a NotImplementedException. I have no idea why. Ignore them.
}
}
}
function Get-DynamicParametersForMockedFunction {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string]
$FunctionName,
[string]
$ModuleName,
[System.Collections.IDictionary]
$Parameters,
[object]
$Cmdlet
)
$mock = $mockTable["$ModuleName||$FunctionName"]
if (-not $mock) {
throw "Internal error detected: Mock for '$FunctionName' in module '$ModuleName' was called, but does not exist in the mock table."
}
if ($mock.DynamicParamScriptBlock) {
$splat = @{ 'P S Cmdlet' = $Cmdlet }
return & $mock.DynamicParamScriptBlock @Parameters @splat
}
}
function Test-IsClosure {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[scriptblock]
$ScriptBlock
)
$sessionStateInternal = Get-ScriptBlockScope -ScriptBlock $ScriptBlock
if ($null -eq $sessionStateInternal) {
return $false
}
$flags = [System.Reflection.BindingFlags]'Instance,NonPublic'
$module = $sessionStateInternal.GetType().GetProperty('Module', $flags).GetValue($sessionStateInternal, $null)
return (
$null -ne $module -and
$module.Name -match '^__DynamicModule_([a-f\d-]+)$' -and
$null -ne ($matches[1] -as [guid])
)
}
function Remove-MockFunctionsAndAliases {
# when a test is terminated (e.g. by stopping at a breakpoint and then stoping the execution of the script)
# the aliases and bootstrap functions for the currently mocked functions will remain in place
# Then on subsequent runs the bootstrap function will be picked up instead of the real command,
# because there is still an alias associated with it, and the test will fail.
# So before putting Pester state in place we should make sure that all Pester mocks are gone
# by deleting every alias pointing to a function that starts with PesterMock_. Then we also delete the
# bootstrap function.
foreach ($alias in (& $script:SafeCommands['Get-Alias'] -Definition "PesterMock_*")) {
& $script:SafeCommands['Remove-Item'] "alias:/$($alias.Name)"
}
foreach ($bootstrapFunction in (& $script:SafeCommands['Get-Command'] -Name "PesterMock_*")) {
& $script:SafeCommands['Remove-Item'] "function:/$($bootstrapFunction.Name)"
}
}
function Repair-ConflictingParameters {
[CmdletBinding()]
[OutputType([System.Management.Automation.CommandMetadata])]
param(
[Parameter(Mandatory = $true)]
[System.Management.Automation.CommandMetadata]
$Metadata,
[Parameter()]
[string[]]
$RemoveParameterType,
[Parameter()]
[string[]]
$RemoveParameterValidation
)
$repairedMetadata = New-Object System.Management.Automation.CommandMetadata -ArgumentList $Metadata
$paramMetadatas = @()
$paramMetadatas += $repairedMetadata.Parameters.Values
$conflictingParams = Get-ConflictingParameterNames
foreach ($paramMetadata in $paramMetadatas) {
if ($paramMetadata.IsDynamic) {
continue
}
if ($conflictingParams -contains $paramMetadata.Name) {
$paramName = $paramMetadata.Name
$newName = "_$paramName"
$paramMetadata.Name = $newName
$paramMetadata.Aliases.Add($paramName)
$null = $repairedMetadata.Parameters.Remove($paramName)
$repairedMetadata.Parameters.Add($newName, $paramMetadata)
}
$attrIndexesToRemove = New-Object System.Collections.ArrayList
if ($RemoveParameterType -contains $paramMetadata.Name) {
$paramMetadata.ParameterType = [object]
for ($i = 0; $i -lt $paramMetadata.Attributes.Count; $i++) {
$attr = $paramMetadata.Attributes[$i]
if ($attr -is [PSTypeNameAttribute]) {
$null = $attrIndexesToRemove.Add($i)
break
}
}
}
if ($RemoveParameterValidation -contains $paramMetadata.Name) {
for ($i = 0; $i -lt $paramMetadata.Attributes.Count; $i++) {
$attr = $paramMetadata.Attributes[$i]
if ($attr -is [System.Management.Automation.ValidateArgumentsAttribute]) {
$null = $attrIndexesToRemove.Add($i)
}
}
}
foreach ($index in $attrIndexesToRemove) {
$null = $paramMetadata.Attributes.RemoveAt($index)
}
}
$repairedMetadata
}
function Reset-ConflictingParameters {
[CmdletBinding()]
[OutputType([hashtable])]
param(
[Parameter(Mandatory = $true)]
[hashtable]
$BoundParameters
)
$parameters = $BoundParameters.Clone()
$names = Get-ConflictingParameterNames
foreach ($param in $names) {
$fixedName = "_$param"
if (-not $parameters.ContainsKey($fixedName)) {
continue
}
$parameters[$param] = $parameters[$fixedName]
$null = $parameters.Remove($fixedName)
}
$parameters
}
function Get-ConflictingParameterNames {
$script:ConflictingParameterNames
}
function Initialize-ConflictingParameterNames {
foreach ($var in (& $script:SafeCommands['Get-Variable'])) {
if (($var.Options -band [System.Management.Automation.ScopedItemOptions]::Constant) -or ($var.Options -band [System.Management.Automation.ScopedItemOptions]::ReadOnly)) {
$var.Name
}
}
}
function Get-ScriptBlockAST {
param (
[scriptblock]
$ScriptBlock
)
if ($ScriptBlock.Ast -is [System.Management.Automation.Language.ScriptBlockAst]) {
$ast = $Block.Ast.EndBlock
}
elseif ($ScriptBlock.Ast -is [System.Management.Automation.Language.FunctionDefinitionAst]) {
$ast = $Block.Ast.Body.EndBlock
}
else {
throw "Pester failed to parse ParameterFilter, scriptblock is invalid type. Please reformat your ParameterFilter."
}
return $ast
}
function New-BlockWithoutParameterAliases {
[CmdletBinding()]
[OutputType([scriptblock])]
param(
[Parameter(Mandatory = $true)]
[ValidateNotNull()]
[System.Management.Automation.CommandMetadata]
$Metadata,
[Parameter(Mandatory = $true)]
[ValidateNotNull()]
[scriptblock]
$Block
)
try {
if ($PSVersionTable.PSVersion.Major -ge 3) {
$params = $Metadata.Parameters.Values
$ast = Get-ScriptBlockAST $Block
$blockText = $ast.Extent.Text
$variables = [array]($Ast.FindAll( { param($ast) $ast -is [System.Management.Automation.Language.VariableExpressionAst] }, $true))
[array]::Reverse($variables)
foreach ($var in $variables) {
$varName = $var.VariablePath.UserPath
$length = $varName.Length
foreach ($param in $params) {
if ($param.Aliases -contains $varName) {
$startIndex = $var.Extent.StartOffset - $ast.Extent.StartOffset + 1 # move one position after the dollar sign
$blockText = $blockText.Remove($startIndex, $length).Insert($startIndex, $param.Name)
break # It is safe to stop checking for further params here, since aliases cannot be shared by parameters
}
}
}
$Block = [scriptblock]::Create($blockText)
}
$Block
}
catch {
$PSCmdlet.ThrowTerminatingError($_)
}
}
function Invoke-CommonSetupInMockScope {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[ValidateNotNull()]
[hashtable]
$Mock,
[Parameter(Mandatory = $true)]
[ValidateNotNull()]
[scriptblock]
$MockScript,
[Parameter(Mandatory = $true)]
[ValidateNotNull()]
[string]
$CommandName
)
try {
$scriptBlock = { $ExecutionContext.InvokeProvider.Item.Set("Function:\script:$($args[0])", $args[1], $true, $true) }
$null = Invoke-InMockScope -SessionState $Mock.SessionState -ScriptBlock $scriptBlock -ArgumentList $Mock.BootstrapFunctionName, $MockScript
$mock.Aliases += $CommandName
$scriptBlock = {
$setAlias = & (Pester\SafeGetCommand) -Name Set-Alias -CommandType Cmdlet -Module Microsoft.PowerShell.Utility
& $setAlias -Name $args[0] -Value $args[1] -Scope Script
}
$null = Invoke-InMockScope -SessionState $Mock.SessionState -ScriptBlock $scriptBlock -ArgumentList $CommandName, $Mock.BootstrapFunctionName
if ($Mock.OriginalCommand.ModuleName) {
$aliasName = "$($Mock.OriginalCommand.ModuleName)\$($CommandName)"
$Mock.Aliases += $aliasName
$scriptBlock = {
$setAlias = & (Pester\SafeGetCommand) -Name Set-Alias -CommandType Cmdlet -Module Microsoft.PowerShell.Utility
& $setAlias -Name $args[0] -Value $args[1] -Scope Script
}
$null = Invoke-InMockScope -SessionState $Mock.SessionState -ScriptBlock $scriptBlock -ArgumentList $aliasName, $Mock.BootstrapFunctionName
}
if ($Mock.OriginalCommand.CommandType -eq 'Application') {
$aliasWithoutExt = $CommandName -replace $Mock.OriginalCommand.Extension
$Mock.Aliases += $aliasWithoutExt
$scriptBlock = {
$setAlias = & (Pester\SafeGetCommand) -Name Set-Alias -CommandType Cmdlet -Module Microsoft.PowerShell.Utility
& $setAlias -Name $args[0] -Value $args[1] -Scope Script
}
$null = Invoke-InMockScope -SessionState $Mock.SessionState -ScriptBlock $scriptBlock -ArgumentList $aliasWithoutExt, $Mock.BootstrapF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ltZXN0YW1waW5n
# IENBAhANQkrgvjqI/2BAIc4UAPDdMA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODA1WjAv
# BgkqhkiG9w0BCQQxIgQgPt8Fl0zdmjOMjRxKybX0NI/b0gjbJN3u7gJMb6YKM/0w
# DQYJKoZIhvcNAQEBBQAEggEADjpvWzFyv70yixaiIryFxQXCcFv4hUO0zNjJ3STP
# 5PKsUCrzxAwSBwQEp3Yg+ifC9qXbyaLUnBTYUy1/eLqUoMObc+ck7Cpg6EUjj1qL
# 7kuUWHg4qGgUgZ1DlrUbEPIrU1KdVZf0m9UQQtLoDqPxUMjniZspO8ky37uwThfb
# ldgX3rBHUtYb2W/OLwtKS5olr/QmMODplJgkiryym55m8F+Mw+ufricrji5LxnCc
# kQSUMmJ5lBKCBdWqOQCVFUfgnGkB3cD9wzuCZW3Tv0VS5RlVAs2JDt50anDTgvK0
# iCwIntbf14xJGnzhlvGUHJiJgH455cXeDC6m2dLHm/2eIg==
# SIG # End signature block
function New-Fixture {
<#
.SYNOPSIS
This function generates two scripts, one that defines a function
and another one that contains its tests.
.DESCRIPTION
This function generates two scripts, one that defines a function
and another one that contains its tests. The files are by default
placed in the current directory and are called and populated as such:
The script defining the function: .\Clean.ps1:
```
function Clean {
}
The script containing the example test .\Clean.Tests.ps1:
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
. "$here\$sut"
Describe "Clean" {
It "does something useful" {
$true | Should -Be $false
}
}
```
.PARAMETER Name
Defines the name of the function and the name of the test to be created.
.PARAMETER Path
Defines path where the test and the function should be created, you can use full or relative path.
If the parameter is not specified the scripts are created in the current directory.
.EXAMPLE
New-Fixture -Name Clean
Creates the scripts in the current directory.
.EXAMPLE
New-Fixture C:\Projects\Cleaner Clean
Creates the scripts in the C:\Projects\Cleaner directory.
.EXAMPLE
New-Fixture Cleaner Clean
Creates a new folder named Cleaner in the current directory and creates the scripts in it.
.LINK
https://pester.dev/docs/commands/Describe
.LINK
https://pester.dev/docs/commands/Context
.LINK
https://pester.dev/docs/commands/It
.LINK
https://pester.dev/docs/commands/Should
#>
param (
[String]$Path = $PWD,
[Parameter(Mandatory = $true)]
[String]$Name
)
$Name = $Name -replace '.ps1', ''
#region File contents
#keep this formatted as is. the format is output to the file as is, including indentation
$scriptCode = "function $Name {$([System.Environment]::NewLine)$([System.Environment]::NewLine)}"
$testCode = '$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace ''\.Tests\.'', ''.''
. "$here\$sut"
Describe "#name#" {
It "does something useful" {
$true | Should -Be $false
}
}' -replace "#name#", $Name
#endregion
$Path = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($Path)
Create-File -Path $Path -Name "$Name.ps1" -Content $scriptCode
Create-File -Path $Path -Name "$Name.Tests.ps1" -Content $testCode
}
function Create-File ($Path, $Name, $Content) {
if (-not (& $SafeCommands['Test-Path'] -Path $Path)) {
& $SafeCommands['New-Item'] -ItemType Directory -Path $Path | & $SafeCommands['Out-Null']
}
$FullPath = & $SafeCommands['Join-Path'] -Path $Path -ChildPath $Name
if (-not (& $SafeCommands['Test-Path'] -Path $FullPath)) {
& $SafeCommands['Set-Content'] -Path $FullPath -Value $Content -Encoding UTF8
& $SafeCommands['Get-Item'] -Path $FullPath
}
else {
# This is deliberately not sent through $SafeCommands, because our own tests rely on
# mocking Write-Warning, and it's not really the end of the world if this call happens to
# be screwed up in an edge case.
Write-Warning "Skipping the file '$FullPath', because it already exists."
}
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0s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gQg3TAquBgi4beAPDYiqlyK+moRJHYfRT7/quXVBGtq3jkw
# DQYJKoZIhvcNAQEBBQAEggEArIZIsb9Lz2MtLTj6Y5RFNZkjkQnUkXIMFfxwsgw9
# D/1s+MCcfkqZ3V0k1+hL2vYH1e0ZKiY/ouaYfTXTrdgUl53pE0r5ZvBsATVQkLbA
# 1O52/hCfYWEkFiKk+d50c92YF2uQBIKQR1yYFa2gyf3qKvXwxcMGG0nUX2JcJ9Px
# vTVFsTYATC76cTPgEeP8+SW0Y4W1Gbz+XzkIzswGdp1ZbJGVT/XsoshT54JdlsGd
# V1jKgl5lZ30DqGKe3Vtt1B4WQMTSCa5TOcPXCoZzxfvoAA2sZ6Xl5R1ZPqrxMeWe
# Wl5VR0zFA9U7q65PRN2amaLefQs4K+DQfFjfyUTPxY2lig==
# SIG # End signature block
function New-MockObject {
<#
.SYNOPSIS
This function instantiates a .NET object from a type.
.DESCRIPTION
Using the New-MockObject you can mock an object based on .NET type.
An .NET assembly for the particular type must be available in the system and loaded.
.PARAMETER Type
The .NET type to create an object based on.
.EXAMPLE
```ps
$obj = New-MockObject -Type 'System.Diagnostics.Process'
$obj.GetType().FullName
System.Diagnostics.Process
```
#>
param (
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[type]$Type
)
[System.Runtime.Serialization.Formatterservices]::GetUninitializedObject($Type)
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQU3nuF7LAU4Jr51dG294VgVU4Z
# J4SgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRk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xnHas+H3FBLiNITCrMQMZXBnhh0RaxnbSLYetJoDGW
# ZeDoyOaCcxPESZnXTgKy93NW1aWfgV3OaUeAks9U1oYA3K2cgvtMnbM+DHbPpvV2
# h+mUN+pWHPQ1bHmRgSq6T7W/BiaJqk2NOQ/CZRTrTgbVdLEHQ43KVzxThzrTkd4w
# lf50M6TSX/lJlpNGP1zXlpMge4VzPkiUeOLbQ+hETfKtVA==
# SIG # End signature block
$Script:ReportStrings = DATA {
@{
HeaderMessage = 'Pester v{0}'
StartMessage = "Executing all tests in '{0}'"
FilterMessage = ' matching test name {0}'
TagMessage = ' with Tags {0}'
MessageOfs = "', '"
CoverageTitle = 'Code coverage report:'
CoverageMessage = 'Covered {2:P2} of {3:N0} analyzed {0} in {4:N0} {1}.'
MissedSingular = 'Missed command:'
MissedPlural = 'Missed commands:'
CommandSingular = 'Command'
CommandPlural = 'Commands'
FileSingular = 'File'
FilePlural = 'Files'
Describe = 'Describing {0}'
Script = 'Executing script {0}'
Context = 'Context {0}'
Margin = ' '
Timing = 'Tests completed in {0}'
# If this is set to an empty string, the count won't be printed
ContextsPassed = ''
ContextsFailed = ''
TestsPassed = 'Tests Passed: {0}, '
TestsFailed = 'Failed: {0}, '
TestsSkipped = 'Skipped: {0}, '
TestsPending = 'Pending: {0}, '
TestsInconclusive = 'Inconclusive: {0} '
}
}
$Script:ReportTheme = DATA {
@{
Describe = 'Green'
DescribeDetail = 'DarkYellow'
Context = 'Cyan'
ContextDetail = 'DarkCyan'
Pass = 'DarkGreen'
PassTime = 'DarkGray'
Fail = 'Red'
FailTime = 'DarkGray'
Skipped = 'Yellow'
SkippedTime = 'DarkGray'
Pending = 'Gray'
PendingTime = 'DarkGray'
Inconclusive = 'Gray'
InconclusiveTime = 'DarkGray'
Incomplete = 'Yellow'
IncompleteTime = 'DarkGray'
Foreground = 'White'
Information = 'DarkGray'
Coverage = 'White'
CoverageWarn = 'DarkRed'
}
}
function Format-PesterPath ($Path, [String]$Delimiter) {
# -is check is not enough for the arrays, the incoming value will likely be object[]
# so we have to check if we can upcast to our required type
if ($null -eq $Path) {
$null
}
elseif ($Path -is [String]) {
$Path
}
elseif ($Path -is [hashtable]) {
# a well formed pester hashtable contains Path
$Path.Path
}
elseif ($null -ne ($path -as [hashtable[]])) {
($path | ForEach-Object { $_.Path }) -join $Delimiter
}
# needs to stay at the bottom because almost everything can be upcast to array of string
elseif ($Path -as [String[]]) {
$Path -join $Delimiter
}
}
function Write-PesterStart {
param(
[Parameter(mandatory = $true, valueFromPipeline = $true)]
$PesterState,
$Path = '.'
)
process {
if (-not ( $pester.Show | Has-Flag 'Header')) {
return
}
$OFS = $ReportStrings.MessageOfs
$moduleInfo = $MyInvocation.MyCommand.ScriptBlock.Module
$moduleVersion = $moduleInfo.Version.ToString()
if ($moduleInfo.PrivateData.PSData.Prerelease) {
$moduleVersion += "-$($moduleInfo.PrivateData.PSData.Prerelease)"
}
$message = $ReportStrings.HeaderMessage -f $moduleVersion
$message += [Environment]::NewLine
$message += $ReportStrings.StartMessage -f (Format-PesterPath $Path -Delimiter $OFS)
if ($PesterState.TestNameFilter) {
$message += $ReportStrings.FilterMessage -f "$($PesterState.TestNameFilter)"
}
if ($PesterState.ScriptBlockFilter) {
$m = $(foreach ($m in $PesterState.ScriptBlockFilter) { "$($m.Path):$($m.Line)" }) -join ", "
$message += $ReportStrings.FilterMessage -f $m
}
if ($PesterState.TagFilter) {
$message += $ReportStrings.TagMessage -f "$($PesterState.TagFilter)"
}
& $SafeCommands['Write-Host']
& $SafeCommands['Write-Host'] $message -Foreground $ReportTheme.Foreground
}
}
function Write-Describe {
param (
[Parameter(mandatory = $true, valueFromPipeline = $true)]
$Describe,
[string] $CommandUsed = 'Describe'
)
process {
if (-not ( $pester.Show | Has-Flag Describe)) {
return
}
$margin = $ReportStrings.Margin * $pester.IndentLevel
$Text = if ($Describe.PSObject.Properties['Name'] -and $Describe.Name) {
$ReportStrings.$CommandUsed -f $Describe.Name
}
else {
$ReportStrings.$CommandUsed -f $Describe
}
& $SafeCommands['Write-Host']
& $SafeCommands['Write-Host'] "${margin}${Text}" -ForegroundColor $ReportTheme.Describe
# If the feature has a longer description, write that too
if ($Describe.PSObject.Properties['Description'] -and $Describe.Description) {
$Describe.Description -split "$([System.Environment]::NewLine)" | ForEach-Object {
& $SafeCommands['Write-Host'] ($ReportStrings.Margin * ($pester.IndentLevel + 1)) $_ -ForegroundColor $ReportTheme.DescribeDetail
}
}
}
}
function Write-Context {
param (
[Parameter(mandatory = $true, valueFromPipeline = $true)]
$Context
)
process {
if (-not ( $pester.Show | Has-Flag Context)) {
return
}
$Text = if ($Context.PSObject.Properties['Name'] -and $Context.Name) {
$ReportStrings.Context -f $Context.Name
}
else {
$ReportStrings.Context -f $Context
}
& $SafeCommands['Write-Host']
& $SafeCommands['Write-Host'] ($ReportStrings.Margin + $Text) -ForegroundColor $ReportTheme.Context
# If the scenario has a longer description, write that too
if ($Context.PSObject.Properties['Description'] -and $Context.Description) {
$Context.Description -split "$([System.Environment]::NewLine)" | ForEach-Object {
& $SafeCommands['Write-Host'] (" " * $ReportStrings.Context.Length) $_ -ForegroundColor $ReportTheme.ContextDetail
}
}
}
}
function ConvertTo-PesterResult {
param(
[String] $Name,
[Nullable[TimeSpan]] $Time,
[System.Management.Automation.ErrorRecord] $ErrorRecord
)
$testResult = @{
Name = $Name
Time = $time
FailureMessage = ""
StackTrace = ""
ErrorRecord = $null
Success = $false
Result = "Failed"
}
if (-not $ErrorRecord) {
$testResult.Result = "Passed"
$testResult.Success = $true
return $testResult
}
if (@('PesterAssertionFailed', 'PesterTestSkipped', 'PesterTestInconclusive', 'PesterTestPending') -contains $ErrorRecord.FullyQualifiedErrorID) {
# we use TargetObject to pass structured information about the error.
$details = $ErrorRecord.TargetObject
$failureMessage = $details.Message
$file = $details.File
$line = $details.Line
$Text = $details.LineText
if (-not $Pester.Strict) {
switch ($ErrorRecord.FullyQualifiedErrorID) {
PesterTestInconclusive {
$testResult.Result = "Inconclusive"; break;
}
PesterTestPending {
$testResult.Result = "Pending"; break;
}
PesterTestSkipped {
$testResult.Result = "Skipped"; break;
}
}
}
}
else {
$failureMessage = $ErrorRecord.ToString()
$file = $ErrorRecord.InvocationInfo.ScriptName
$line = $ErrorRecord.InvocationInfo.ScriptLineNumber
$Text = $ErrorRecord.InvocationInfo.Line
}
$testResult.FailureMessage = $failureMessage
$testResult.StackTrace = "at <ScriptBlock>, ${file}: line ${line}$([System.Environment]::NewLine)${line}: ${Text}"
$testResult.ErrorRecord = $ErrorRecord
return $testResult
}
function Remove-Comments ($Text) {
$text -replace "(?s)(<#.*#>)" -replace "\#.*"
}
function Write-PesterResult {
param (
[Parameter(mandatory = $true, valueFromPipeline = $true)]
$TestResult
)
process {
$quiet = $pester.Show -eq [Pester.OutputTypes]::None
$OutputType = [Pester.OutputTypes] $TestResult.Result
$writeToScreen = $pester.Show | Has-Flag $OutputType
$skipOutput = $quiet -or (-not $writeToScreen)
if ($skipOutput) {
return
}
$margin = $ReportStrings.Margin * ($pester.IndentLevel + 1)
$error_margin = $margin + $ReportStrings.Margin
$output = $TestResult.Name
$humanTime = Get-HumanTime $TestResult.Time.TotalSeconds
if (-not ($OutputType | Has-Flag 'Default, Summary')) {
switch ($TestResult.Result) {
Passed {
& $SafeCommands['Write-Host'] -ForegroundColor $ReportTheme.Pass "$margin[+] $output" -NoNewLine
& $SafeCommands['Write-Host'] -ForegroundColor $ReportTheme.PassTime " $humanTime"
break
}
Failed {
& $SafeCommands['Write-Host'] -ForegroundColor $ReportTheme.Fail "$margin[-] $output" -NoNewLine
& $SafeCommands['Write-Host'] -ForegroundColor $ReportTheme.FailTime " $humanTime"
if ($pester.IncludeVSCodeMarker) {
& $SafeCommands['Write-Host'] -ForegroundColor $ReportTheme.Fail $($TestResult.StackTrace -replace '(?m)^', $error_margin)
& $SafeCommands['Write-Host'] -ForegroundColor $ReportTheme.Fail $($TestResult.FailureMessage -replace '(?m)^', $error_margin)
}
else {
$TestResult.ErrorRecord |
ConvertTo-FailureLines |
ForEach-Object {$_.Message + $_.Trace} |
ForEach-Object { & $SafeCommands['Write-Host'] -ForegroundColor $ReportTheme.Fail $($_ -replace '(?m)^', $error_margin) }
}
break
}
Skipped {
$targetObject = if ($null -ne $testresult.ErrorRecord -and
($o = $testresult.ErrorRecord.PSObject.Properties.Item("TargetObject"))) { $o.Value }
$because = if ($targetObject -and $targetObject.Data.Because) {
", because $($testresult.ErrorRecord.TargetObject.Data.Because)"
}
else {
$null
}
& $SafeCommands['Write-Host'] -ForegroundColor $ReportTheme.Skipped "$margin[!] $output" -NoNewLine
& $SafeCommands['Write-Host'] -ForegroundColor $ReportTheme.Skipped ", is skipped$because" -NoNewLine
& $SafeCommands['Write-Host'] -ForegroundColor $ReportTheme.SkippedTime " $humanTime"
break
}
Pending {
$because = if ($testresult.ErrorRecord.TargetObject.Data.Because) {
", because $($testresult.ErrorRecord.TargetObject.Data.Because)"
}
else {
$null
}
& $SafeCommands['Write-Host'] -ForegroundColor $ReportTheme.Pending "$margin[?] $output" -NoNewLine
& $SafeCommands['Write-Host'] -ForegroundColor $ReportTheme.Pending ", is pending$because" -NoNewLine
& $SafeCommands['Write-Host'] -ForegroundColor $ReportTheme.PendingTime " $humanTime"
break
}
Inconclusive {
$because = if ($testresult.ErrorRecord.TargetObject.Data.Because) {
", because $($testresult.ErrorRecord.TargetObject.Data.Because)"
}
else {
$null
}
& $SafeCommands['Write-Host'] -ForegroundColor $ReportTheme.Inconclusive "$margin[?] $output" -NoNewLine
& $SafeCommands['Write-Host'] -ForegroundColor $ReportTheme.Inconclusive ", is inconclusive$because" -NoNewLine
& $SafeCommands['Write-Host'] -ForegroundColor $ReportTheme.InconclusiveTime " $humanTime"
break
}
default {
# TODO: Add actual Incomplete status as default rather than checking for null time.
if ($null -eq $TestResult.Time) {
& $SafeCommands['Write-Host'] -ForegroundColor $ReportTheme.Incomplete "$margin[?] $output" -NoNewLine
& $SafeCommands['Write-Host'] -ForegroundColor $ReportTheme.IncompleteTime " $humanTime"
}
}
}
}
}
}
function Write-PesterReport {
param (
[Parameter(mandatory = $true, valueFromPipeline = $true)]
$PesterState
)
if (-not ($PesterState.Show | Has-Flag Summary)) {
return
}
& $SafeCommands['Write-Host'] ($ReportStrings.Timing -f (Get-HumanTime $PesterState.Time.TotalSeconds)) -Foreground $ReportTheme.Foreground
$Success, $Failure = if ($PesterState.FailedCount -gt 0) {
$ReportTheme.Foreground, $ReportTheme.Fail
}
else {
$ReportTheme.Pass, $ReportTheme.Information
}
$Skipped = if ($PesterState.SkippedCount -gt 0) {
$ReportTheme.Skipped
}
else {
$ReportTheme.Information
}
$Pending = if ($PesterState.PendingCount -gt 0) {
$ReportTheme.Pending
}
else {
$ReportTheme.Information
}
$Inconclusive = if ($PesterState.InconclusiveCount -gt 0) {
$ReportTheme.Inconclusive
}
else {
$ReportTheme.Information
}
Try {
$PesterStatePassedScenariosCount = $PesterState.PassedScenarios.Count
}
Catch {
$PesterStatePassedScenariosCount = 0
}
Try {
$PesterStateFailedScenariosCount = $PesterState.FailedScenarios.Count
}
Catch {
$PesterStateFailedScenariosCount = 0
}
if ($ReportStrings.ContextsPassed) {
& $SafeCommands['Write-Host'] ($ReportStrings.ContextsPassed -f $PesterStatePassedScenariosCount) -Foreground $Success -NoNewLine
& $SafeCommands['Write-Host'] ($ReportStrings.ContextsFailed -f $PesterStateFailedScenariosCount) -Foreground $Failure
}
if ($ReportStrings.TestsPassed) {
& $SafeCommands['Write-Host'] ($ReportStrings.TestsPassed -f $PesterState.PassedCount) -Foreground $Success -NoNewLine
& $SafeCommands['Write-Host'] ($ReportStrings.TestsFailed -f $PesterState.FailedCount) -Foreground $Failure -NoNewLine
& $SafeCommands['Write-Host'] ($ReportStrings.TestsSkipped -f $PesterState.SkippedCount) -Foreground $Skipped -NoNewLine
& $SafeCommands['Write-Host'] ($ReportStrings.TestsPending -f $PesterState.PendingCount) -Foreground $Pending -NoNewLine
& $SafeCommands['Write-Host'] ($ReportStrings.TestsInconclusive -f $PesterState.InconclusiveCount) -Foreground $Inconclusive
}
}
function Write-CoverageReport {
param ([object] $CoverageReport)
if ($null -eq $CoverageReport -or ($pester.Show -eq [Pester.OutputTypes]::None) -or $CoverageReport.NumberOfCommandsAnalyzed -eq 0) {
return
}
$totalCommandCount = $CoverageReport.NumberOfCommandsAnalyzed
$fileCount = $CoverageReport.NumberOfFilesAnalyzed
$executedPercent = ($CoverageReport.NumberOfCommandsExecuted / $CoverageReport.NumberOfCommandsAnalyzed).ToString("P2")
$command = if ($totalCommandCount -gt 1) {
$ReportStrings.CommandPlural
}
else {
$ReportStrings.CommandSingular
}
$file = if ($fileCount -gt 1) {
$ReportStrings.FilePlural
}
else {
$ReportStrings.FileSingular
}
$commonParent = Get-CommonParentPath -Path $CoverageReport.AnalyzedFiles
$report = $CoverageReport.MissedCommands | & $SafeCommands['Select-Object'] -Property @(
@{ Name = 'File'; Expression = { Get-RelativePath -Path $_.File -RelativeTo $commonParent } }
'Class'
'Function'
'Line'
'Command'
)
& $SafeCommands['Write-Host']
& $SafeCommands['Write-Host'] $ReportStrings.CoverageTitle -Foreground $ReportTheme.Coverage
if ($CoverageReport.MissedCommands.Count -gt 0) {
& $SafeCommands['Write-Host'] ($ReportStrings.CoverageMessage -f $command, $file, $executedPercent, $totalCommandCount, $fileCount) -Foreground $ReportTheme.CoverageWarn
if ($CoverageReport.MissedCommands.Count -eq 1) {
& $SafeCommands['Write-Host'] $ReportStrings.MissedSingular -Foreground $ReportTheme.CoverageWarn
}
else {
& $SafeCommands['Write-Host'] $ReportStrings.MissedPlural -Foreground $ReportTheme.CoverageWarn
}
$report | & $SafeCommands['Format-Table'] -AutoSize | & $SafeCommands['Out-Host']
}
else {
& $SafeCommands['Write-Host'] ($ReportStrings.CoverageMessage -f $command, $file, $executedPercent, $totalCommandCount, $fileCount) -Foreground $ReportTheme.Coverage
}
}
function ConvertTo-FailureLines {
param (
[Parameter(mandatory = $true, valueFromPipeline = $true)]
$ErrorRecord
)
process {
$lines = & $script:SafeCommands['New-Object'] psobject -Property @{
Message = @()
Trace = @()
}
## convert the exception messages
$exception = $ErrorRecord.Exception
$exceptionLines = @()
while ($exception) {
$exceptionName = $exception.GetType().Name
$thisLines = $exception.Message.Split([string[]]($([System.Environment]::NewLine), "\n", "`n"), [System.StringSplitOptions]::RemoveEmptyEntries)
if ($ErrorRecord.FullyQualifiedErrorId -ne 'PesterAssertionFailed' -and $thisLines.Length -gt 0) {
if ($thisLines[0] -match '(?n)\(Parameter ''(?<param>[^'']+)''\)$') {
$thisLines = @(
"$exceptionName`: $($thisLines[0] -replace '\s*\(Parameter ''[^'']+''\)$')"
"Parameter name: $($Matches.param)"
for ($i = 1; $i -lt $thisLines.Length; $i++) { $thisLines[$i] }
)
}
else {
$thisLines[0] = "$exceptionName`: $($thisLines[0])"
}
}
[array]::Reverse($thisLines)
$exceptionLines += $thisLines
$exception = $exception.InnerException
}
[array]::Reverse($exceptionLines)
$lines.Message += $exceptionLines
if ($ErrorRecord.FullyQualifiedErrorId -eq 'PesterAssertionFailed') {
$lines.Message += "$($ErrorRecord.TargetObject.Line)`: $($ErrorRecord.TargetObject.LineText)".Split([string[]]($([System.Environment]::NewLine), "\n", "`n"), [System.StringSplitOptions]::RemoveEmptyEntries)
}
if ( -not ($ErrorRecord | & $SafeCommands['Get-Member'] -Name ScriptStackTrace) ) {
if ($ErrorRecord.FullyQualifiedErrorID -eq 'PesterAssertionFailed') {
$lines.Trace += "at line: $($ErrorRecord.TargetObject.Line) in $($ErrorRecord.TargetObject.File)"
}
else {
$lines.Trace += "at line: $($ErrorRecord.InvocationInfo.ScriptLineNumber) in $($ErrorRecord.InvocationInfo.ScriptName)"
}
return $lines
}
## convert the stack trace if present (there might be none if we are raising the error ourselves)
# todo: this is a workaround see https://github.com/pester/Pester/pull/886
if ($null -ne $ErrorRecord.ScriptStackTrace) {
$traceLines = $ErrorRecord.ScriptStackTrace.Split([Environment]::NewLine, [System.StringSplitOptions]::RemoveEmptyEntries)
}
$count = 0
# omit the lines internal to Pester
If ((GetPesterOS) -ne 'Windows') {
[String]$pattern1 = '^at (Invoke-Test|Context|Describe|InModuleScope|Invoke-Pester), .*/Functions/.*.ps1: line [0-9]*$'
[String]$pattern2 = '^at Should<End>, .*/Functions/Assertions/Should.ps1: line [0-9]*$'
[String]$pattern3 = '^at Assert-MockCalled, .*/Functions/Mock.ps1: line [0-9]*$'
[String]$pattern4 = '^at Invoke-Assertion, .*/Functions/.*.ps1: line [0-9]*$'
[String]$pattern5 = '^at (<ScriptBlock>|Invoke-Gherkin.*), (<No file>|.*/Functions/.*.ps1): line [0-9]*$'
[String]$pattern6 = '^at Invoke-LegacyAssertion, .*/Functions/.*.ps1: line [0-9]*$'
}
Else {
[String]$pattern1 = '^at (Invoke-Test|Context|Describe|InModuleScope|Invoke-Pester), .*\\Functions\\.*.ps1: line [0-9]*$'
[String]$pattern2 = '^at Should<End>, .*\\Functions\\Assertions\\Should.ps1: line [0-9]*$'
[String]$pattern3 = '^at Assert-MockCalled, .*\\Functions\\Mock.ps1: line [0-9]*$'
[String]$pattern4 = '^at Invoke-Assertion, .*\\Functions\\.*.ps1: line [0-9]*$'
[String]$pattern5 = '^at (<ScriptBlock>|Invoke-Gherkin.*), (<No file>|.*\\Functions\\.*.ps1): line [0-9]*$'
[String]$pattern6 = '^at Invoke-LegacyAssertion, .*\\Functions\\.*.ps1: line [0-9]*$'
}
foreach ( $line in $traceLines ) {
if ( $line -match $pattern1 ) {
break
}
$count ++
}
if ($ExecutionContext.SessionState.PSVariable.GetValue("PesterDebugPreference_ShowFullErrors")) {
$lines.Trace += $traceLines
}
else {
$lines.Trace += $traceLines |
& $SafeCommands['Select-Object'] -First $count |
& $SafeCommands['Where-Object'] {
$_ -notmatch $pattern2 -and
$_ -notmatch $pattern3 -and
$_ -notmatch $pattern4 -and
$_ -notmatch $pattern5 -and
$_ -notmatch $pattern6
}
}
return $lines
}
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCz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DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODA1WjAv
# BgkqhkiG9w0BCQQxIgQggkQsuy5MXZRXsXs0nLFPXxa+xE4EHEcHHTFycx9dKu4w
# DQYJKoZIhvcNAQEBBQAEggEAG3bJygRNp1Y/FQaCNzan5nrKVQtGzI8X+21XbsYF
# qvcE+KxgqzVAVzfRnb7jt+AbBo3OI1x0RFz6uAhgyImOxBvU9EfA5HZhzLFEMNQn
# 7RE5g//sMl7EkKnNNKNwwcqLwxmx0Y/7+xIvfx0AGd34o/9kxzceqen5Lz6dHypl
# RN68WpIILBftaC3tgCGcCWjnKt30Ymv0Vgnz++EZRwyM6FI95hiWQQvjWloCqjuc
# 3Uh0csOYTf+m/tliUGmEEIvYHu/Z5nvVWFGTPF9XtxP1v8EEOhheqjxJqBS3atVa
# 0ZKe7djx5edEbUNCe+MqO7XExKE9tYFdSQGoJlY/bm8ReA==
# SIG # End signature block
function New-PesterState {
param (
[String[]]$TagFilter,
[String[]]$ExcludeTagFilter,
[String[]]$TestNameFilter,
[System.Management.Automation.SessionState]$SessionState,
[Switch]$Strict,
[Pester.OutputTypes]$Show = 'All',
[object]$PesterOption,
[Switch]$RunningViaInvokePester,
[Hashtable[]] $ScriptBlockFilter
)
if ($null -eq $SessionState) {
$SessionState = Set-SessionStateHint -PassThru -Hint "Module - Pester (captured in New-PesterState)" -SessionState $ExecutionContext.SessionState
}
if ($null -eq $PesterOption) {
$PesterOption = New-PesterOption
}
elseif ($PesterOption -is [System.Collections.IDictionary]) {
try {
$PesterOption = New-PesterOption @PesterOption
}
catch {
throw
}
}
& $SafeCommands['New-Module'] -Name PesterState -AsCustomObject -ArgumentList $TagFilter, $ExcludeTagFilter, $TestNameFilter, $SessionState, $Strict, $Show, $PesterOption, $RunningViaInvokePester -ScriptBlock {
param (
[String[]]$_tagFilter,
[String[]]$_excludeTagFilter,
[String[]]$_testNameFilter,
[System.Management.Automation.SessionState]$_sessionState,
[Switch]$Strict,
[Pester.OutputTypes]$Show,
[object]$PesterOption,
[Switch]$RunningViaInvokePester
)
#public read-only
$TagFilter = $_tagFilter
$ExcludeTagFilter = $_excludeTagFilter
$TestNameFilter = $_testNameFilter
$script:SessionState = $_sessionState
$script:Stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
$script:TestStartTime = $null
$script:TestStopTime = $null
$script:CommandCoverage = @()
$script:Strict = $Strict
$script:Show = $Show
$script:InTest = $false
$script:TestResult = @()
$script:TotalCount = 0
$script:Time = [timespan]0
$script:PassedCount = 0
$script:FailedCount = 0
$script:SkippedCount = 0
$script:PendingCount = 0
$script:InconclusiveCount = 0
$script:IncludeVSCodeMarker = $PesterOption.IncludeVSCodeMarker
$script:TestSuiteName = $PesterOption.TestSuiteName
$script:ScriptBlockFilter = $PesterOption.ScriptBlockFilter
$script:RunningViaInvokePester = $RunningViaInvokePester
$script:SafeCommands = @{}
$script:SafeCommands['New-Object'] = & (Pester\SafeGetCommand) -Name New-Object -Module Microsoft.PowerShell.Utility -CommandType Cmdlet
$script:SafeCommands['Select-Object'] = & (Pester\SafeGetCommand) -Name Select-Object -Module Microsoft.PowerShell.Utility -CommandType Cmdlet
$script:SafeCommands['Export-ModuleMember'] = & (Pester\SafeGetCommand) -Name Export-ModuleMember -Module Microsoft.PowerShell.Core -CommandType Cmdlet
$script:SafeCommands['Add-Member'] = & (Pester\SafeGetCommand) -Name Add-Member -Module Microsoft.PowerShell.Utility -CommandType Cmdlet
function New-TestGroup([string] $Name, [string] $Hint) {
& $SafeCommands['New-Object'] psobject -Property @{
Name = $Name
Type = 'TestGroup'
Hint = $Hint
Actions = [System.Collections.ArrayList]@()
BeforeEach = & $SafeCommands['New-Object'] System.Collections.Generic.List[scriptblock]
AfterEach = & $SafeCommands['New-Object'] System.Collections.Generic.List[scriptblock]
BeforeAll = & $SafeCommands['New-Object'] System.Collections.Generic.List[scriptblock]
AfterAll = & $SafeCommands['New-Object'] System.Collections.Generic.List[scriptblock]
TotalCount = 0
StartTime = $Null
Time = [timespan]0
PassedCount = 0
FailedCount = 0
SkippedCount = 0
PendingCount = 0
InconclusiveCount = 0
}
}
$script:TestActions = New-TestGroup -Name Pester -Hint Root
$script:TestGroupStack = & $SafeCommands['New-Object'] System.Collections.Stack
$script:TestGroupStack.Push($script:TestActions)
function EnterTestGroup([string] $Name, [string] $Hint) {
$newGroup = New-TestGroup @PSBoundParameters
$newGroup.StartTime = $script:Stopwatch.Elapsed
$null = $script:TestGroupStack.Peek().Actions.Add($newGroup)
$script:TestGroupStack.Push($newGroup)
}
function LeaveTestGroup([string] $Name, [string] $Hint) {
$StopTime = $script:Stopwatch.Elapsed
$currentGroup = $script:TestGroupStack.Pop()
if ( $Hint -eq 'Script' ) {
$script:Time += $StopTime - $currentGroup.StartTime
}
$currentGroup.Time = $StopTime - $currentGroup.StartTime
# Removing start time property from output to prevent clutter
$currentGroup.PSObject.properties.remove('StartTime')
if ($currentGroup.Name -ne $Name -or $currentGroup.Hint -ne $Hint) {
throw "TestGroups stack corrupted: Expected name/hint of '$Name','$Hint'. Found '$($currentGroup.Name)', '$($currentGroup.Hint)'."
}
}
function AddTestResult {
param (
[string]$Name,
[ValidateSet("Failed", "Passed", "Skipped", "Pending", "Inconclusive")]
[string]$Result,
[Nullable[TimeSpan]]$Time,
[string]$FailureMessage,
[string]$StackTrace,
[string] $ParameterizedSuiteName,
[System.Collections.IDictionary] $Parameters,
[System.Management.Automation.ErrorRecord] $ErrorRecord
)
# defining this function in here, because otherwise it is not available
function New-ErrorRecord ([string] $Message, [string] $ErrorId, [string] $File, [string] $Line, [string] $LineText) {
$exception = & $SafeCommands['New-Object'] Exception $Message
$errorCategory = [Management.Automation.ErrorCategory]::InvalidResult
# we use ErrorRecord.TargetObject to pass structured information about the error to a reporting system.
$targetObject = @{Message = $Message; File = $File; Line = $Line; LineText = $LineText}
$errorRecord = & $SafeCommands['New-Object'] Management.Automation.ErrorRecord $exception, $ErrorID, $errorCategory, $targetObject
return $errorRecord
}
if ($null -eq $Time) {
if ( $script:TestStartTime -and $script:TestStopTime ) {
$Time = $script:TestStopTime - $script:TestStartTime
$script:TestStartTime = $null
$script:TestStopTime = [timespan]0
}
else {
$Time = [timespan]0
}
}
if (-not $script:Strict) {
$Passed = "Passed", "Skipped", "Pending" -contains $Result
}
else {
$Passed = $Result -eq "Passed"
if (@("Skipped", "Pending", "Inconclusive") -contains $Result) {
$FailureMessage = "The test failed because the test was executed in Strict mode and the result '$result' was translated to Failed."
$ErrorRecord = New-ErrorRecord -ErrorId "PesterTest$Result" -Message $FailureMessage
$Result = "Failed"
}
}
$script:TotalCount++
switch ($Result) {
Passed {
$script:PassedCount++; break;
}
Failed {
$script:FailedCount++; break;
}
Skipped {
$script:SkippedCount++; break;
}
Pending {
$script:PendingCount++; break;
}
Inconclusive {
$script:InconclusiveCount++; break;
}
}
$resultRecord = & $SafeCommands['New-Object'] -TypeName PsObject -Property @{
Name = $Name
Type = 'TestCase'
Passed = $Passed
Result = $Result
Time = $Time
FailureMessage = $FailureMessage
StackTrace = $StackTrace
ErrorRecord = $ErrorRecord
ParameterizedSuiteName = $ParameterizedSuiteName
Parameters = $Parameters
Show = $script:Show
}
$null = $script:TestGroupStack.Peek().Actions.Add($resultRecord)
# Attempting some degree of backward compatibility for the TestResult collection for now; deprecated and will be removed in the future
$describe = ''
$contexts = [System.Collections.ArrayList]@()
# make a copy of the stack and reverse it
$reversedStack = $script:TestGroupStack.ToArray()
[array]::Reverse($reversedStack)
foreach ($group in $reversedStack) {
if ($group.Hint -eq 'Root' -or $group.Hint -eq 'Script') {
continue
}
if ($describe -eq '' -or $group.Hint -eq 'Feature') {
$describe = $group.Name
}
else {
$null = $contexts.Add($group.Name)
}
}
$context = $contexts -join '\'
$script:TestResult += & $SafeCommands['New-Object'] psobject -Property @{
Describe = $describe
Context = $context
Name = $Name
Passed = $Passed
Result = $Result
Time = $Time
FailureMessage = $FailureMessage
StackTrace = $StackTrace
ErrorRecord = $ErrorRecord
ParameterizedSuiteName = $ParameterizedSuiteName
Parameters = $Parameters
Show = $script:Show
}
}
function AddSetupOrTeardownBlock([scriptblock] $ScriptBlock, [string] $CommandName) {
$currentGroup = $script:TestGroupStack.Peek()
$isSetupCommand = IsSetupCommand -CommandName $CommandName
$isGroupCommand = IsTestGroupCommand -CommandName $CommandName
if ($isSetupCommand) {
if ($isGroupCommand) {
$currentGroup.BeforeAll.Add($ScriptBlock)
}
else {
$currentGroup.BeforeEach.Add($ScriptBlock)
}
}
else {
if ($isGroupCommand) {
$currentGroup.AfterAll.Add($ScriptBlock)
}
else {
$currentGroup.AfterEach.Add($ScriptBlock)
}
}
}
function IsSetupCommand {
param ([string] $CommandName)
return $CommandName -eq 'BeforeEach' -or $CommandName -eq 'BeforeAll'
}
function IsTestGroupCommand {
param ([string] $CommandName)
return $CommandName -eq 'BeforeAll' -or $CommandName -eq 'AfterAll'
}
function GetTestCaseSetupBlocks {
$blocks = @(
foreach ($group in $this.TestGroups) {
$group.BeforeEach
}
)
return $blocks
}
function GetTestCaseTeardownBlocks {
$groups = @($this.TestGroups)
[Array]::Reverse($groups)
$blocks = @(
foreach ($group in $groups) {
$group.AfterEach
}
)
return $blocks
}
function GetCurrentTestGroupSetupBlocks {
return $script:TestGroupStack.Peek().BeforeAll
}
function GetCurrentTestGroupTeardownBlocks {
return $script:TestGroupStack.Peek().AfterAll
}
function EnterTest {
if ($script:InTest) {
throw 'You are already in a test case.'
}
$script:TestStartTime = $script:Stopwatch.Elapsed
$script:InTest = $true
}
function LeaveTest {
$script:TestStopTime = $script:Stopwatch.Elapsed
$script:InTest = $false
}
$ExportedVariables = "TagFilter",
"ExcludeTagFilter",
"TestNameFilter",
"ScriptBlockFilter",
"TestResult",
"SessionState",
"CommandCoverage",
"Strict",
"Show",
"Time",
"TotalCount",
"PassedCount",
"FailedCount",
"SkippedCount",
"PendingCount",
"InconclusiveCount",
"IncludeVSCodeMarker",
"TestActions",
"TestGroupStack",
"TestSuiteName",
"InTest",
"RunningViaInvokePester"
$ExportedFunctions = "EnterTestGroup",
"LeaveTestGroup",
"AddTestResult",
"AddSetupOrTeardownBlock",
"GetTestCaseSetupBlocks",
"GetTestCaseTeardownBlocks",
"GetCurrentTestGroupSetupBlocks",
"GetCurrentTestGroupTeardownBlocks",
"EnterTest",
"LeaveTest"
& $SafeCommands['Export-ModuleMember'] -Variable $ExportedVariables -function $ExportedFunctions
} |
& $SafeCommands['Add-Member'] -PassThru -MemberType ScriptProperty -Name CurrentTestGroup -Value {
$this.TestGroupStack.Peek()
} |
& $SafeCommands['Add-Member'] -PassThru -MemberType ScriptProperty -Name TestGroups -Value {
$array = $this.TestGroupStack.ToArray()
[Array]::Reverse($array)
return $array
} |
& $SafeCommands['Add-Member'] -PassThru -MemberType ScriptProperty -Name IndentLevel -Value {
# We ignore the root node of the stack here, and don't start indenting until after the Script nodes inside the root
return [Math]::Max(0, $this.TestGroupStack.Count - 2)
}
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUM0YLCmBo7o4/Zz8+JDOhPo7X
# 8d6gghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQQDExdEaWdpQ2VydCBUaW1lc3RhbXAg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PSIS
Set-ItResult is used inside the It block to explicitly set the test result
.DESCRIPTION
Sometimes a test shouldn't be executed, sometimes the condition cannot be evaluated.
By default such tests would typically fail and produce a big red message.
Using Set-ItResult it is possible to set the result from the inside of the It script
block to either inconclusive, pending or skipped.
.PARAMETER Inconclusive
Sets the test result to inconclusive. Cannot be used at the same time as -Pending or -Skipped
.PARAMETER Pending
Sets the test result to pending. Cannot be used at the same time as -Inconclusive or -Skipped
.PARAMETER Skipped
Sets the test result to skipped. Cannot be used at the same time as -Inconclusive or -Pending
.PARAMETER Because
Similarily to failing tests, skipped and inconclusive tests should have reason. It allows
to provide information to the user why the test is neither successful nor failed.
.EXAMPLE
```ps
Describe "Example" {
It "Inconclusive result test" {
Set-ItResult -Inconclusive -Because "we want it to be inconclusive"
}
}
```
the output should be
```
[?] Inconclusive result test, is inconclusive, because we want it to be inconclusive
Tests completed in 0ms
Tests Passed: 0, Failed: 0, Skipped: 0, Pending: 0, Inconclusive 1
```
.EXAMPLE
```ps
Describe "Example" {
It "Skipped test" {
Set-ItResult -Skipped -Because "we want it to be skipped"
}
}
```
the output should be
```
[!] Skipped test, is skipped, because we want it to be skipped
Tests completed in 0ms
Tests Passed: 0, Failed: 0, Skipped: 0, Pending: 0, Inconclusive 1
```
#>
[CmdletBinding()]
param(
[Parameter(Mandatory = $false, ParameterSetName = "Inconclusive")][switch]$Inconclusive,
[Parameter(Mandatory = $false, ParameterSetName = "Pending")][switch]$Pending,
[Parameter(Mandatory = $false, ParameterSetName = "Skipped")][switch]$Skipped,
[string]$Because
)
Assert-DescribeInProgress -CommandName Set-ItResult
$result = $PSCmdlet.ParameterSetName
$message = "It result set to $result$(if ($Because) { ", $Because" })"
$data = @{
Result = $result
Because = $Because
}
$errorRecord = New-PesterErrorRecord -Result $result -Message $message -Data $data
throw $errorRecord
}
function New-PesterErrorRecord {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[string]$Result,
[Parameter(Mandatory = $true)]
[string]$Message,
[string]$File,
[string]$Line,
[string]$LineText,
[hashtable]$Data
)
$exception = New-Object Exception $Message
$errorID = "PesterTest$Result"
$errorCategory = [Management.Automation.ErrorCategory]::InvalidResult
# we use ErrorRecord.TargetObject to pass structured information about the error to a reporting system.
$targetObject = @{
Message = $Message
Data = $Data
File = $(if ($File -ne $null) {
$File
}
else {
$MyInvocation.ScriptName
})
Line = $(if ($Line -ne $null) {
$Line
}
else {
$MyInvocation.ScriptLineNumber
})
LineText = $(if ($LineText -ne $null) {
$LineText
}
else {
$MyInvocation.Line
}).TrimEnd($([System.Environment]::NewLine))
}
New-Object Management.Automation.ErrorRecord $exception, $errorID, $errorCategory, $targetObject
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUgCdHQVMDWahxEPgFP2MBM9PH
# bdKgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQQDExdEaWdpQ2VydCBUaW1lc3RhbXAgMjAyMTCCASIwDQYJKoZIhvcN
# AQEBBQADggEPADCCAQoCggEBAMLmYYRnxYr1DQikRcpja1HXOhFCvQp1dU2UtAxQ
# tSYQ/h3Ib5FrDJbnGlxI70Tlv5thzRWRYlq4/2c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OczMv1Kbn7xdBVwXMD05H/HJ38Jd6Cjb69f2RBbTKSiCLd5iE5nAfudS9C3dqyn
# NcFvCoblEps9D1jijoLy/jHstpfB2ewkUxKaiFl2qsZn4r0qNCTn/T5IoVmG8qGC
# AjAwggIsBgkqhkiG9w0BCQYxggIdMIICGQIBATCBhjByMQswCQYDVQQGEwJVUzEV
# MBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29t
# MTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgVGltZXN0YW1waW5n
# IENBAhANQkrgvjqI/2BAIc4UAPDdMA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODA2WjAv
# BgkqhkiG9w0BCQQxIgQgoZ6Z8RgBz1DKq3X0Vk9kvs0paCK6TORIeIKE0STZH6Iw
# DQYJKoZIhvcNAQEBBQAEggEAnQIwbHgRZ9aJ3+86XTIS1Vb545OtsboQAP0QHwux
# OZ/qlgjMAy83udmZlzgBAtyHBsjYdxWWkb3jv+ncUF3HK3zUO5w4HKNu2KvVfs+2
# nmG4zoj2D06As9VbrSUDqMYd7Vkf3da9bSSIRYgOkYMtmi9Vk5tNhXd1UEfleo79
# +xDulVG3IYTh2HImwzAA9erqFlqPCTcnP2oVXsd/6tcK93dUFi8ePP8gUeEmncIz
# ur5eRmhq+pEhxzPs4+khyWdLHn3RXPGdTaxiTNCfmHG2qB+zOGTs6KryErL0qbw8
# yejDQlqUpFrwwNyOlO+7Z5kznEjYQVqL4Swc2I/dVTAkpg==
# SIG # End signature block
function BeforeEach {
<#
.SYNOPSIS
Defines a series of steps to perform at the beginning of every It block within
the current Context or Describe block.
.DESCRIPTION
BeforeEach, AfterEach, BeforeAll, and AfterAll are unique in that they apply
to the entire Context or Describe block, regardless of the order of the
statements in the Context or Describe. For a full description of this
behavior, as well as how multiple BeforeEach or AfterEach blocks interact
with each other, please refer to the about_BeforeEach_AfterEach help file.
.LINK
https://pester.dev/docs/commands/AfterEach
#>
[CmdletBinding()]
param
(
# the scriptblock to execute
[Parameter(Mandatory = $true,
Position = 1)]
[Scriptblock]
$Scriptblock
)
Assert-DescribeInProgress -CommandName BeforeEach
}
function AfterEach {
<#
.SYNOPSIS
Defines a series of steps to perform at the end of every It block within
the current Context or Describe block.
.DESCRIPTION
BeforeEach, AfterEach, BeforeAll, and AfterAll are unique in that they apply
to the entire Context or Describe block, regardless of the order of the
statements in the Context or Describe. For a full description of this
behavior, as well as how multiple BeforeEach or AfterEach blocks interact
with each other, please refer to the about_BeforeEach_AfterEach help file.
.LINK
https://pester.dev/docs/commands/BeforeEach
#>
[CmdletBinding()]
param
(
# the scriptblock to execute
[Parameter(Mandatory = $true,
Position = 1)]
[Scriptblock]
$Scriptblock
)
Assert-DescribeInProgress -CommandName AfterEach
}
function BeforeAll {
<#
.SYNOPSIS
Defines a series of steps to perform at the beginning of the current Context
or Describe block.
.DESCRIPTION
BeforeEach, AfterEach, BeforeAll, and AfterAll are unique in that they apply
to the entire Context or Describe block, regardless of the order of the
statements in the Context or Describe.
.LINK
https://pester.dev/docs/commands/AfterAll
#>
[CmdletBinding()]
param
(
# the scriptblock to execute
[Parameter(Mandatory = $true,
Position = 1)]
[Scriptblock]
$Scriptblock
)
Assert-DescribeInProgress -CommandName BeforeAll
}
function AfterAll {
<#
.SYNOPSIS
Defines a series of steps to perform at the end of the current Context
or Describe block.
.DESCRIPTION
BeforeEach, AfterEach, BeforeAll, and AfterAll are unique in that they apply
to the entire Context or Describe block, regardless of the order of the
statements in the Context or Describe.
.LINK
https://pester.dev/docs/commands/BeforeAll
#>
[CmdletBinding()]
param
(
# the scriptblock to execute
[Parameter(Mandatory = $true,
Position = 1)]
[Scriptblock]
$Scriptblock
)
Assert-DescribeInProgress -CommandName AfterAll
}
function Invoke-TestCaseSetupBlocks {
Invoke-Blocks -ScriptBlock $pester.GetTestCaseSetupBlocks()
}
function Invoke-TestCaseTeardownBlocks {
Invoke-Blocks -ScriptBlock $pester.GetTestCaseTeardownBlocks()
}
function Invoke-TestGroupSetupBlocks {
Invoke-Blocks -ScriptBlock $pester.GetCurrentTestGroupSetupBlocks()
}
function Invoke-TestGroupTeardownBlocks {
Invoke-Blocks -ScriptBlock $pester.GetCurrentTestGroupTeardownBlocks()
}
function Invoke-Blocks {
param ([scriptblock[]] $ScriptBlock)
foreach ($block in $ScriptBlock) {
if ($null -eq $block) {
continue
}
$null = . $block
}
}
function Add-SetupAndTeardown {
param (
[scriptblock] $ScriptBlock
)
if ($PSVersionTable.PSVersion.Major -le 2) {
Add-SetupAndTeardownV2 -ScriptBlock $ScriptBlock
}
else {
Add-SetupAndTeardownV3 -ScriptBlock $ScriptBlock
}
}
function Add-SetupAndTeardownV3 {
param (
[scriptblock] $ScriptBlock
)
$pattern = '^(?:Before|After)(?:Each|All)$'
$predicate = {
param ([System.Management.Automation.Language.Ast] $Ast)
$Ast -is [System.Management.Automation.Language.CommandAst] -and
$Ast.CommandElements[0].ToString() -match $pattern -and
$Ast.CommandElements[-1] -is [System.Management.Automation.Language.ScriptBlockExpressionAst]
}
$searchNestedBlocks = $false
$calls = $ScriptBlock.Ast.FindAll($predicate, $searchNestedBlocks)
foreach ($call in $calls) {
# For some reason, calling ScriptBlockAst.GetScriptBlock() sometimes blows up due to failing semantics
# checks, even though the code is perfectly valid. So we'll poke around with reflection again to skip
# that part and just call the internal ScriptBlock constructor that we need
$iPmdProviderType = [scriptblock].Assembly.GetType('System.Management.Automation.Language.IParameterMetadataProvider')
$flags = [System.Reflection.BindingFlags]'Instance, NonPublic'
$constructor = [scriptblock].GetConstructor($flags, $null, [Type[]]@($iPmdProviderType, [bool]), $null)
$block = $constructor.Invoke(@($call.CommandElements[-1].ScriptBlock, $false))
Set-ScriptBlockScope -ScriptBlock $block -SessionState $pester.SessionState
$commandName = $call.CommandElements[0].ToString()
Add-SetupOrTeardownScriptBlock -CommandName $commandName -ScriptBlock $block
}
}
function Add-SetupAndTeardownV2 {
param (
[scriptblock] $ScriptBlock
)
$codeText = $ScriptBlock.ToString()
$tokens = @(ParseCodeIntoTokens -CodeText $codeText)
for ($i = 0; $i -lt $tokens.Count; $i++) {
$token = $tokens[$i]
$type = $token.Type
if ($type -eq [System.Management.Automation.PSTokenType]::Command -and
(IsSetupOrTeardownCommand -CommandName $token.Content)) {
$openBraceIndex, $closeBraceIndex = Get-BraceIndicesForCommand -Tokens $tokens -CommandIndex $i
$block = Get-ScriptBlockFromTokens -Tokens $Tokens -OpenBraceIndex $openBraceIndex -CloseBraceIndex $closeBraceIndex -CodeText $codeText
Add-SetupOrTeardownScriptBlock -CommandName $token.Content -ScriptBlock $block
$i = $closeBraceIndex
}
elseif ($type -eq [System.Management.Automation.PSTokenType]::GroupStart) {
# We don't want to parse Setup or Teardown commands in child scopes here, so anything
# bounded by a GroupStart / GroupEnd token pair which is not immediately preceded by
# a setup / teardown command name is ignored.
$i = Get-GroupCloseTokenIndex -Tokens $tokens -GroupStartTokenIndex $i
}
}
}
function ParseCodeIntoTokens {
param ([string] $CodeText)
$parseErrors = $null
$tokens = [System.Management.Automation.PSParser]::Tokenize($CodeText, [ref] $parseErrors)
if ($parseErrors.Count -gt 0) {
$currentScope = $pester.CurrentTestGroup.Hint
if (-not $currentScope) {
$currentScope = 'test group'
}
throw "The current $currentScope block contains syntax errors."
}
return $tokens
}
function IsSetupOrTeardownCommand {
param ([string] $CommandName)
return (IsSetupCommand -CommandName $CommandName) -or (IsTeardownCommand -CommandName $CommandName)
}
function IsSetupCommand {
param ([string] $CommandName)
return $CommandName -eq 'BeforeEach' -or $CommandName -eq 'BeforeAll'
}
function IsTeardownCommand {
param ([string] $CommandName)
return $CommandName -eq 'AfterEach' -or $CommandName -eq 'AfterAll'
}
function IsTestGroupCommand {
param ([string] $CommandName)
return $CommandName -eq 'BeforeAll' -or $CommandName -eq 'AfterAll'
}
function Get-BraceIndicesForCommand {
param (
[System.Management.Automation.PSToken[]] $Tokens,
[int] $CommandIndex
)
$openingGroupTokenIndex = Get-GroupStartTokenForCommand -Tokens $Tokens -CommandIndex $CommandIndex
$closingGroupTokenIndex = Get-GroupCloseTokenIndex -Tokens $Tokens -GroupStartTokenIndex $openingGroupTokenIndex
return $openingGroupTokenIndex, $closingGroupTokenIndex
}
function Get-GroupStartTokenForCommand {
param (
[System.Management.Automation.PSToken[]] $Tokens,
[int] $CommandIndex
)
$commandName = $Tokens[$CommandIndex].Content
# gets ScriptBlock from positional parameter e.g. BeforeEach { <code> }
if ($CommandIndex + 1 -lt $tokens.Count -and
($tokens[$CommandIndex + 1].Type -eq [System.Management.Automation.PSTokenType]::GroupStart -or
$tokens[$CommandIndex + 1].Content -eq '{')) {
return $CommandIndex + 1
}
# gets ScriptBlock from named parameter e.g. BeforeEach -ScriptBlock { <code> }
if ($CommandIndex + 2 -lt $tokens.Count -and
($tokens[$CommandIndex + 2].Type -eq [System.Management.Automation.PSTokenType]::GroupStart -or
$tokens[$CommandIndex + 2].Content -eq '{')) {
return $CommandIndex + 2
}
throw "The $commandName command must be followed by the script block as the first argument or named parameter value."
}
& $SafeCommands['Add-Type'] -TypeDefinition @'
namespace Pester
{
using System;
using System.Management.Automation;
public static class ClosingBraceFinder
{
public static int GetClosingBraceIndex(PSToken[] tokens, int startIndex)
{
int groupLevel = 1;
int len = tokens.Length;
for (int i = startIndex + 1; i < len; i++)
{
PSTokenType type = tokens[i].Type;
if (type == PSTokenType.GroupStart)
{
groupLevel++;
}
else if (type == PSTokenType.GroupEnd)
{
groupLevel--;
if (groupLevel <= 0) { return i; }
}
}
return -1;
}
}
}
'@
function Get-GroupCloseTokenIndex {
param (
[System.Management.Automation.PSToken[]] $Tokens,
[int] $GroupStartTokenIndex
)
$closeIndex = [Pester.ClosingBraceFinder]::GetClosingBraceIndex($Tokens, $GroupStartTokenIndex)
if ($closeIndex -lt 0) {
throw 'No corresponding GroupEnd token was found.'
}
return $closeIndex
}
function Get-ScriptBlockFromTokens {
param (
[System.Management.Automation.PSToken[]] $Tokens,
[int] $OpenBraceIndex,
[int] $CloseBraceIndex,
[string] $CodeText
)
$blockStart = $Tokens[$OpenBraceIndex + 1].Start
$blockLength = $Tokens[$CloseBraceIndex].Start - $blockStart
$setupOrTeardownCodeText = $codeText.Substring($blockStart, $blockLength)
$scriptBlock = [scriptblock]::Create($setupOrTeardownCodeText)
Set-ScriptBlockHint -Hint "Unbound ScriptBlock from Get-ScriptBlockFromTokens" -ScriptBlock $scriptBlock
Set-ScriptBlockScope -ScriptBlock $scriptBlock -SessionState $pester.SessionState
return $scriptBlock
}
function Add-SetupOrTeardownScriptBlock {
param (
[string] $CommandName,
[scriptblock] $ScriptBlock
)
$Pester.AddSetupOrTeardownBlock($ScriptBlock, $CommandName)
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUqIaObdWMQcKsTArM41YKB8d/
# cLCgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQQDExdEaWdpQ2VydCBUaW1lc3RhbXAgMjAyMTCCASIwDQYJKoZIhvcN
# AQEBBQADggEPADCCAQoCggE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gdzWFiA1GwtQqyfdf32P7
# OQoaUgXoxdt3RCTzGe3D25r2n+yIpFOEtMM5l9R16HtOIJbDvE+KdpGLE0bwxtUD
# Ii58P7O+S0mwulP9wcIqD04WPkzasL1kbfaiSdiEFu4n+FHKkYSwMUauXmpPWGcy
# 1TDN1uPZAPDz/HN28xEJUMn9zm1DSQIF/tZvULKKgc0fcEYv19KDOjCiBfq3QqGC
# AjAwggIsBgkqhkiG9w0BCQYxggIdMIICGQIBATCBhjByMQswCQYDVQQGEwJVUzEV
# MBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29t
# MTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgVGltZXN0YW1waW5n
# IENBAhANQkrgvjqI/2BAIc4UAPDdMA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyODA2WjAv
# BgkqhkiG9w0BCQQxIgQg8iY8dIMka4xMsrdCBr0vgO2ahX7IIhhhAqImxMQhM4kw
# DQYJKoZIhvcNAQEBBQAEggEAn8rvQHixL1qE6V2na39/1AUZqZmLe9F3nPNl72Ca
# nzw8yLpZ16VZ5kKyfdvDLHXvLaL5HMWHE7MqsF6Ok6uOVqED3EPpMKRDXqPSEjZg
# QQkfQoM5WScg+j5vCpzGk/DOt6V78j5P1HRwVbOACOrJ/sRE7HJgZI0gpB5QtUxl
# Bin0HcCluNPm4Ox9bGDX5zZwM7+5+RiinY0SoWUGBGfJnOlv/XkPfh2mXj08blKH
# GWGBvMow4DgPLPRaL4GwtzKFTf6j3NAGYxnWFy9gDRu3ht5E9rrTdS9/Iq6lUBUS
# Gvc9mMnAvo0PG2CNE3kitTHPsar0slEd+uHf27o0b5vESg==
# SIG # End signature block
#
function New-TestDrive ([Switch]$PassThru, [string] $Path) {
if ($Path -notmatch '\S') {
$directory = New-RandomTempDirectory
}
else {
if (-not (& $SafeCommands['Test-Path'] -Path $Path)) {
$null = & $SafeCommands['New-Item'] -ItemType Container -Path $Path
}
$directory = & $SafeCommands['Get-Item'] $Path
}
$DriveName = "TestDrive"
#setup the test drive
if ( -not (& $SafeCommands['Test-Path'] "${DriveName}:\") ) {
$null = & $SafeCommands['New-PSDrive'] -Name $DriveName -PSProvider FileSystem -Root $directory -Scope Global -Description "Pester test drive"
}
#publish the global TestDrive variable used in few places within the module
if (-not (& $SafeCommands['Test-Path'] "Variable:Global:$DriveName")) {
& $SafeCommands['New-Variable'] -Name $DriveName -Scope Global -Value $directory
}
if ( $PassThru ) {
& $SafeCommands['Get-PSDrive'] -Name $DriveName
}
}
function Clear-TestDrive ([String[]]$Exclude) {
$Path = (& $SafeCommands['Get-PSDrive'] -Name TestDrive).Root
if (& $SafeCommands['Test-Path'] -Path $Path ) {
Remove-TestDriveSymbolicLinks -Path $Path
#Get-ChildItem -Exclude did not seem to work with full paths
& $SafeCommands['Get-ChildItem'] -Recurse -Path $Path |
& $SafeCommands['Sort-Object'] -Descending -Property "FullName" |
& $SafeCommands['Where-Object'] { $Exclude -NotContains $_.FullName } |
& $SafeCommands['Remove-Item'] -Force -Recurse
}
}
function New-RandomTempDirectory {
do {
$tempPath = Get-TempDirectory
$Path = & $SafeCommands['Join-Path'] -Path $tempPath -ChildPath ([Guid]::NewGuid())
} until (-not (& $SafeCommands['Test-Path'] -Path $Path ))
& $SafeCommands['New-Item'] -ItemType Container -Path $Path
}
function Get-TestDriveItem {
<#
.SYNOPSIS
The Get-TestDriveItem cmdlet gets the item in Pester test drive.
.DESCRIPTION
The Get-TestDriveItem cmdlet gets the item in Pester test drive. It does not
get the contents of the item at the location unless you use a wildcard
character (*) to request all the contents of the item.
The function Get-TestDriveItem is deprecated since Pester v. 4.0
and will be deleted in the next major version of Pester.
.PARAMETER Path
Specifies the path to an item. The path need to be relative to TestDrive:.
This cmdlet gets the item at the specified location. Wildcards are permitted.
This parameter is required, but the parameter name ("Path") is optional.
.EXAMPLE
Get-TestDriveItem MyTestFolder\MyTestFile.txt
This command returns the file MyTestFile.txt located in the folder MyTestFolder
what is located under TestDrive.
.LINK
https://pester.dev/docs/usage/testdrive
#>
#moved here from Pester.psm1
param ([string]$Path)
& $SafeCommands['Write-Warning'] -Message "The function Get-TestDriveItem is deprecated since Pester 4.0.0 and will be removed from Pester 5.0.0."
Assert-DescribeInProgress -CommandName Get-TestDriveItem
& $SafeCommands['Get-Item'] $(& $SafeCommands['Join-Path'] $TestDrive $Path )
}
function Get-TestDriveChildItem {
$Path = (& $SafeCommands['Get-PSDrive'] -Name TestDrive).Root
if (& $SafeCommands['Test-Path'] -Path $Path ) {
& $SafeCommands['Get-ChildItem'] -Recurse -Path $Path
}
}
function Remove-TestDriveSymbolicLinks ([String] $Path) {
# remove symbolic links to work around problem with Remove-Item.
# see https://github.com/PowerShell/PowerShell/issues/621
# https://github.com/pester/Pester/issues/1100
# powershell 5 and higher
# & $SafeCommands["Get-ChildItem"] -Recurse -Path $Path -Attributes "ReparsePoint" |
# % { $_.Delete() }
# issue 621 was fixed before PowerShell 6.1
# now there is an issue with calling the Delete method in recent (6.1) builds of PowerShell
if ( (GetPesterPSVersion) -ge 6) {
return
}
# powershell 2-compatible
$reparsePoint = [System.IO.FileAttributes]::ReparsePoint
& $SafeCommands["Get-ChildItem"] -Recurse -Path $Path |
where-object { ($_.Attributes -band $reparsePoint) -eq $reparsePoint } |
foreach-object { $_.Delete() }
}
function Remove-TestDrive {
$DriveName = "TestDrive"
$Drive = & $SafeCommands['Get-PSDrive'] -Name $DriveName -ErrorAction $script:IgnoreErrorPreference
$Path = ($Drive).Root
if ($pwd -like "$DriveName*" ) {
#will staying in the test drive cause issues?
#TODO review this
& $SafeCommands['Write-Warning'] -Message "Your current path is set to ${pwd}:. You should leave ${DriveName}:\ before leaving Describe."
}
if ( $Drive ) {
$Drive | & $SafeCommands['Remove-PSDrive'] -Force #This should fail explicitly as it impacts future pester runs
}
if ($null -ne $Path) {
Remove-TestDriveSymbolicLinks -Path $Path
if (& $SafeCommands['Test-Path'] -Path $Path) {
& $SafeCommands['Remove-Item'] -Path $Path -Force -Recurse
}
}
if (& $SafeCommands['Get-Variable'] -Name $DriveName -Scope Global -ErrorAction $script:IgnoreErrorPreference) {
& $SafeCommands['Remove-Variable'] -Scope Global -Name $DriveName -Force
}
}
function Setup {
<#
.SYNOPSIS
This command is included in the Pester Mocking framework for backwards compatibility. You do not need to call it directly.
#>
param(
[switch]$Dir,
[switch]$File,
$Path,
$Content = "",
[switch]$PassThru
)
Assert-DescribeInProgress -CommandName Setup
$TestDriveName = & $SafeCommands['Get-PSDrive'] TestDrive |
& $SafeCommands['Select-Object'] -ExpandProperty Root
if ($Dir) {
$item = & $SafeCommands['New-Item'] -Name $Path -Path "${TestDriveName}\" -Type Container -Force
}
if ($File) {
$item = $Content | & $SafeCommands['New-Item'] -Name $Path -Path "${TestDriveName}\" -Type File -Force
}
if ($PassThru) {
return $item
}
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUOPK5Jh9Bodvb7spFABNZk9jc
# LCmgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ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opSGVx/qZQKNKTpuAZ0Xg==
# SIG # End signature block
function New-TestRegistry {
param(
[Switch]
$PassThru,
[string]
$Path
)
if ($Path -notmatch '\S') {
$directory = New-RandomTempRegistry
}
else {
if (-not (& $SafeCommands['Test-Path'] -Path $Path)) {
# the pester registry root path HKCU:\Pester is created once
# and then stays in place, in TestDrive we use system Temp folder,
# but no such folder exists for registry so we create our own.
# removing the folder after test run would be possible but we potentially
# running into conflict with other instance of Pester that is running
# so keeping it in place is a small price to pay for being able to run
# parallel pester sessions easily.
# Also don't use -Force parameter here
# because that deletes the folder and creates a race condition see
# https://github.com/pester/Pester/issues/1181
$null = & $SafeCommands['New-Item'] -Path $Path
}
$directory = & $SafeCommands['Get-Item'] $Path
}
$DriveName = "TestRegistry"
#setup the test drive
if ( -not (& $SafeCommands['Test-Path'] "${DriveName}:\") ) {
try {
$null = & $SafeCommands['New-PSDrive'] -Name $DriveName -PSProvider Registry -Root $directory -Scope Global -Description "Pester test registry" -ErrorAction Stop
}
catch {
if ($_.FullyQualifiedErrorId -like 'DriveAlreadyExists*') {
# it can happen that Test-Path reports false even though the drive
# exists. I don't know why but I see it in "Context Teardown fails"
# it would be possible to use Get-PsDrive directly for the test but it
# is about 10ms slower and we do it in every Describe and It so it would
# quickly add up
# so if that happens just ignore the error, the goal of this function is to
# create the testdrive and the testdrive already exists, so all is good.
}
else {
Write-Error $_ -ErrorAction 'Stop'
}
}
}
if ( $PassThru ) {
& $SafeCommands['Get-PSDrive'] -Name $DriveName
}
}
function Get-TestRegistryPath () {
"Microsoft.PowerShell.Core\Registry::" + (& $SafeCommands['Get-PSDrive'] -Name TestRegistry -ErrorAction Stop).Root
}
function Clear-TestRegistry {
param(
[String[]]
$Exclude
)
# if the setup fails before we mark test registry added
# we would be trying to teardown something that does not
# exist and fail in Get-TestRegistryPath
if (-not (& $SafeCommands['Test-Path'] "TestRegistry:\")) {
return
}
$path = Get-TestRegistryPath
if ($null -ne $path -and (& $SafeCommands['Test-Path'] -Path $Path)) {
#Get-ChildItem -Exclude did not seem to work with full paths
& $SafeCommands['Get-ChildItem'] -Recurse -Path $Path |
& $SafeCommands['Sort-Object'] -Descending -Property 'PSPath' |
& $SafeCommands['Where-Object'] { $Exclude -NotContains $_.PSPath } |
& $SafeCommands['Remove-Item'] -Force -Recurse
}
}
function Get-TestRegistryChildItem {
$path = Get-TestRegistryPath
& $SafeCommands['Get-ChildItem'] -Recurse -Path $path
}
function New-RandomTempRegistry {
do {
$tempPath = Get-TempRegistry
$Path = & $SafeCommands['Join-Path'] -Path $tempPath -ChildPath ([Guid]::NewGuid())
} until (-not (& $SafeCommands['Test-Path'] -Path $Path ))
try {
& $SafeCommands['New-Item'] -Path $Path
}
catch [System.IO.IOException] {
# when running in parallel this occasionally triggers
# IOException: No more data is available
# let's just retry the operation
& $SafeCommands['New-Item'] -Path $Path
}
}
function Remove-TestRegistry {
$DriveName = "TestRegistry"
$Drive = & $SafeCommands['Get-PSDrive'] -Name $DriveName -ErrorAction $script:IgnoreErrorPreference
if ($null -eq $Drive) {
# the drive does not exist, someone must have removed it instead of us,
# most likely a test that tests pester itself, so we just hope that the
# one who removed this removed also the contents of it correctly
return
}
$path = Get-TestRegistryPath
if ($pwd -like "$DriveName*" ) {
#will staying in the test drive cause issues?
#TODO review this
& $SafeCommands['Write-Warning'] -Message "Your current path is set to ${pwd}:. You should leave ${DriveName}:\ before leaving Describe."
}
if ( $Drive ) {
$Drive | & $SafeCommands['Remove-PSDrive'] -Force #This should fail explicitly as it impacts future pester runs
}
if (& $SafeCommands['Test-Path'] -Path $path) {
& $SafeCommands['Remove-Item'] -Path $path -Force -Recurse
}
if (& $SafeCommands['Get-Variable'] -Name $DriveName -Scope Global -ErrorAction $script:IgnoreErrorPreference) {
& $SafeCommands['Remove-Variable'] -Scope Global -Name $DriveName -Force
}
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWz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xDxcNMjEwNTI5MTIyODA2WjAv
# BgkqhkiG9w0BCQQxIgQg3hRCIVw1XUyOm8S+xUHLRviCAWanEz2IrQGpKb3Rl3Mw
# DQYJKoZIhvcNAQEBBQAEggEARwALUx0YNkCPFZ6RbXvLPrfJ3xHHHuj8EhMaCEY5
# vADFdy12X5Eq0vbZuoH/QkN9jm3hixJ9+MvvwgQKOfik9rrAtsP7uipJxVcgX6j5
# lhijrhQr6Vu5UK8VNLg8t4/XFzLcFQLgjWWylNvgeGaaTVdAYQ7QmQhBJCbB1wul
# 596z1oCwMLzc60hR8d0ArHCGpHFzg+rIYXiLu5NEmLzG1Tm2J8HjP2mN6EGRVN1X
# hSA4YNto19Mxb69mF7nbsQWmNJQqTgWL7UVxsQmvTqgX8Mfwko9IZNycj7uZVNfO
# tv8TxSD5xU+u6DD5DRsQ6AFNs/gnO6WvUeEFBUbNR4cS6w==
# SIG # End signature block
function Get-HumanTime($Seconds) {
if ($Seconds -gt 0.99) {
$time = [math]::Round($Seconds, 2)
$unit = 's'
}
else {
$time = [math]::Floor($Seconds * 1000)
$unit = 'ms'
}
return "$time$unit"
}
function GetFullPath ([string]$Path) {
$Folder = & $SafeCommands['Split-Path'] -Path $Path -Parent
$File = & $SafeCommands['Split-Path'] -Path $Path -Leaf
if ( -not ([String]::IsNullOrEmpty($Folder))) {
$FolderResolved = & $SafeCommands['Resolve-Path'] -Path $Folder
}
else {
$FolderResolved = & $SafeCommands['Resolve-Path'] -Path $ExecutionContext.SessionState.Path.CurrentFileSystemLocation
}
$Path = & $SafeCommands['Join-Path'] -Path $FolderResolved.ProviderPath -ChildPath $File
return $Path
}
function Export-PesterResults {
param (
$PesterState,
[string] $Path,
[string] $Format
)
switch -Wildcard ($Format) {
'*Xml' {
Export-XmlReport -PesterState $PesterState -Path $Path -Format $Format
}
default {
throw "'$Format' is not a valid Pester export format."
}
}
}
function Export-XmlReport {
param (
[parameter(Mandatory = $true, ValueFromPipeline = $true)]
$PesterState,
[parameter(Mandatory = $true)]
[String] $Path,
[parameter(Mandatory = $true)]
[ValidateSet('NUnitXml', 'JUnitXml')]
[string] $Format
)
#the xmlwriter create method can resolve relatives paths by itself. but its current directory might
#be different from what PowerShell sees as the current directory so I have to resolve the path beforehand
#working around the limitations of Resolve-Path
$Path = GetFullPath -Path $Path
$settings = & $SafeCommands['New-Object'] -TypeName Xml.XmlWriterSettings -Property @{
Indent = $true
NewLineOnAttributes = $false
}
$xmlFile = $null
$xmlWriter = $null
try {
$xmlFile = [IO.File]::Create($Path)
$xmlWriter = [Xml.XmlWriter]::Create($xmlFile, $settings)
switch ($Format) {
'NUnitXml' {
Write-NUnitReport -XmlWriter $xmlWriter -PesterState $PesterState
}
'JUnitXml' {
Write-JUnitReport -XmlWriter $xmlWriter -PesterState $PesterState
}
}
$xmlWriter.Flush()
$xmlFile.Flush()
}
finally {
if ($null -ne $xmlWriter) {
try {
$xmlWriter.Close()
}
catch {
}
}
if ($null -ne $xmlFile) {
try {
$xmlFile.Close()
}
catch {
}
}
}
}
function Write-NUnitReport($PesterState, [System.Xml.XmlWriter] $XmlWriter) {
# Write the XML Declaration
$XmlWriter.WriteStartDocument($false)
# Write Root Element
$xmlWriter.WriteStartElement('test-results')
Write-NUnitTestResultAttributes @PSBoundParameters
Write-NUnitTestResultChildNodes @PSBoundParameters
$XmlWriter.WriteEndElement()
}
function Write-NUnitTestResultAttributes($PesterState, [System.Xml.XmlWriter] $XmlWriter) {
$XmlWriter.WriteAttributeString('xmlns', 'xsi', $null, 'http://www.w3.org/2001/XMLSchema-instance')
$XmlWriter.WriteAttributeString('xsi', 'noNamespaceSchemaLocation', [Xml.Schema.XmlSchema]::InstanceNamespace , 'nunit_schema_2.5.xsd')
$XmlWriter.WriteAttributeString('name', 'Pester')
$XmlWriter.WriteAttributeString('total', ($PesterState.TotalCount - $PesterState.SkippedCount))
$XmlWriter.WriteAttributeString('errors', '0')
$XmlWriter.WriteAttributeString('failures', $PesterState.FailedCount)
$XmlWriter.WriteAttributeString('not-run', '0')
$XmlWriter.WriteAttributeString('inconclusive', $PesterState.PendingCount + $PesterState.InconclusiveCount)
$XmlWriter.WriteAttributeString('ignored', $PesterState.SkippedCount)
$XmlWriter.WriteAttributeString('skipped', '0')
$XmlWriter.WriteAttributeString('invalid', '0')
$date = & $SafeCommands['Get-Date']
$XmlWriter.WriteAttributeString('date', (& $SafeCommands['Get-Date'] -Date $date -Format 'yyyy-MM-dd'))
$XmlWriter.WriteAttributeString('time', (& $SafeCommands['Get-Date'] -Date $date -Format 'HH:mm:ss'))
}
function Write-NUnitTestResultChildNodes($PesterState, [System.Xml.XmlWriter] $XmlWriter) {
Write-NUnitEnvironmentInformation @PSBoundParameters
Write-NUnitCultureInformation @PSBoundParameters
$suiteInfo = Get-TestSuiteInfo -TestSuite $PesterState -TestSuiteName $PesterState.TestSuiteName
$XmlWriter.WriteStartElement('test-suite')
Write-NUnitTestSuiteAttributes -TestSuiteInfo $suiteInfo -XmlWriter $XmlWriter
$XmlWriter.WriteStartElement('results')
foreach ($action in $PesterState.TestActions.Actions) {
Write-NUnitTestSuiteElements -XmlWriter $XmlWriter -Node $action
}
$XmlWriter.WriteEndElement()
$XmlWriter.WriteEndElement()
}
function Write-NUnitEnvironmentInformation($PesterState, [System.Xml.XmlWriter] $XmlWriter) {
$XmlWriter.WriteStartElement('environment')
$environment = Get-RunTimeEnvironment
foreach ($keyValuePair in $environment.GetEnumerator()) {
if ($keyValuePair.Name -eq 'junit-version') {
continue
}
$XmlWriter.WriteAttributeString($keyValuePair.Name, $keyValuePair.Value)
}
$XmlWriter.WriteEndElement()
}
function Write-NUnitCultureInformation($PesterState, [System.Xml.XmlWriter] $XmlWriter) {
$XmlWriter.WriteStartElement('culture-info')
$XmlWriter.WriteAttributeString('current-culture', ([System.Threading.Thread]::CurrentThread.CurrentCulture).Name)
$XmlWriter.WriteAttributeString('current-uiculture', ([System.Threading.Thread]::CurrentThread.CurrentUiCulture).Name)
$XmlWriter.WriteEndElement()
}
function Write-NUnitTestSuiteElements($Node, [System.Xml.XmlWriter] $XmlWriter, [string] $Path) {
$suiteInfo = Get-TestSuiteInfo $Node
$XmlWriter.WriteStartElement('test-suite')
Write-NUnitTestSuiteAttributes -TestSuiteInfo $suiteInfo -XmlWriter $XmlWriter
$XmlWriter.WriteStartElement('results')
$separator = if ($Path) {
'.'
}
else {
''
}
$newName = if ($Node.Hint -ne 'Script') {
$suiteInfo.Name
}
else {
''
}
$newPath = "${Path}${separator}${newName}"
foreach ($action in $Node.Actions) {
if ($action.Type -eq 'TestGroup') {
Write-NUnitTestSuiteElements -Node $action -XmlWriter $XmlWriter -Path $newPath
}
}
$suites = @(
$Node.Actions |
& $SafeCommands['Where-Object'] { $_.Type -eq 'TestCase' } |
& $SafeCommands['Group-Object'] -Property ParameterizedSuiteName
)
foreach ($suite in $suites) {
if ($suite.Name) {
$parameterizedSuiteInfo = Get-ParameterizedTestSuiteInfo -TestSuiteGroup $suite
$XmlWriter.WriteStartElement('test-suite')
Write-NUnitTestSuiteAttributes -TestSuiteInfo $parameterizedSuiteInfo -TestSuiteType 'ParameterizedTest' -XmlWriter $XmlWriter -Path $newPath
$XmlWriter.WriteStartElement('results')
}
foreach ($testCase in $suite.Group) {
Write-NUnitTestCaseElement -TestResult $testCase -XmlWriter $XmlWriter -Path $newPath -ParameterizedSuiteName $suite.Name
}
if ($suite.Name) {
$XmlWriter.WriteEndElement()
$XmlWriter.WriteEndElement()
}
}
$XmlWriter.WriteEndElement()
$XmlWriter.WriteEndElement()
}
function Write-JUnitReport($PesterState, [System.Xml.XmlWriter] $XmlWriter) {
# Write the XML Declaration
$XmlWriter.WriteStartDocument($false)
# Write Root Element
$xmlWriter.WriteStartElement('testsuites')
Write-JUnitTestResultAttributes @PSBoundParameters
$testSuiteNumber = 0
foreach ($action in $PesterState.TestActions.Actions) {
Write-JUnitTestSuiteElements -XmlWriter $XmlWriter -Node $action -Id $testSuiteNumber
$testSuiteNumber++
}
$XmlWriter.WriteEndElement()
}
function Write-JUnitTestResultAttributes($PesterState, [System.Xml.XmlWriter] $XmlWriter) {
$XmlWriter.WriteAttributeString('xmlns', 'xsi', $null, 'http://www.w3.org/2001/XMLSchema-instance')
$XmlWriter.WriteAttributeString('xsi', 'noNamespaceSchemaLocation', [Xml.Schema.XmlSchema]::InstanceNamespace , 'junit_schema_4.xsd')
$XmlWriter.WriteAttributeString('name', $PesterState.TestSuiteName)
$XmlWriter.WriteAttributeString('tests', $PesterState.PassedCount)
$XmlWriter.WriteAttributeString('errors', '0')
$XmlWriter.WriteAttributeString('failures', $PesterState.FailedCount)
$XmlWriter.WriteAttributeString('disabled', $PesterState.PendingCount + $PesterState.InconclusiveCount + $PesterState.SkippedCount)
$XmlWriter.WriteAttributeString('time', ($PesterState.Time.TotalSeconds.ToString('0.000', [System.Globalization.CultureInfo]::InvariantCulture)))
}
function Write-JUnitTestSuiteElements($Node, [System.Xml.XmlWriter] $XmlWriter, [uint16] $Id) {
$XmlWriter.WriteStartElement('testsuite')
Write-JUnitTestSuiteAttributes -Action $Node -XmlWriter $XmlWriter -Package $Node.Name -Id $Id
$testCases = foreach ($al1 in $node.Actions) {
if ($al1.Type -ne 'TestCase') {
foreach ($al2 in $al1.Actions) {
if ($al2.Type -ne 'TestCase') {
foreach ($alt3 in $al2.Actions) {
$path = "$($al1.Name).$($al2.Name).$($alt3.Name)"
$alt3 | Add-Member -PassThru -MemberType NoteProperty -Name Path -Value $path
}
}
else {
$path = "$($al1.Name).$($al2.Name)"
$al2 | Add-Member -PassThru -MemberType NoteProperty -Name Path -Value $path
}
}
}
else {
$path = "$($al1.Name)"
$al1 | Add-Member -PassThru -MemberType NoteProperty -Name Path -Value $path
}
}
foreach ($t in $testCases) {
Write-JUnitTestCaseElements -Action $t -XmlWriter $XmlWriter -Package $Node.Name
}
$XmlWriter.WriteEndElement()
}
function Write-JUnitTestSuiteAttributes($Action, [System.Xml.XmlWriter] $XmlWriter, [string] $Package, [uint16] $Id) {
$environment = Get-RunTimeEnvironment
$XmlWriter.WriteAttributeString('name', $Action.Name)
$XmlWriter.WriteAttributeString('tests', $Action.TotalCount)
$XmlWriter.WriteAttributeString('errors', '0')
$XmlWriter.WriteAttributeString('failures', $Action.FailedCount)
$XmlWriter.WriteAttributeString('hostname', $environment.'machine-name')
$XmlWriter.WriteAttributeString('id', $Id)
$XmlWriter.WriteAttributeString('skipped', $Action.SkippedCount)
$XmlWriter.WriteAttributeString('disabled', $Action.InconclusiveCount + $Action.PendingCount)
$XmlWriter.WriteAttributeString('package', $Package)
$XmlWriter.WriteAttributeString('time', $Action.Time.TotalSeconds.ToString('0.000', [System.Globalization.CultureInfo]::InvariantCulture))
$XmlWriter.WriteStartElement('properties')
foreach ($keyValuePair in $environment.GetEnumerator()) {
if ($keyValuePair.Name -eq 'nunit-version') {
continue
}
$XmlWriter.WriteStartElement('property')
$XmlWriter.WriteAttributeString('name', $keyValuePair.Name)
$XmlWriter.WriteAttributeString('value', $keyValuePair.Value)
$XmlWriter.WriteEndElement()
}
$XmlWriter.WriteEndElement()
}
function Write-JUnitTestCaseElements($Action, [System.Xml.XmlWriter] $XmlWriter, [string] $Package) {
$XmlWriter.WriteStartElement('testcase')
Write-JUnitTestCaseAttributes -Action $Action -XmlWriter $XmlWriter -ClassName $Package
$XmlWriter.WriteEndElement()
}
function Write-JUnitTestCaseAttributes($Action, [System.Xml.XmlWriter] $XmlWriter, [string] $ClassName) {
$XmlWriter.WriteAttributeString('name', $Action.Path)
$statusElementName = switch ($Action.Result) {
Passed {
$null
}
Failed {
'failure'
}
default {
'skipped'
}
}
$XmlWriter.WriteAttributeString('status', $Action.Result)
$XmlWriter.WriteAttributeString('classname', $ClassName)
$XmlWriter.WriteAttributeString('assertions', '0')
$XmlWriter.WriteAttributeString('time', $Action.Time.TotalSeconds.ToString('0.000', [System.Globalization.CultureInfo]::InvariantCulture))
if ($null -ne $statusElementName) {
Write-JUnitTestCaseMessageElements -Action $Action -XmlWriter $XmlWriter -StatusElementName $statusElementName
}
}
function Write-JUnitTestCaseMessageElements($Action, [System.Xml.XmlWriter] $XmlWriter, [string] $StatusElementName) {
$XmlWriter.WriteStartElement($StatusElementName)
$XmlWriter.WriteAttributeString('message', $Action.FailureMessage) #TODO: Add stacktrace
$XmlWriter.WriteEndElement()
}
function Get-ParameterizedTestSuiteInfo ([Microsoft.PowerShell.Commands.GroupInfo] $TestSuiteGroup) {
$node = & $SafeCommands['New-Object'] psobject -Property @{
Name = $TestSuiteGroup.Name
TotalCount = 0
Time = [timespan]0
PassedCount = 0
FailedCount = 0
SkippedCount = 0
PendingCount = 0
InconclusiveCount = 0
}
foreach ($testCase in $TestSuiteGroup.Group) {
$node.TotalCount++
switch ($testCase.Result) {
Passed {
$Node.PassedCount++; break;
}
Failed {
$Node.FailedCount++; break;
}
Skipped {
$Node.SkippedCount++; break;
}
Pending {
$Node.PendingCount++; break;
}
Inconclusive {
$Node.InconclusiveCount++; break;
}
}
$Node.Time += $testCase.Time
}
return Get-TestSuiteInfo -TestSuite $node
}
function Get-TestSuiteInfo ($TestSuite, $TestSuiteName) {
if (-not $PSBoundParameters.ContainsKey('TestSuiteName')) {
$TestSuiteName = $TestSuite.Name
}
$suite = @{
resultMessage = 'Failure'
success = if ($TestSuite.FailedCount -eq 0) {
'True'
}
else {
'False'
}
totalTime = Convert-TimeSpan $TestSuite.Time
name = $TestSuiteName
description = $TestSuiteName
}
$suite.resultMessage = Get-GroupResult $TestSuite
$suite
}
function Get-TestTime($tests) {
[TimeSpan]$totalTime = 0;
if ($tests) {
foreach ($test in $tests) {
$totalTime += $test.time
}
}
Convert-TimeSpan -TimeSpan $totalTime
}
function Convert-TimeSpan {
param (
[Parameter(ValueFromPipeline = $true)]
$TimeSpan
)
process {
if ($TimeSpan) {
[string][math]::round(([TimeSpan]$TimeSpan).totalseconds, 4)
}
else {
'0'
}
}
}
function Get-TestSuccess($tests) {
$result = $true
if ($tests) {
foreach ($test in $tests) {
if (-not $test.Passed) {
$result = $false
break
}
}
}
[String]$result
}
function Write-NUnitTestSuiteAttributes($TestSuiteInfo, [string] $TestSuiteType = 'TestFixture', [System.Xml.XmlWriter] $XmlWriter, [string] $Path) {
$name = $TestSuiteInfo.Name
if ($TestSuiteType -eq 'ParameterizedTest' -and $Path) {
$name = "$Path.$name"
}
$XmlWriter.WriteAttributeString('type', $TestSuiteType)
$XmlWriter.WriteAttributeString('name', $name)
$XmlWriter.WriteAttributeString('executed', 'True')
$XmlWriter.WriteAttributeString('result', $TestSuiteInfo.resultMessage)
$XmlWriter.WriteAttributeString('success', $TestSuiteInfo.success)
$XmlWriter.WriteAttributeString('time', $TestSuiteInfo.totalTime)
$XmlWriter.WriteAttributeString('asserts', '0')
$XmlWriter.WriteAttributeString('description', $TestSuiteInfo.Description)
}
function Write-NUnitTestCaseElement($TestResult, [System.Xml.XmlWriter] $XmlWriter, [string] $ParameterizedSuiteName, [string] $Path) {
$XmlWriter.WriteStartElement('test-case')
Write-NUnitTestCaseAttributes -TestResult $TestResult -XmlWriter $XmlWriter -ParameterizedSuiteName $ParameterizedSuiteName -Path $Path
$XmlWriter.WriteEndElement()
}
function Write-NUnitTestCaseAttributes($TestResult, [System.Xml.XmlWriter] $XmlWriter, [string] $ParameterizedSuiteName, [string] $Path) {
$testName = $TestResult.Name
if ($testName -eq $ParameterizedSuiteName) {
$paramString = ''
if ($null -ne $TestResult.Parameters) {
$params = @(
foreach ($value in $TestResult.Parameters.Values) {
if ($null -eq $value) {
'null'
}
elseif ($value -is [string]) {
'"{0}"' -f $value
}
else {
#do not use .ToString() it uses the current culture settings
#and we need to use en-US culture, which [string] or .ToString([Globalization.CultureInfo]'en-us') uses
[string]$value
}
}
)
$paramString = $params -join ','
}
$testName = "$testName($paramString)"
}
$separator = if ($Path) {
'.'
}
else {
''
}
$testName = "${Path}${separator}${testName}"
$XmlWriter.WriteAttributeString('description', $TestResult.Name)
$XmlWriter.WriteAttributeString('name', $testName)
$XmlWriter.WriteAttributeString('time', (Convert-TimeSpan $TestResult.Time))
$XmlWriter.WriteAttributeString('asserts', '0')
$XmlWriter.WriteAttributeString('success', $TestResult.Passed)
switch ($TestResult.Result) {
Passed {
$XmlWriter.WriteAttributeString('result', 'Success')
$XmlWriter.WriteAttributeString('executed', 'True')
break
}
Skipped {
$XmlWriter.WriteAttributeString('result', 'Ignored')
$XmlWriter.WriteAttributeString('executed', 'False')
if ($TestResult.FailureMessage) {
$XmlWriter.WriteStartElement('reason')
$xmlWriter.WriteElementString('message', $TestResult.FailureMessage)
$XmlWriter.WriteEndElement() # Close reason tag
}
break
}
Pending {
$XmlWriter.WriteAttributeString('result', 'Inconclusive')
$XmlWriter.WriteAttributeString('executed', 'True')
if ($TestResult.FailureMessage) {
$XmlWriter.WriteStartElement('reason')
$xmlWriter.WriteElementString('message', $TestResult.FailureMessage)
$XmlWriter.WriteEndElement() # Close reason tag
}
break
}
Inconclusive {
$XmlWriter.WriteAttributeString('result', 'Inconclusive')
$XmlWriter.WriteAttributeString('executed', 'True')
if ($TestResult.FailureMessage) {
$XmlWriter.WriteStartElement('reason')
$xmlWriter.WriteElementString('message', $TestResult.FailureMessage)
$XmlWriter.WriteEndElement() # Close reason tag
}
break
}
Failed {
$XmlWriter.WriteAttributeString('result', 'Failure')
$XmlWriter.WriteAttributeString('executed', 'True')
$XmlWriter.WriteStartElement('failure')
# manually replace Escape character (escape meaning "Escape key", not escape sequence "`")
# with &27 to avoid breaking serialized output when error contains it
$xmlWriter.WriteElementString('message', $TestResult.FailureMessage.Replace([string][char]27,'&27;'))
$XmlWriter.WriteElementString('stack-trace', $TestResult.StackTrace)
$XmlWriter.WriteEndElement() # Close failure tag
break
}
}
}
function Get-RunTimeEnvironment() {
# based on what we found during startup, use the appropriate cmdlet
$computerName = $env:ComputerName
$userName = $env:Username
if ($null -ne $SafeCommands['Get-CimInstance']) {
$osSystemInformation = (& $SafeCommands['Get-CimInstance'] Win32_OperatingSystem)
}
elseif ($null -ne $SafeCommands['Get-WmiObject']) {
$osSystemInformation = (& $SafeCommands['Get-WmiObject'] Win32_OperatingSystem)
}
elseif ($IsMacOS -or $IsLinux) {
$osSystemInformation = @{
Name = "Unknown"
Version = "0.0.0.0"
}
try {
if ($null -ne $SafeCommands['uname']) {
$osSystemInformation.Version = & $SafeCommands['uname'] -r
$osSystemInformation.Name = & $SafeCommands['uname'] -s
$computerName = & $SafeCommands['uname'] -n
}
if ($null -ne $SafeCommands['id']) {
$userName = & $SafeCommands['id'] -un
}
}
catch {
# well, we tried
}
}
else {
$osSystemInformation = @{
Name = "Unknown"
Version = "0.0.0.0"
}
}
if ( ($PSVersionTable.ContainsKey('PSEdition')) -and ($PSVersionTable.PSEdition -eq 'Core')) {
$CLrVersion = "Unknown"
}
else {
$CLrVersion = [string]$PSVersionTable.ClrVersion
}
@{
'nunit-version' = '2.5.8.0'
'junit-version' = '4'
'os-version' = $osSystemInformation.Version
platform = $osSystemInformation.Name
cwd = (& $SafeCommands['Get-Location']).Path #run path
'machine-name' = $computerName
user = $username
'user-domain' = $env:userDomain
'clr-version' = $CLrVersion
}
}
function Exit-WithCode ($FailedCount) {
$host.SetShouldExit($FailedCount)
}
function Get-GroupResult ($InputObject) {
#I am not sure about the result precedence, and can't find any good source
#TODO: Confirm this is the correct order of precedence
if ($inputObject.FailedCount -gt 0) {
return 'Failure'
}
if ($InputObject.SkippedCount -gt 0) {
return 'Ignored'
}
if ($InputObject.PendingCount -gt 0) {
return 'Inconclusive'
}
return 'Success'
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUgtV+hyK0BtWz5oV2vUC+tXEd
# 0HqgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMG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NkHpHSt4eKNyJv4LxwkueC/NfuyMcRZR6hNt2AKCV9edZ76e7wasJ2nQR634mE
# 4B/mkhXqInmRJsgXlvrEx3fsE+sPhPVfMLSn5bYhVOgD9WVz5P3yGw3ekfdMmu2H
# UysI9e+sUj6d6WegYfSIcgBO/8oS6w2UgX67mWpdoDXCYiTvN/rNdyebEr8BUq37
# vABJ3ac6hKx7/KTlC2tgMwxrHch2rGeczCJ284+fZdKvGA==
# SIG # End signature block
md5: 964DA2F814B4940CB94B9E08D73480A8 | sha1: 27EF3EEC7128930DABA8568B25CB471F7DDB2A1B | sha256: 35551F5CBA29C6C7CE8647D7BDD99EBAB7CC855DB0F6E4025F0CE6439B01B0FE | sha512: FADBF1A3FF940580E342365DF50554A9F6DE1B70297430DA420F6E9AA22CE48B60741D31A13589B77E18B5C6CCA2A4DCAAAD290E3DA306718362E01715C90F93
{
"af": {
"and": [
"* ",
"En "
],
"background": [
"Agtergrond"
],
"but": [
"* ",
"Maar "
],
"examples": [
"Voorbeelde"
],
"feature": [
"Funksie",
"Besigheid Behoefte",
"Vermoë"
],
"given": [
"* ",
"Gegewe "
],
"name": "Afrikaans",
"native": "Afrikaans",
"rule": [
"Regel"
],
"scenario": [
"Voorbeeld",
"Situasie"
],
"scenarioOutline": [
"Situasie Uiteensetting"
],
"then": [
"* ",
"Dan "
],
"when": [
"* ",
"Wanneer "
]
},
"am": {
"and": [
"* ",
"Եվ "
],
"background": [
"Կոնտեքստ"
],
"but": [
"* ",
"Բայց "
],
"examples": [
"Օրինակներ"
],
"feature": [
"Ֆունկցիոնալություն",
"Հատկություն"
],
"given": [
"* ",
"Դիցուք "
],
"name": "Armenian",
"native": "հայերեն",
"rule": [
"Rule"
],
"scenario": [
"Օրինակ",
"Սցենար"
],
"scenarioOutline": [
"Սցենարի կառուցվացքը"
],
"then": [
"* ",
"Ապա "
],
"when": [
"* ",
"Եթե ",
"Երբ "
]
},
"an": {
"and": [
"* ",
"Y ",
"E "
],
"background": [
"Antecedents"
],
"but": [
"* ",
"Pero "
],
"examples": [
"Eixemplos"
],
"feature": [
"Caracteristica"
],
"given": [
"* ",
"Dau ",
"Dada ",
"Daus ",
"Dadas "
],
"name": "Aragonese",
"native": "Aragonés",
"rule": [
"Rule"
],
"scenario": [
"Eixemplo",
"Caso"
],
"scenarioOutline": [
"Esquema del caso"
],
"then": [
"* ",
"Alavez ",
"Allora ",
"Antonces "
],
"when": [
"* ",
"Cuan "
]
},
"ar": {
"and": [
"* ",
"و "
],
"background": [
"الخلفية"
],
"but": [
"* ",
"لكن "
],
"examples": [
"امثلة"
],
"feature": [
"خاصية"
],
"given": [
"* ",
"بفرض "
],
"name": "Arabic",
"native": "العربية",
"rule": [
"Rule"
],
"scenario": [
"مثال",
"سيناريو"
],
"scenarioOutline": [
"سيناريو مخطط"
],
"then": [
"* ",
"اذاً ",
"ثم "
],
"when": [
"* ",
"متى ",
"عندما "
]
},
"ast": {
"and": [
"* ",
"Y ",
"Ya "
],
"background": [
"Antecedentes"
],
"but": [
"* ",
"Peru "
],
"examples": [
"Exemplos"
],
"feature": [
"Carauterística"
],
"given": [
"* ",
"Dáu ",
"Dada ",
"Daos ",
"Daes "
],
"name": "Asturian",
"native": "asturianu",
"rule": [
"Rule"
],
"scenario": [
"Exemplo",
"Casu"
],
"scenarioOutline": [
"Esbozu del casu"
],
"then": [
"* ",
"Entós "
],
"when": [
"* ",
"Cuando "
]
},
"az": {
"and": [
"* ",
"Və ",
"Həm "
],
"background": [
"Keçmiş",
"Kontekst"
],
"but": [
"* ",
"Amma ",
"Ancaq "
],
"examples": [
"Nümunələr"
],
"feature": [
"Özəllik"
],
"given": [
"* ",
"Tutaq ki ",
"Verilir "
],
"name": "Azerbaijani",
"native": "Azərbaycanca",
"rule": [
"Rule"
],
"scenario": [
"Nümunə",
"Ssenari"
],
"scenarioOutline": [
"Ssenarinin strukturu"
],
"then": [
"* ",
"O halda "
],
"when": [
"* ",
"Əgər ",
"Nə vaxt ki "
]
},
"bg": {
"and": [
"* ",
"И "
],
"background": [
"Предистория"
],
"but": [
"* ",
"Но "
],
"examples": [
"Примери"
],
"feature": [
"Функционалност"
],
"given": [
"* ",
"Дадено "
],
"name": "Bulgarian",
"native": "български",
"rule": [
"Rule"
],
"scenario": [
"Пример",
"Сценарий"
],
"scenarioOutline": [
"Рамка на сценарий"
],
"then": [
"* ",
"То "
],
"when": [
"* ",
"Когато "
]
},
"bm": {
"and": [
"* ",
"Dan "
],
"background": [
"Latar Belakang"
],
"but": [
"* ",
"Tetapi ",
"Tapi "
],
"examples": [
"Contoh"
],
"feature": [
"Fungsi"
],
"given": [
"* ",
"Diberi ",
"Bagi "
],
"name": "Malay",
"native": "Bahasa Melayu",
"rule": [
"Rule"
],
"scenario": [
"Senario",
"Situasi",
"Keadaan"
],
"scenarioOutline": [
"Kerangka Senario",
"Kerangka Situasi",
"Kerangka Keadaan",
"Garis Panduan Senario"
],
"then": [
"* ",
"Maka ",
"Kemudian "
],
"when": [
"* ",
"Apabila "
]
},
"bs": {
"and": [
"* ",
"I ",
"A "
],
"background": [
"Pozadina"
],
"but": [
"* ",
"Ali "
],
"examples": [
"Primjeri"
],
"feature": [
"Karakteristika"
],
"given": [
"* ",
"Dato "
],
"name": "Bosnian",
"native": "Bosanski",
"rule": [
"Rule"
],
"scenario": [
"Primjer",
"Scenariju",
"Scenario"
],
"scenarioOutline": [
"Scenariju-obris",
"Scenario-outline"
],
"then": [
"* ",
"Zatim "
],
"when": [
"* ",
"Kada "
]
},
"ca": {
"and": [
"* ",
"I "
],
"background": [
"Rerefons",
"Antecedents"
],
"but": [
"* ",
"Però "
],
"examples": [
"Exemples"
],
"feature": [
"Característica",
"Funcionalitat"
],
"given": [
"* ",
"Donat ",
"Donada ",
"Atès ",
"Atesa "
],
"name": "Catalan",
"native": "català",
"rule": [
"Rule"
],
"scenario": [
"Exemple",
"Escenari"
],
"scenarioOutline": [
"Esquema de l'escenari"
],
"then": [
"* ",
"Aleshores ",
"Cal "
],
"when": [
"* ",
"Quan "
]
},
"cs": {
"and": [
"* ",
"A také ",
"A "
],
"background": [
"Pozadí",
"Kontext"
],
"but": [
"* ",
"Ale "
],
"examples": [
"Příklady"
],
"feature": [
"Požadavek"
],
"given": [
"* ",
"Pokud ",
"Za předpokladu "
],
"name": "Czech",
"native": "Česky",
"rule": [
"Pravidlo"
],
"scenario": [
"Příklad",
"Scénář"
],
"scenarioOutline": [
"Náčrt Scénáře",
"Osnova scénáře"
],
"then": [
"* ",
"Pak "
],
"when": [
"* ",
"Když "
]
},
"cy-GB": {
"and": [
"* ",
"A "
],
"background": [
"Cefndir"
],
"but": [
"* ",
"Ond "
],
"examples": [
"Enghreifftiau"
],
"feature": [
"Arwedd"
],
"given": [
"* ",
"Anrhegedig a "
],
"name": "Welsh",
"native": "Cymraeg",
"rule": [
"Rule"
],
"scenario": [
"Enghraifft",
"Scenario"
],
"scenarioOutline": [
"Scenario Amlinellol"
],
"then": [
"* ",
"Yna "
],
"when": [
"* ",
"Pryd "
]
},
"da": {
"and": [
"* ",
"Og "
],
"background": [
"Baggrund"
],
"but": [
"* ",
"Men "
],
"examples": [
"Eksempler"
],
"feature": [
"Egenskab"
],
"given": [
"* ",
"Givet "
],
"name": "Danish",
"native": "dansk",
"rule": [
"Rule"
],
"scenario": [
"Eksempel",
"Scenarie"
],
"scenarioOutline": [
"Abstrakt Scenario"
],
"then": [
"* ",
"Så "
],
"when": [
"* ",
"Når "
]
},
"de": {
"and": [
"* ",
"Und "
],
"background": [
"Grundlage",
"Hintergrund",
"Voraussetzungen",
"Vorbedingungen"
],
"but": [
"* ",
"Aber "
],
"examples": [
"Beispiele"
],
"feature": [
"Funktionalität",
"Funktion"
],
"given": [
"* ",
"Angenommen ",
"Gegeben sei ",
"Gegeben seien "
],
"name": "German",
"native": "Deutsch",
"rule": [
"Rule",
"Regel"
],
"scenario": [
"Beispiel",
"Szenario"
],
"scenarioOutline": [
"Szenariogrundriss",
"Szenarien"
],
"then": [
"* ",
"Dann "
],
"when": [
"* ",
"Wenn "
]
},
"el": {
"and": [
"* ",
"Και "
],
"background": [
"Υπόβαθρο"
],
"but": [
"* ",
"Αλλά "
],
"examples": [
"Παραδείγματα",
"Σενάρια"
],
"feature": [
"Δυνατότητα",
"Λειτουργία"
],
"given": [
"* ",
"Δεδομένου "
],
"name": "Greek",
"native": "Ελληνικά",
"rule": [
"Rule"
],
"scenario": [
"Παράδειγμα",
"Σενάριο"
],
"scenarioOutline": [
"Περιγραφή Σεναρίου",
"Περίγραμμα Σεναρίου"
],
"then": [
"* ",
"Τότε "
],
"when": [
"* ",
"Όταν "
]
},
"em": {
"and": [
"* ",
"😂"
],
"background": [
"💤"
],
"but": [
"* ",
"😔"
],
"examples": [
"📓"
],
"feature": [
"📚"
],
"given": [
"* ",
"😐"
],
"name": "Emoji",
"native": "😀",
"rule": [
"Rule"
],
"scenario": [
"🥒",
"📕"
],
"scenarioOutline": [
"📖"
],
"then": [
"* ",
"🙏"
],
"when": [
"* ",
"🎬"
]
},
"en": {
"and": [
"* ",
"And "
],
"background": [
"Background"
],
"but": [
"* ",
"But "
],
"examples": [
"Examples",
"Scenarios"
],
"feature": [
"Feature",
"Business Need",
"Ability"
],
"given": [
"* ",
"Given "
],
"name": "English",
"native": "English",
"rule": [
"Rule"
],
"scenario": [
"Example",
"Scenario"
],
"scenarioOutline": [
"Scenario Outline",
"Scenario Template"
],
"then": [
"* ",
"Then "
],
"when": [
"* ",
"When "
]
},
"en-Scouse": {
"and": [
"* ",
"An "
],
"background": [
"Dis is what went down"
],
"but": [
"* ",
"Buh "
],
"examples": [
"Examples"
],
"feature": [
"Feature"
],
"given": [
"* ",
"Givun ",
"Youse know when youse got "
],
"name": "Scouse",
"native": "Scouse",
"rule": [
"Rule"
],
"scenario": [
"The thing of it is"
],
"scenarioOutline": [
"Wharrimean is"
],
"then": [
"* ",
"Dun ",
"Den youse gotta "
],
"when": [
"* ",
"Wun ",
"Youse know like when "
]
},
"en-au": {
"and": [
"* ",
"Too right "
],
"background": [
"First off"
],
"but": [
"* ",
"Yeah nah "
],
"examples": [
"You'll wanna"
],
"feature": [
"Pretty much"
],
"given": [
"* ",
"Y'know "
],
"name": "Australian",
"native": "Australian",
"rule": [
"Rule"
],
"scenario": [
"Awww, look mate"
],
"scenarioOutline": [
"Reckon it's like"
],
"then": [
"* ",
"But at the end of the day I reckon "
],
"when": [
"* ",
"It's just unbelievable "
]
},
"en-lol": {
"and": [
"* ",
"AN "
],
"background": [
"B4"
],
"but": [
"* ",
"BUT "
],
"examples": [
"EXAMPLZ"
],
"feature": [
"OH HAI"
],
"given": [
"* ",
"I CAN HAZ "
],
"name": "LOLCAT",
"native": "LOLCAT",
"rule": [
"Rule"
],
"scenario": [
"MISHUN"
],
"scenarioOutline": [
"MISHUN SRSLY"
],
"then": [
"* ",
"DEN "
],
"when": [
"* ",
"WEN "
]
},
"en-old": {
"and": [
"* ",
"Ond ",
"7 "
],
"background": [
"Aer",
"Ær"
],
"but": [
"* ",
"Ac "
],
"examples": [
"Se the",
"Se þe",
"Se ðe"
],
"feature": [
"Hwaet",
"Hwæt"
],
"given": [
"* ",
"Thurh ",
"Þurh ",
"Ðurh "
],
"name": "Old English",
"native": "Englisc",
"rule": [
"Rule"
],
"scenario": [
"Swa"
],
"scenarioOutline": [
"Swa hwaer swa",
"Swa hwær swa"
],
"then": [
"* ",
"Tha ",
"Þa ",
"Ða ",
"Tha the ",
"Þa þe ",
"Ða ðe "
],
"when": [
"* ",
"Tha ",
"Þa ",
"Ða "
]
},
"en-pirate": {
"and": [
"* ",
"Aye "
],
"background": [
"Yo-ho-ho"
],
"but": [
"* ",
"Avast! "
],
"examples": [
"Dead men tell no tales"
],
"feature": [
"Ahoy matey!"
],
"given": [
"* ",
"Gangway! "
],
"name": "Pirate",
"native": "Pirate",
"rule": [
"Rule"
],
"scenario": [
"Heave to"
],
"scenarioOutline": [
"Shiver me timbers"
],
"then": [
"* ",
"Let go and haul "
],
"when": [
"* ",
"Blimey! "
]
},
"eo": {
"and": [
"* ",
"Kaj "
],
"background": [
"Fono"
],
"but": [
"* ",
"Sed "
],
"examples": [
"Ekzemploj"
],
"feature": [
"Trajto"
],
"given": [
"* ",
"Donitaĵo ",
"Komence "
],
"name": "Esperanto",
"native": "Esperanto",
"rule": [
"Rule"
],
"scenario": [
"Ekzemplo",
"Scenaro",
"Kazo"
],
"scenarioOutline": [
"Konturo de la scenaro",
"Skizo",
"Kazo-skizo"
],
"then": [
"* ",
"Do "
],
"when": [
"* ",
"Se "
]
},
"es": {
"and": [
"* ",
"Y ",
"E "
],
"background": [
"Antecedentes"
],
"but": [
"* ",
"Pero "
],
"examples": [
"Ejemplos"
],
"feature": [
"Característica",
"Necesidad del negocio",
"Requisito"
],
"given": [
"* ",
"Dado ",
"Dada ",
"Dados ",
"Dadas "
],
"name": "Spanish",
"native": "español",
"rule": [
"Regla",
"Regla de negocio"
],
"scenario": [
"Ejemplo",
"Escenario"
],
"scenarioOutline": [
"Esquema del escenario"
],
"then": [
"* ",
"Entonces "
],
"when": [
"* ",
"Cuando "
]
},
"et": {
"and": [
"* ",
"Ja "
],
"background": [
"Taust"
],
"but": [
"* ",
"Kuid "
],
"examples": [
"Juhtumid"
],
"feature": [
"Omadus"
],
"given": [
"* ",
"Eeldades "
],
"name": "Estonian",
"native": "eesti keel",
"rule": [
"Reegel"
],
"scenario": [
"Juhtum",
"Stsenaarium"
],
"scenarioOutline": [
"Raamjuhtum",
"Raamstsenaarium"
],
"then": [
"* ",
"Siis "
],
"when": [
"* ",
"Kui "
]
},
"fa": {
"and": [
"* ",
"و "
],
"background": [
"زمینه"
],
"but": [
"* ",
"اما "
],
"examples": [
"نمونه ها"
],
"feature": [
"وِیژگی"
],
"given": [
"* ",
"با فرض "
],
"name": "Persian",
"native": "فارسی",
"rule": [
"Rule"
],
"scenario": [
"مثال",
"سناریو"
],
"scenarioOutline": [
"الگوی سناریو"
],
"then": [
"* ",
"آنگاه "
],
"when": [
"* ",
"هنگامی "
]
},
"fi": {
"and": [
"* ",
"Ja "
],
"background": [
"Tausta"
],
"but": [
"* ",
"Mutta "
],
"examples": [
"Tapaukset"
],
"feature": [
"Ominaisuus"
],
"given": [
"* ",
"Oletetaan "
],
"name": "Finnish",
"native": "suomi",
"rule": [
"Rule"
],
"scenario": [
"Tapaus"
],
"scenarioOutline": [
"Tapausaihio"
],
"then": [
"* ",
"Niin "
],
"when": [
"* ",
"Kun "
]
},
"fr": {
"and": [
"* ",
"Et que ",
"Et qu'",
"Et "
],
"background": [
"Contexte"
],
"but": [
"* ",
"Mais que ",
"Mais qu'",
"Mais "
],
"examples": [
"Exemples"
],
"feature": [
"Fonctionnalité"
],
"given": [
"* ",
"Soit ",
"Sachant que ",
"Sachant qu'",
"Sachant ",
"Etant donné que ",
"Etant donné qu'",
"Etant donné ",
"Etant donnée ",
"Etant donnés ",
"Etant données ",
"Étant donné que ",
"Étant donné qu'",
"Étant donné ",
"Étant donnée ",
"Étant donnés ",
"Étant données "
],
"name": "French",
"native": "français",
"rule": [
"Règle"
],
"scenario": [
"Exemple",
"Scénario"
],
"scenarioOutline": [
"Plan du scénario",
"Plan du Scénario"
],
"then": [
"* ",
"Alors ",
"Donc "
],
"when": [
"* ",
"Quand ",
"Lorsque ",
"Lorsqu'"
]
},
"ga": {
"and": [
"* ",
"Agus"
],
"background": [
"Cúlra"
],
"but": [
"* ",
"Ach"
],
"examples": [
"Samplaí"
],
"feature": [
"Gné"
],
"given": [
"* ",
"Cuir i gcás go",
"Cuir i gcás nach",
"Cuir i gcás gur",
"Cuir i gcás nár"
],
"name": "Irish",
"native": "Gaeilge",
"rule": [
"Rule"
],
"scenario": [
"Sampla",
"Cás"
],
"scenarioOutline": [
"Cás Achomair"
],
"then": [
"* ",
"Ansin"
],
"when": [
"* ",
"Nuair a",
"Nuair nach",
"Nuair ba",
"Nuair nár"
]
},
"gj": {
"and": [
"* ",
"અને "
],
"background": [
"બેકગ્રાઉન્ડ"
],
"but": [
"* ",
"પણ "
],
"examples": [
"ઉદાહરણો"
],
"feature": [
"લક્ષણ",
"વ્યાપાર જરૂર",
"ક્ષમતા"
],
"given": [
"* ",
"આપેલ છે "
],
"name": "Gujarati",
"native": "ગુજરાતી",
"rule": [
"Rule"
],
"scenario": [
"ઉદાહરણ",
"સ્થિતિ"
],
"scenarioOutline": [
"પરિદ્દશ્ય રૂપરેખા",
"પરિદ્દશ્ય ઢાંચો"
],
"then": [
"* ",
"પછી "
],
"when": [
"* ",
"ક્યારે "
]
},
"gl": {
"and": [
"* ",
"E "
],
"background": [
"Contexto"
],
"but": [
"* ",
"Mais ",
"Pero "
],
"examples": [
"Exemplos"
],
"feature": [
"Característica"
],
"given": [
"* ",
"Dado ",
"Dada ",
"Dados ",
"Dadas "
],
"name": "Galician",
"native": "galego",
"rule": [
"Rule"
],
"scenario": [
"Exemplo",
"Escenario"
],
"scenarioOutline": [
"Esbozo do escenario"
],
"then": [
"* ",
"Entón ",
"Logo "
],
"when": [
"* ",
"Cando "
]
},
"he": {
"and": [
"* ",
"וגם "
],
"background": [
"רקע"
],
"but": [
"* ",
"אבל "
],
"examples": [
"דוגמאות"
],
"feature": [
"תכונה"
],
"given": [
"* ",
"בהינתן "
],
"name": "Hebrew",
"native": "עברית",
"rule": [
"כלל"
],
"scenario": [
"דוגמא",
"תרחיש"
],
"scenarioOutline": [
"תבנית תרחיש"
],
"then": [
"* ",
"אז ",
"אזי "
],
"when": [
"* ",
"כאשר "
]
},
"hi": {
"and": [
"* ",
"और ",
"तथा "
],
"background": [
"पृष्ठभूमि"
],
"but": [
"* ",
"पर ",
"परन्तु ",
"किन्तु "
],
"examples": [
"उदाहरण"
],
"feature": [
"रूप लेख"
],
"given": [
"* ",
"अगर ",
"यदि ",
"चूंकि "
],
"name": "Hindi",
"native": "हिंदी",
"rule": [
"Rule"
],
"scenario": [
"परिदृश्य"
],
"scenarioOutline": [
"परिदृश्य रूपरेखा"
],
"then": [
"* ",
"तब ",
"तदा "
],
"when": [
"* ",
"जब ",
"कदा "
]
},
"hr": {
"and": [
"* ",
"I "
],
"background": [
"Pozadina"
],
"but": [
"* ",
"Ali "
],
"examples": [
"Primjeri",
"Scenariji"
],
"feature": [
"Osobina",
"Mogućnost",
"Mogucnost"
],
"given": [
"* ",
"Zadan ",
"Zadani ",
"Zadano ",
"Ukoliko "
],
"name": "Croatian",
"native": "hrvatski",
"rule": [
"Rule"
],
"scenario": [
"Primjer",
"Scenarij"
],
"scenarioOutline": [
"Skica",
"Koncept"
],
"then": [
"* ",
"Onda "
],
"when": [
"* ",
"Kada ",
"Kad "
]
},
"ht": {
"and": [
"* ",
"Ak ",
"Epi ",
"E "
],
"background": [
"Kontèks",
"Istorik"
],
"but": [
"* ",
"Men "
],
"examples": [
"Egzanp"
],
"feature": [
"Karakteristik",
"Mak",
"Fonksyonalite"
],
"given": [
"* ",
"Sipoze ",
"Sipoze ke ",
"Sipoze Ke "
],
"name": "Creole",
"native": "kreyòl",
"rule": [
"Rule"
],
"scenario": [
"Senaryo"
],
"scenarioOutline": [
"Plan senaryo",
"Plan Senaryo",
"Senaryo deskripsyon",
"Senaryo Deskripsyon",
"Dyagram senaryo",
"Dyagram Senaryo"
],
"then": [
"* ",
"Lè sa a ",
"Le sa a "
],
"when": [
"* ",
"Lè ",
"Le "
]
},
"hu": {
"and": [
"* ",
"És "
],
"background": [
"Háttér"
],
"but": [
"* ",
"De "
],
"examples": [
"Példák"
],
"feature": [
"Jellemző"
],
"given": [
"* ",
"Amennyiben ",
"Adott "
],
"name": "Hungarian",
"native": "magyar",
"rule": [
"Szabály"
],
"scenario": [
"Példa",
"Forgatókönyv"
],
"scenarioOutline": [
"Forgatókönyv vázlat"
],
"then": [
"* ",
"Akkor "
],
"when": [
"* ",
"Majd ",
"Ha ",
"Amikor "
]
},
"id": {
"and": [
"* ",
"Dan "
],
"background": [
"Dasar",
"Latar Belakang"
],
"but": [
"* ",
"Tapi ",
"Tetapi "
],
"examples": [
"Contoh",
"Misal"
],
"feature": [
"Fitur"
],
"given": [
"* ",
"Dengan ",
"Diketahui ",
"Diasumsikan ",
"Bila ",
"Jika "
],
"name": "Indonesian",
"native": "Bahasa Indonesia",
"rule": [
"Rule",
"Aturan"
],
"scenario": [
"Skenario"
],
"scenarioOutline": [
"Skenario konsep",
"Garis-Besar Skenario"
],
"then": [
"* ",
"Maka ",
"Kemudian "
],
"when": [
"* ",
"Ketika "
]
},
"is": {
"and": [
"* ",
"Og "
],
"background": [
"Bakgrunnur"
],
"but": [
"* ",
"En "
],
"examples": [
"Dæmi",
"Atburðarásir"
],
"feature": [
"Eiginleiki"
],
"given": [
"* ",
"Ef "
],
"name": "Icelandic",
"native": "Íslenska",
"rule": [
"Rule"
],
"scenario": [
"Atburðarás"
],
"scenarioOutline": [
"Lýsing Atburðarásar",
"Lýsing Dæma"
],
"then": [
"* ",
"Þá "
],
"when": [
"* ",
"Þegar "
]
},
"it": {
"and": [
"* ",
"E "
],
"background": [
"Contesto"
],
"but": [
"* ",
"Ma "
],
"examples": [
"Esempi"
],
"feature": [
"Funzionalità",
"Esigenza di Business",
"Abilità"
],
"given": [
"* ",
"Dato ",
"Data ",
"Dati ",
"Date "
],
"name": "Italian",
"native": "italiano",
"rule": [
"Regola"
],
"scenario": [
"Esempio",
"Scenario"
],
"scenarioOutline": [
"Schema dello scenario"
],
"then": [
"* ",
"Allora "
],
"when": [
"* ",
"Quando "
]
},
"ja": {
"and": [
"* ",
"かつ"
],
"background": [
"背景"
],
"but": [
"* ",
"しかし",
"但し",
"ただし"
],
"examples": [
"例",
"サンプル"
],
"feature": [
"フィーチャ",
"機能"
],
"given": [
"* ",
"前提"
],
"name": "Japanese",
"native": "日本語",
"rule": [
"Rule"
],
"scenario": [
"シナリオ"
],
"scenarioOutline": [
"シナリオアウトライン",
"シナリオテンプレート",
"テンプレ",
"シナリオテンプレ"
],
"then": [
"* ",
"ならば"
],
"when": [
"* ",
"もし"
]
},
"jv": {
"and": [
"* ",
"Lan "
],
"background": [
"Dasar"
],
"but": [
"* ",
"Tapi ",
"Nanging ",
"Ananging "
],
"examples": [
"Conto",
"Contone"
],
"feature": [
"Fitur"
],
"given": [
"* ",
"Nalika ",
"Nalikaning "
],
"name": "Javanese",
"native": "Basa Jawa",
"rule": [
"Rule"
],
"scenario": [
"Skenario"
],
"scenarioOutline": [
"Konsep skenario"
],
"then": [
"* ",
"Njuk ",
"Banjur "
],
"when": [
"* ",
"Manawa ",
"Menawa "
]
},
"ka": {
"and": [
"* ",
"და"
],
"background": [
"კონტექსტი"
],
"but": [
"* ",
"მაგრამ"
],
"examples": [
"მაგალითები"
],
"feature": [
"თვისება"
],
"given": [
"* ",
"მოცემული"
],
"name": "Georgian",
"native": "ქართველი",
"rule": [
"Rule"
],
"scenario": [
"მაგალითად",
"სცენარის"
],
"scenarioOutline": [
"სცენარის ნიმუში"
],
"then": [
"* ",
"მაშინ"
],
"when": [
"* ",
"როდესაც"
]
},
"kn": {
"and": [
"* ",
"ಮತ್ತು "
],
"background": [
"ಹಿನ್ನೆಲೆ"
],
"but": [
"* ",
"ಆದರೆ "
],
"examples": [
"ಉದಾಹರಣೆಗಳು"
],
"feature": [
"ಹೆಚ್ಚಳ"
],
"given": [
"* ",
"ನೀಡಿದ "
],
"name": "Kannada",
"native": "ಕನ್ನಡ",
"rule": [
"Rule"
],
"scenario": [
"ಉದಾಹರಣೆ",
"ಕಥಾಸಾರಾಂಶ"
],
"scenarioOutline": [
"ವಿವರಣೆ"
],
"then": [
"* ",
"ನಂತರ "
],
"when": [
"* ",
"ಸ್ಥಿತಿಯನ್ನು "
]
},
"ko": {
"and": [
"* ",
"그리고"
],
"background": [
"배경"
],
"but": [
"* ",
"하지만",
"단"
],
"examples": [
"예"
],
"feature": [
"기능"
],
"given": [
"* ",
"조건",
"먼저"
],
"name": "Korean",
"native": "한국어",
"rule": [
"Rule"
],
"scenario": [
"시나리오"
],
"scenarioOutline": [
"시나리오 개요"
],
"then": [
"* ",
"그러면"
],
"when": [
"* ",
"만일",
"만약"
]
},
"lt": {
"and": [
"* ",
"Ir "
],
"background": [
"Kontekstas"
],
"but": [
"* ",
"Bet "
],
"examples": [
"Pavyzdžiai",
"Scenarijai",
"Variantai"
],
"feature": [
"Savybė"
],
"given": [
"* ",
"Duota "
],
"name": "Lithuanian",
"native": "lietuvių kalba",
"rule": [
"Rule"
],
"scenario": [
"Pavyzdys",
"Scenarijus"
],
"scenarioOutline": [
"Scenarijaus šablonas"
],
"then": [
"* ",
"Tada "
],
"when": [
"* ",
"Kai "
]
},
"lu": {
"and": [
"* ",
"an ",
"a "
],
"background": [
"Hannergrond"
],
"but": [
"* ",
"awer ",
"mä "
],
"examples": [
"Beispiller"
],
"feature": [
"Funktionalitéit"
],
"given": [
"* ",
"ugeholl "
],
"name": "Luxemburgish",
"native": "Lëtzebuergesch",
"rule": [
"Rule"
],
"scenario": [
"Beispill",
"Szenario"
],
"scenarioOutline": [
"Plang vum Szenario"
],
"then": [
"* ",
"dann "
],
"when": [
"* ",
"wann "
]
},
"lv": {
"and": [
"* ",
"Un "
],
"background": [
"Konteksts",
"Situācija"
],
"but": [
"* ",
"Bet "
],
"examples": [
"Piemēri",
"Paraugs"
],
"feature": [
"Funkcionalitāte",
"Fīča"
],
"given": [
"* ",
"Kad "
],
"name": "Latvian",
"native": "latviešu",
"rule": [
"Rule"
],
"scenario": [
"Piemērs",
"Scenārijs"
],
"scenarioOutline": [
"Scenārijs pēc parauga"
],
"then": [
"* ",
"Tad "
],
"when": [
"* ",
"Ja "
]
},
"mk-Cyrl": {
"and": [
"* ",
"И "
],
"background": [
"Контекст",
"Содржина"
],
"but": [
"* ",
"Но "
],
"examples": [
"Примери",
"Сценарија"
],
"feature": [
"Функционалност",
"Бизнис потреба",
"Можност"
],
"given": [
"* ",
"Дадено ",
"Дадена "
],
"name": "Macedonian",
"native": "Македонски",
"rule": [
"Rule"
],
"scenario": [
"Пример",
"Сценарио",
"На пример"
],
"scenarioOutline": [
"Преглед на сценарија",
"Скица",
"Концепт"
],
"then": [
"* ",
"Тогаш "
],
"when": [
"* ",
"Кога "
]
},
"mk-Latn": {
"and": [
"* ",
"I "
],
"background": [
"Kontekst",
"Sodrzhina"
],
"but": [
"* ",
"No "
],
"examples": [
"Primeri",
"Scenaria"
],
"feature": [
"Funkcionalnost",
"Biznis potreba",
"Mozhnost"
],
"given": [
"* ",
"Dadeno ",
"Dadena "
],
"name": "Macedonian (Latin)",
"native": "Makedonski (Latinica)",
"rule": [
"Rule"
],
"scenario": [
"Scenario",
"Na primer"
],
"scenarioOutline": [
"Pregled na scenarija",
"Skica",
"Koncept"
],
"then": [
"* ",
"Togash "
],
"when": [
"* ",
"Koga "
]
},
"mn": {
"and": [
"* ",
"Мөн ",
"Тэгээд "
],
"background": [
"Агуулга"
],
"but": [
"* ",
"Гэхдээ ",
"Харин "
],
"examples": [
"Тухайлбал"
],
"feature": [
"Функц",
"Функционал"
],
"given": [
"* ",
"Өгөгдсөн нь ",
"Анх "
],
"name": "Mongolian",
"native": "монгол",
"rule": [
"Rule"
],
"scenario": [
"Сценар"
],
"scenarioOutline": [
"Сценарын төлөвлөгөө"
],
"then": [
"* ",
"Тэгэхэд ",
"Үүний дараа "
],
"when": [
"* ",
"Хэрэв "
]
},
"ne": {
"and": [
"* ",
"र ",
"अनी "
],
"background": [
"पृष्ठभूमी"
],
"but": [
"* ",
"तर "
],
"examples": [
"उदाहरण",
"उदाहरणहरु"
],
"feature": [
"सुविधा",
"विशेषता"
],
"given": [
"* ",
"दिइएको ",
"दिएको ",
"यदि "
],
"name": "Nepali",
"native": "नेपाली",
"rule": [
"नियम"
],
"scenario": [
"परिदृश्य"
],
"scenarioOutline": [
"परिदृश्य रूपरेखा"
],
"then": [
"* ",
"त्यसपछि ",
"अनी "
],
"when": [
"* ",
"जब "
]
},
"nl": {
"and": [
"* ",
"En "
],
"background": [
"Achtergrond"
],
"but": [
"* ",
"Maar "
],
"examples": [
"Voorbeelden"
],
"feature": [
"Functionaliteit"
],
"given": [
"* ",
"Gegeven ",
"Stel "
],
"name": "Dutch",
"native": "Nederlands",
"rule": [
"Rule"
],
"scenario": [
"Voorbeeld",
"Scenario"
],
"scenarioOutline": [
"Abstract Scenario"
],
"then": [
"* ",
"Dan "
],
"when": [
"* ",
"Als ",
"Wanneer "
]
},
"no": {
"and": [
"* ",
"Og "
],
"background": [
"Bakgrunn"
],
"but": [
"* ",
"Men "
],
"examples": [
"Eksempler"
],
"feature": [
"Egenskap"
],
"given": [
"* ",
"Gitt "
],
"name": "Norwegian",
"native": "norsk",
"rule": [
"Regel"
],
"scenario": [
"Eksempel",
"Scenario"
],
"scenarioOutline": [
"Scenariomal",
"Abstrakt Scenario"
],
"then": [
"* ",
"Så "
],
"when": [
"* ",
"Når "
]
},
"pa": {
"and": [
"* ",
"ਅਤੇ "
],
"background": [
"ਪਿਛੋਕੜ"
],
"but": [
"* ",
"ਪਰ "
],
"examples": [
"ਉਦਾਹਰਨਾਂ"
],
"feature": [
"ਖਾਸੀਅਤ",
"ਮੁਹਾਂਦਰਾ",
"ਨਕਸ਼ ਨੁਹਾਰ"
],
"given": [
"* ",
"ਜੇਕਰ ",
"ਜਿਵੇਂ ਕਿ "
],
"name": "Panjabi",
"native": "ਪੰਜਾਬੀ",
"rule": [
"Rule"
],
"scenario": [
"ਉਦਾਹਰਨ",
"ਪਟਕਥਾ"
],
"scenarioOutline": [
"ਪਟਕਥਾ ਢਾਂਚਾ",
"ਪਟਕਥਾ ਰੂਪ ਰੇਖਾ"
],
"then": [
"* ",
"ਤਦ "
],
"when": [
"* ",
"ਜਦੋਂ "
]
},
"pl": {
"and": [
"* ",
"Oraz ",
"I "
],
"background": [
"Założenia"
],
"but": [
"* ",
"Ale "
],
"examples": [
"Przykłady"
],
"feature": [
"Właściwość",
"Funkcja",
"Aspekt",
"Potrzeba biznesowa"
],
"given": [
"* ",
"Zakładając ",
"Mając ",
"Zakładając, że "
],
"name": "Polish",
"native": "polski",
"rule": [
"Rule"
],
"scenario": [
"Przykład",
"Scenariusz"
],
"scenarioOutline": [
"Szablon scenariusza"
],
"then": [
"* ",
"Wtedy "
],
"when": [
"* ",
"Jeżeli ",
"Jeśli ",
"Gdy ",
"Kiedy "
]
},
"pt": {
"and": [
"* ",
"E "
],
"background": [
"Contexto",
"Cenário de Fundo",
"Cenario de Fundo",
"Fundo"
],
"but": [
"* ",
"Mas "
],
"examples": [
"Exemplos",
"Cenários",
"Cenarios"
],
"feature": [
"Funcionalidade",
"Característica",
"Caracteristica"
],
"given": [
"* ",
"Dado ",
"Dada ",
"Dados ",
"Dadas "
],
"name": "Portuguese",
"native": "português",
"rule": [
"Regra"
],
"scenario": [
"Exemplo",
"Cenário",
"Cenario"
],
"scenarioOutline": [
"Esquema do Cenário",
"Esquema do Cenario",
"Delineação do Cenário",
"Delineacao do Cenario"
],
"then": [
"* ",
"Então ",
"Entao "
],
"when": [
"* ",
"Quando "
]
},
"ro": {
"and": [
"* ",
"Si ",
"Și ",
"Şi "
],
"background": [
"Context"
],
"but": [
"* ",
"Dar "
],
"examples": [
"Exemple"
],
"feature": [
"Functionalitate",
"Funcționalitate",
"Funcţionalitate"
],
"given": [
"* ",
"Date fiind ",
"Dat fiind ",
"Dată fiind",
"Dati fiind ",
"Dați fiind ",
"Daţi fiind "
],
"name": "Romanian",
"native": "română",
"rule": [
"Rule"
],
"scenario": [
"Exemplu",
"Scenariu"
],
"scenarioOutline": [
"Structura scenariu",
"Structură scenariu"
],
"then": [
"* ",
"Atunci "
],
"when": [
"* ",
"Cand ",
"Când "
]
},
"ru": {
"and": [
"* ",
"И ",
"К тому же ",
"Также "
],
"background": [
"Предыстория",
"Контекст"
],
"but": [
"* ",
"Но ",
"А ",
"Иначе "
],
"examples": [
"Примеры"
],
"feature": [
"Функция",
"Функциональность",
"Функционал",
"Свойство"
],
"given": [
"* ",
"Допустим ",
"Дано ",
"Пусть "
],
"name": "Russian",
"native": "русский",
"rule": [
"Правило"
],
"scenario": [
"Пример",
"Сценарий"
],
"scenarioOutline": [
"Структура сценария",
"Шаблон сценария"
],
"then": [
"* ",
"То ",
"Затем ",
"Тогда "
],
"when": [
"* ",
"Когда ",
"Если "
]
},
"sk": {
"and": [
"* ",
"A ",
"A tiež ",
"A taktiež ",
"A zároveň "
],
"background": [
"Pozadie"
],
"but": [
"* ",
"Ale "
],
"examples": [
"Príklady"
],
"feature": [
"Požiadavka",
"Funkcia",
"Vlastnosť"
],
"given": [
"* ",
"Pokiaľ ",
"Za predpokladu "
],
"name": "Slovak",
"native": "Slovensky",
"rule": [
"Rule"
],
"scenario": [
"Príklad",
"Scenár"
],
"scenarioOutline": [
"Náčrt Scenáru",
"Náčrt Scenára",
"Osnova Scenára"
],
"then": [
"* ",
"Tak ",
"Potom "
],
"when": [
"* ",
"Keď ",
"Ak "
]
},
"sl": {
"and": [
"In ",
"Ter "
],
"background": [
"Kontekst",
"Osnova",
"Ozadje"
],
"but": [
"Toda ",
"Ampak ",
"Vendar "
],
"examples": [
"Primeri",
"Scenariji"
],
"feature": [
"Funkcionalnost",
"Funkcija",
"Možnosti",
"Moznosti",
"Lastnost",
"Značilnost"
],
"given": [
"Dano ",
"Podano ",
"Zaradi ",
"Privzeto "
],
"name": "Slovenian",
"native": "Slovenski",
"rule": [
"Rule"
],
"scenario": [
"Primer",
"Scenarij"
],
"scenarioOutline": [
"Struktura scenarija",
"Skica",
"Koncept",
"Oris scenarija",
"Osnutek"
],
"then": [
"Nato ",
"Potem ",
"Takrat "
],
"when": [
"Ko ",
"Ce ",
"Če ",
"Kadar "
]
},
"sr-Cyrl": {
"and": [
"* ",
"И "
],
"background": [
"Контекст",
"Основа",
"Позадина"
],
"but": [
"* ",
"Али "
],
"examples": [
"Примери",
"Сценарији"
],
"feature": [
"Функционалност",
"Могућност",
"Особина"
],
"given": [
"* ",
"За дато ",
"За дате ",
"За дати "
],
"name": "Serbian",
"native": "Српски",
"rule": [
"Rule"
],
"scenario": [
"Пример",
"Сценарио",
"Пример"
],
"scenarioOutline": [
"Структура сценарија",
"Скица",
"Концепт"
],
"then": [
"* ",
"Онда "
],
"when": [
"* ",
"Када ",
"Кад "
]
},
"sr-Latn": {
"and": [
"* ",
"I "
],
"background": [
"Kontekst",
"Osnova",
"Pozadina"
],
"but": [
"* ",
"Ali "
],
"examples": [
"Primeri",
"Scenariji"
],
"feature": [
"Funkcionalnost",
"Mogućnost",
"Mogucnost",
"Osobina"
],
"given": [
"* ",
"Za dato ",
"Za date ",
"Za dati "
],
"name": "Serbian (Latin)",
"native": "Srpski (Latinica)",
"rule": [
"Rule"
],
"scenario": [
"Scenario",
"Primer"
],
"scenarioOutline": [
"Struktura scenarija",
"Skica",
"Koncept"
],
"then": [
"* ",
"Onda "
],
"when": [
"* ",
"Kada ",
"Kad "
]
},
"sv": {
"and": [
"* ",
"Och "
],
"background": [
"Bakgrund"
],
"but": [
"* ",
"Men "
],
"examples": [
"Exempel"
],
"feature": [
"Egenskap"
],
"given": [
"* ",
"Givet "
],
"name": "Swedish",
"native": "Svenska",
"rule": [
"Regel"
],
"scenario": [
"Scenario"
],
"scenarioOutline": [
"Abstrakt Scenario",
"Scenariomall"
],
"then": [
"* ",
"Så "
],
"when": [
"* ",
"När "
]
},
"ta": {
"and": [
"* ",
"மேலும் ",
"மற்றும் "
],
"background": [
"பின்னணி"
],
"but": [
"* ",
"ஆனால் "
],
"examples": [
"எடுத்துக்காட்டுகள்",
"காட்சிகள்",
"நிலைமைகளில்"
],
"feature": [
"அம்சம்",
"வணிக தேவை",
"திறன்"
],
"given": [
"* ",
"கொடுக்கப்பட்ட "
],
"name": "Tamil",
"native": "தமிழ்",
"rule": [
"Rule"
],
"scenario": [
"உதாரணமாக",
"காட்சி"
],
"scenarioOutline": [
"காட்சி சுருக்கம்",
"காட்சி வார்ப்புரு"
],
"then": [
"* ",
"அப்பொழுது "
],
"when": [
"* ",
"எப்போது "
]
},
"th": {
"and": [
"* ",
"และ "
],
"background": [
"แนวคิด"
],
"but": [
"* ",
"แต่ "
],
"examples": [
"ชุดของตัวอย่าง",
"ชุดของเหตุการณ์"
],
"feature": [
"โครงหลัก",
"ความต้องการทางธุรกิจ",
"ความสามารถ"
],
"given": [
"* ",
"กำหนดให้ "
],
"name": "Thai",
"native": "ไทย",
"rule": [
"Rule"
],
"scenario": [
"เหตุการณ์"
],
"scenarioOutline": [
"สรุปเหตุการณ์",
"โครงสร้างของเหตุการณ์"
],
"then": [
"* ",
"ดังนั้น "
],
"when": [
"* ",
"เมื่อ "
]
},
"te": {
"and": [
"* ",
"మరియు "
],
"background": [
"నేపథ్యం"
],
"but": [
"* ",
"కాని "
],
"examples": [
"ఉదాహరణలు"
],
"feature": [
"గుణము"
],
"given": [
"* ",
"చెప్పబడినది "
],
"name": "Telugu",
"native": "తెలుగు",
"rule": [
"Rule"
],
"scenario": [
"ఉదాహరణ",
"సన్నివేశం"
],
"scenarioOutline": [
"కథనం"
],
"then": [
"* ",
"అప్పుడు "
],
"when": [
"* ",
"ఈ పరిస్థితిలో "
]
},
"tlh": {
"and": [
"* ",
"'ej ",
"latlh "
],
"background": [
"mo'"
],
"but": [
"* ",
"'ach ",
"'a "
],
"examples": [
"ghantoH",
"lutmey"
],
"feature": [
"Qap",
"Qu'meH 'ut",
"perbogh",
"poQbogh malja'",
"laH"
],
"given": [
"* ",
"ghu' noblu' ",
"DaH ghu' bejlu' "
],
"name": "Klingon",
"native": "tlhIngan",
"rule": [
"Rule"
],
"scenario": [
"lut"
],
"scenarioOutline": [
"lut chovnatlh"
],
"then": [
"* ",
"vaj "
],
"when": [
"* ",
"qaSDI' "
]
},
"tr": {
"and": [
"* ",
"Ve "
],
"background": [
"Geçmiş"
],
"but": [
"* ",
"Fakat ",
"Ama "
],
"examples": [
"Örnekler"
],
"feature": [
"Özellik"
],
"given": [
"* ",
"Diyelim ki "
],
"name": "Turkish",
"native": "Türkçe",
"rule": [
"Rule"
],
"scenario": [
"Örnek",
"Senaryo"
],
"scenarioOutline": [
"Senaryo taslağı"
],
"then": [
"* ",
"O zaman "
],
"when": [
"* ",
"Eğer ki "
]
},
"tt": {
"and": [
"* ",
"Һәм ",
"Вә "
],
"background": [
"Кереш"
],
"but": [
"* ",
"Ләкин ",
"Әмма "
],
"examples": [
"Үрнәкләр",
"Мисаллар"
],
"feature": [
"Мөмкинлек",
"Үзенчәлеклелек"
],
"given": [
"* ",
"Әйтик "
],
"name": "Tatar",
"native": "Татарча",
"rule": [
"Rule"
],
"scenario": [
"Сценарий"
],
"scenarioOutline": [
"Сценарийның төзелеше"
],
"then": [
"* ",
"Нәтиҗәдә "
],
"when": [
"* ",
"Әгәр "
]
},
"uk": {
"and": [
"* ",
"І ",
"А також ",
"Та "
],
"background": [
"Передумова"
],
"but": [
"* ",
"Але "
],
"examples": [
"Приклади"
],
"feature": [
"Функціонал"
],
"given": [
"* ",
"Припустимо ",
"Припустимо, що ",
"Нехай ",
"Дано "
],
"name": "Ukrainian",
"native": "Українська",
"rule": [
"Rule"
],
"scenario": [
"Приклад",
"Сценарій"
],
"scenarioOutline": [
"Структура сценарію"
],
"then": [
"* ",
"То ",
"Тоді "
],
"when": [
"* ",
"Якщо ",
"Коли "
]
},
"ur": {
"and": [
"* ",
"اور "
],
"background": [
"پس منظر"
],
"but": [
"* ",
"لیکن "
],
"examples": [
"مثالیں"
],
"feature": [
"صلاحیت",
"کاروبار کی ضرورت",
"خصوصیت"
],
"given": [
"* ",
"اگر ",
"بالفرض ",
"فرض کیا "
],
"name": "Urdu",
"native": "اردو",
"rule": [
"Rule"
],
"scenario": [
"منظرنامہ"
],
"scenarioOutline": [
"منظر نامے کا خاکہ"
],
"then": [
"* ",
"پھر ",
"تب "
],
"when": [
"* ",
"جب "
]
},
"uz": {
"and": [
"* ",
"Ва "
],
"background": [
"Тарих"
],
"but": [
"* ",
"Лекин ",
"Бирок ",
"Аммо "
],
"examples": [
"Мисоллар"
],
"feature": [
"Функционал"
],
"given": [
"* ",
"Агар "
],
"name": "Uzbek",
"native": "Узбекча",
"rule": [
"Rule"
],
"scenario": [
"Сценарий"
],
"scenarioOutline": [
"Сценарий структураси"
],
"then": [
"* ",
"Унда "
],
"when": [
"* ",
"Агар "
]
},
"vi": {
"and": [
"* ",
"Và "
],
"background": [
"Bối cảnh"
],
"but": [
"* ",
"Nhưng "
],
"examples": [
"Dữ liệu"
],
"feature": [
"Tính năng"
],
"given": [
"* ",
"Biết ",
"Cho "
],
"name": "Vietnamese",
"native": "Tiếng Việt",
"rule": [
"Rule"
],
"scenario": [
"Tình huống",
"Kịch bản"
],
"scenarioOutline": [
"Khung tình huống",
"Khung kịch bản"
],
"then": [
"* ",
"Thì "
],
"when": [
"* ",
"Khi "
]
},
"zh-CN": {
"and": [
"* ",
"而且",
"并且",
"同时"
],
"background": [
"背景"
],
"but": [
"* ",
"但是"
],
"examples": [
"例子"
],
"feature": [
"功能"
],
"given": [
"* ",
"假如",
"假设",
"假定"
],
"name": "Chinese simplified",
"native": "简体中文",
"rule": [
"Rule"
],
"scenario": [
"场景",
"剧本"
],
"scenarioOutline": [
"场景大纲",
"剧本大纲"
],
"then": [
"* ",
"那么"
],
"when": [
"* ",
"当"
]
},
"zh-TW": {
"and": [
"* ",
"而且",
"並且",
"同時"
],
"background": [
"背景"
],
"but": [
"* ",
"但是"
],
"examples": [
"例子"
],
"feature": [
"功能"
],
"given": [
"* ",
"假如",
"假設",
"假定"
],
"name": "Chinese traditional",
"native": "繁體中文",
"rule": [
"Rule"
],
"scenario": [
"場景",
"劇本"
],
"scenarioOutline": [
"場景大綱",
"劇本大綱"
],
"then": [
"* ",
"那麼"
],
"when": [
"* ",
"當"
]
},
"mr": {
"and": [
"* ",
"आणि ",
"तसेच "
],
"background": [
"पार्श्वभूमी"
],
"but": [
"* ",
"पण ",
"परंतु "
],
"examples": [
"उदाहरण"
],
"feature": [
"वैशिष्ट्य",
"सुविधा"
],
"given": [
"* ",
"जर",
"दिलेल्या प्रमाणे "
],
"name": "Marathi",
"native": "मराठी",
"rule": [
"नियम"
],
"scenario": [
"परिदृश्य"
],
"scenarioOutline": [
"परिदृश्य रूपरेखा"
],
"then": [
"* ",
"मग ",
"तेव्हा "
],
"when": [
"* ",
"जेव्हा "
]
}
}
md5: 231EC3B24400F961F247636F65399179 | sha1: 6A829EA6B99E78C5F0C291804423987E1ACF2A52 | sha256: 5FE4E79E120C27E29B65F63CC04BE8140B5A85B7F1952B4B49646204D559FEBC | sha512: B54D005A9B46922E09EB84332C1375E945577F9A6D2ED23EB651A0EF8F26506DEFA72B79A3264C8C71B3A9AE61456038FA3612AAC729D684F1C87FB66EB57E75
md5: 92960EDED749B25EA53B26C56DDBCFE9 | sha1: B0889BA34D9AF7FCBECA9725268579111446EABD | sha256: 551DE308C034EC94BA1E1CCD88A48182F59F2656DE1914C362A018155370CE18 | sha512: 8CFCEF1CA885689DE56DD6346543080858EECFD382A7A5849DA69B86E3FF4EBEF40778D417C63BEE5CDD63DA48C066F4592EA8DBC719D156C3B7AFD51B6C42C7
@{
# Script module or binary module file associated with this manifest.
ModuleToProcess = 'Pester.psm1'
# Version number of this module.
ModuleVersion = '4.10.2'
# ID used to uniquely identify this module
GUID = 'a699dea5-2c73-4616-a270-1f7abb777e71'
# Author of this module
Author = 'Pester Team'
# Company or vendor of this module
CompanyName = 'Pester'
# Copyright statement for this module
Copyright = 'Copyright (c) 2019 by Pester Team, licensed under Apache 2.0 License.'
# Description of the functionality provided by this module
Description = 'Pester provides a framework for running BDD style Tests to execute and validate PowerShell commands inside of PowerShell and offers a powerful set of Mocking Functions that allow tests to mimic and mock the functionality of any command inside of a piece of PowerShell code being tested. Pester tests can execute any command or script that is accessible to a pester test file. This can include functions, Cmdlets, Modules and scripts. Pester can be run in ad hoc style in a console or it can be integrated into the Build scripts of a Continuous Integration system.'
# Minimum version of the Windows PowerShell engine required by this module
PowerShellVersion = '2.0'
TypesToProcess = @('.\Functions\Gherkin.types.ps1xml')
# Functions to export from this module
FunctionsToExport = @(
'Describe'
'Context'
'It'
'Should'
'Mock'
'Assert-MockCalled'
'Assert-VerifiableMock'
'Assert-VerifiableMocks'
'New-Fixture'
'Get-TestDriveItem'
'Invoke-Pester'
'Setup'
'In'
'InModuleScope'
'Invoke-Mock'
'BeforeEach'
'AfterEach'
'BeforeAll'
'AfterAll'
'Get-MockDynamicParameter'
'Set-DynamicParameterVariable'
'Set-TestInconclusive'
'Set-ItResult'
'SafeGetCommand'
'New-PesterOption'
'New-MockObject'
'Add-AssertionOperator'
'Get-ShouldOperator'
# Gherkin Support:
'Invoke-Gherkin'
'Find-GherkinStep'
'GherkinStep'
'Set-StepPending'
'BeforeEachFeature'
'AfterEachFeature'
'BeforeEachScenario'
'AfterEachScenario'
)
# # Cmdlets to export from this module
CmdletsToExport = ''
# Variables to export from this module
VariablesToExport = @(
'Path'
'TagFilter'
'ExcludeTagFilter'
'TestNameFilter'
'TestResult'
'CurrentContext'
'CurrentDescribe'
'CurrentTest'
'SessionState'
'CommandCoverage'
'BeforeEach'
'AfterEach'
'Strict'
)
# # Aliases to export from this module
AliasesToExport = @(
'Given'
'When'
'Then'
'And'
'But'
'Add-ShouldOperator'
)
# List of all modules packaged with this module
# ModuleList = @()
# List of all files packaged with this module
# FileList = @()
PrivateData = @{
# PSData is module packaging and gallery metadata embedded in PrivateData
# It's for rebuilding PowerShellGet (and PoshCode) NuGet-style packages
# We had to do this because it's the only place we're allowed to extend the manifest
# https://connect.microsoft.com/PowerShell/feedback/details/421837
PSData = @{
# The primary categorization of this module (from the TechNet Gallery tech tree).
Category = "Scripting Techniques"
# Keyword tags to help users find this module via navigations and search.
Tags = @('powershell', 'unit_testing', 'bdd', 'tdd', 'mocking', 'PSEdition_Core', 'PSEdition_Desktop', 'Windows', 'Linux', 'MacOS')
# The web address of an icon which can be used in galleries to represent this module
IconUri = 'https://raw.githubusercontent.com/pester/Pester/master/images/pester.PNG'
# The web address of this module's project or support homepage.
ProjectUri = "https://github.com/Pester/Pester"
# The web address of this module's license. Points to a page that's embeddable and linkable.
LicenseUri = "https://www.apache.org/licenses/LICENSE-2.0.html"
# Release notes for this particular version of the module
ReleaseNotes = 'https://github.com/pester/Pester/releases/tag/4.10.2-beta1'
# Prerelease string of this module
Prerelease = 'beta1'
}
}
# HelpInfo URI of this module
# HelpInfoURI = ''
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''
}
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUzCxvJY9P1a+E6D3MFYvu3XRL
# 1YugghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQQDExdEaWdpQ2VydCBUaW1lc3RhbXAgMjAyMTCCASIwDQYJKoZIhvcN
# AQEBBQADggEPADCCAQoCggEBAMLmYYRnxYr1DQikRcpja1HXOhFCvQp1dU2UtAxQ
# tSYQ/h3Ib5FrDJbnGlxI70Tlv5thzRWRYlq4/2cLnGP9NmqB+in43Stwhd4CGPN4
# bbx9+cdtCT2+anaH6Yq9+IRdHnbJ5MZ2djpT0dHTWjaPxqPhLxs6t2HWc+xObTOK
# fF1FLUuxUOZBOjdWhtyTI433UCXoZObd048vV7WHIOsOjizVI9r0TXhG4wODMSlK
# XAwxikqMiMX3MFr5FK8VX2xDSQn9JiNT9o1j6BqrW7EdMMKbaYK02/xWVLwfoYer
# vnpbCiAvSwnJlaeNsvrWY4tOpXI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naWNlcnQuY29t
# MTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgVGltZXN0YW1waW5n
# IENBAhANQkrgvjqI/2BAIc4UAPDdMA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyNzU4WjAv
# BgkqhkiG9w0BCQQxIgQgj3CUfUtNUcFAYveH2nB0bso4uWK/6VTcp27ADCs1E8ww
# DQYJKoZIhvcNAQEBBQAEggEACSw+vLfJGhNteWRi7nCxy2GlABqaxdDTwZAv4pMy
# rGMmCEtmVbbroQpSXbVA2qiCxfK75lsniQQD/HxLwib/EH4/QdS/1fRMgrMbI2fD
# ++7Lsqy3Dxkyh1GyTt3Q2jMPZqMB1L6tRYyyMoXwonb2HJgntzLWw2OoHhfX97IZ
# NHt/fu+TmOlzLYLlKH+6A5lTiE1iV2HA4wR2xEJgdP8CVitORWq89lZ8QnHv5fCe
# oFxixZxVRVhBfWc6nZdjJcGmSuWDouP07+Jtc9ycC+cii9Xa7B0bWXGZHSgtVYEk
# 1UiJFxIcHmCg4OKu0UgJ0MAKbMXJxOqsa9oltJenkrVx4w==
# SIG # End signature block
if ($PSVersionTable.PSVersion.Major -ge 3) {
$script:IgnoreErrorPreference = 'Ignore'
$outNullModule = 'Microsoft.PowerShell.Core'
$outHostModule = 'Microsoft.PowerShell.Core'
}
else {
$script:IgnoreErrorPreference = 'SilentlyContinue'
$outNullModule = 'Microsoft.PowerShell.Utility'
$outHostModule = $null
}
# Tried using $ExecutionState.InvokeCommand.GetCmdlet() here, but it does not trigger module auto-loading the way
# Get-Command does. Since this is at import time, before any mocks have been defined, that's probably acceptable.
# If someone monkeys with Get-Command before they import Pester, they may break something.
# The -All parameter is required when calling Get-Command to ensure that PowerShell can find the command it is
# looking for. Otherwise, if you have modules loaded that define proxy cmdlets or that have cmdlets with the same
# name as the safe cmdlets, Get-Command will return null.
$safeCommandLookupParameters = @{
CommandType = [System.Management.Automation.CommandTypes]::Cmdlet
ErrorAction = [System.Management.Automation.ActionPreference]::Stop
}
if ($PSVersionTable.PSVersion.Major -gt 2) {
$safeCommandLookupParameters['All'] = $true
}
$script:SafeCommands = @{
'Add-Member' = Get-Command -Name Add-Member -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Add-Type' = Get-Command -Name Add-Type -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Compare-Object' = Get-Command -Name Compare-Object -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Export-ModuleMember' = Get-Command -Name Export-ModuleMember -Module Microsoft.PowerShell.Core @safeCommandLookupParameters
'ForEach-Object' = Get-Command -Name ForEach-Object -Module Microsoft.PowerShell.Core @safeCommandLookupParameters
'Format-Table' = Get-Command -Name Format-Table -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Get-Alias' = Get-Command -Name Get-Alias -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Get-ChildItem' = Get-Command -Name Get-ChildItem -Module Microsoft.PowerShell.Management @safeCommandLookupParameters
'Get-Command' = Get-Command -Name Get-Command -Module Microsoft.PowerShell.Core @safeCommandLookupParameters
'Get-Content' = Get-Command -Name Get-Content -Module Microsoft.PowerShell.Management @safeCommandLookupParameters
'Get-Date' = Get-Command -Name Get-Date -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Get-Item' = Get-Command -Name Get-Item -Module Microsoft.PowerShell.Management @safeCommandLookupParameters
'Get-ItemProperty' = Get-Command -Name Get-ItemProperty -Module Microsoft.PowerShell.Management @safeCommandLookupParameters
'Get-Location' = Get-Command -Name Get-Location -Module Microsoft.PowerShell.Management @safeCommandLookupParameters
'Get-Member' = Get-Command -Name Get-Member -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Get-Module' = Get-Command -Name Get-Module -Module Microsoft.PowerShell.Core @safeCommandLookupParameters
'Get-PSDrive' = Get-Command -Name Get-PSDrive -Module Microsoft.PowerShell.Management @safeCommandLookupParameters
'Get-PSCallStack' = Get-Command -Name Get-PSCallStack -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Get-Unique' = Get-Command -Name Get-Unique -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Get-Variable' = Get-Command -Name Get-Variable -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Group-Object' = Get-Command -Name Group-Object -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Import-LocalizedData' = Get-Command -Name Import-LocalizedData -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Import-Module' = Get-Command -Name Import-Module -Module Microsoft.PowerShell.Core @safeCommandLookupParameters
'Join-Path' = Get-Command -Name Join-Path -Module Microsoft.PowerShell.Management @safeCommandLookupParameters
'Measure-Object' = Get-Command -Name Measure-Object -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'New-Item' = Get-Command -Name New-Item -Module Microsoft.PowerShell.Management @safeCommandLookupParameters
'New-ItemProperty' = Get-Command -Name New-ItemProperty -Module Microsoft.PowerShell.Management @safeCommandLookupParameters
'New-Module' = Get-Command -Name New-Module -Module Microsoft.PowerShell.Core @safeCommandLookupParameters
'New-Object' = Get-Command -Name New-Object -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'New-PSDrive' = Get-Command -Name New-PSDrive -Module Microsoft.PowerShell.Management @safeCommandLookupParameters
'New-Variable' = Get-Command -Name New-Variable -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Out-Host' = Get-Command -Name Out-Host -Module $outHostModule @safeCommandLookupParameters
'Out-File' = Get-Command -Name Out-File -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Out-Null' = Get-Command -Name Out-Null -Module $outNullModule @safeCommandLookupParameters
'Out-String' = Get-Command -Name Out-String -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Pop-Location' = Get-Command -Name Pop-Location -Module Microsoft.PowerShell.Management @safeCommandLookupParameters
'Push-Location' = Get-Command -Name Push-Location -Module Microsoft.PowerShell.Management @safeCommandLookupParameters
'Remove-Item' = Get-Command -Name Remove-Item -Module Microsoft.PowerShell.Management @safeCommandLookupParameters
'Remove-PSBreakpoint' = Get-Command -Name Remove-PSBreakpoint -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Remove-PSDrive' = Get-Command -Name Remove-PSDrive -Module Microsoft.PowerShell.Management @safeCommandLookupParameters
'Remove-Variable' = Get-Command -Name Remove-Variable -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Resolve-Path' = Get-Command -Name Resolve-Path -Module Microsoft.PowerShell.Management @safeCommandLookupParameters
'Select-Object' = Get-Command -Name Select-Object -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Set-Content' = Get-Command -Name Set-Content -Module Microsoft.PowerShell.Management @safeCommandLookupParameters
'Set-Location' = Get-Command -Name Set-Location -Module Microsoft.PowerShell.Management @safeCommandLookupParameters
'Set-PSBreakpoint' = Get-Command -Name Set-PSBreakpoint -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Set-StrictMode' = Get-Command -Name Set-StrictMode -Module Microsoft.PowerShell.Core @safeCommandLookupParameters
'Set-Variable' = Get-Command -Name Set-Variable -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Sort-Object' = Get-Command -Name Sort-Object -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Split-Path' = Get-Command -Name Split-Path -Module Microsoft.PowerShell.Management @safeCommandLookupParameters
'Start-Sleep' = Get-Command -Name Start-Sleep -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Test-Path' = Get-Command -Name Test-Path -Module Microsoft.PowerShell.Management @safeCommandLookupParameters
'Where-Object' = Get-Command -Name Where-Object -Module Microsoft.PowerShell.Core @safeCommandLookupParameters
'Write-Error' = Get-Command -Name Write-Error -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Write-Host' = Get-Command -Name Write-Host -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Write-Progress' = Get-Command -Name Write-Progress -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Write-Verbose' = Get-Command -Name Write-Verbose -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
'Write-Warning' = Get-Command -Name Write-Warning -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters
}
# Not all platforms have Get-WmiObject (Nano or PSCore 6.0.0-beta.x on Linux)
# Get-CimInstance is preferred, but we can use Get-WmiObject if it exists
# Moreover, it shouldn't really be fatal if neither of those cmdlets
# exist
if ( Get-Command -ea SilentlyContinue Get-CimInstance ) {
$script:SafeCommands['Get-CimInstance'] = Get-Command -Name Get-CimInstance -Module CimCmdlets @safeCommandLookupParameters
}
elseif ( Get-command -ea SilentlyContinue Get-WmiObject ) {
$script:SafeCommands['Get-WmiObject'] = Get-Command -Name Get-WmiObject -Module Microsoft.PowerShell.Management @safeCommandLookupParameters
}
elseif ( Get-Command -ea SilentlyContinue uname -Type Application ) {
$script:SafeCommands['uname'] = Get-Command -Name uname -Type Application | Select-Object -First 1
if ( Get-Command -ea SilentlyContinue id -Type Application ) {
$script:SafeCommands['id'] = Get-Command -Name id -Type Application | Select-Object -First 1
}
}
else {
Write-Warning "OS Information retrieval is not possible, reports will contain only partial system data"
}
# little sanity check to make sure we don't blow up a system with a typo up there
# (not that I've EVER done that by, for example, mapping New-Item to Remove-Item...)
foreach ($keyValuePair in $script:SafeCommands.GetEnumerator()) {
if ($keyValuePair.Key -ne $keyValuePair.Value.Name) {
throw "SafeCommands entry for $($keyValuePair.Key) does not hold a reference to the proper command."
}
}
$script:AssertionOperators = & $SafeCommands['New-Object'] 'Collections.Generic.Dictionary[string,object]'([StringComparer]::InvariantCultureIgnoreCase)
$script:AssertionAliases = & $SafeCommands['New-Object'] 'Collections.Generic.Dictionary[string,object]'([StringComparer]::InvariantCultureIgnoreCase)
$script:AssertionDynamicParams = & $SafeCommands['New-Object'] System.Management.Automation.RuntimeDefinedParameterDictionary
$script:DisableScopeHints = $true
function Count-Scopes {
param(
[Parameter(Mandatory = $true)]
$ScriptBlock)
if ($script:DisableScopeHints) {
return 0
}
# automatic variable that can help us count scopes must be constant a must not be all scopes
# from the standard ones only Error seems to be that, let's ensure it is like that everywhere run
# other candidate variables can be found by this code
# Get-Variable | where { -not ($_.Options -band [Management.Automation.ScopedItemOptions]"AllScope") -and $_.Options -band $_.Options -band [Management.Automation.ScopedItemOptions]"Constant" }
# get-variable steps on it's toes and recurses when we mock it in a test
# and we are also invoking this in user scope so we need to pass the reference
# to the safely captured function in the user scope
$safeGetVariable = $script:SafeCommands['Get-Variable']
$sb = {
param($safeGetVariable)
$err = (& $safeGetVariable -Name Error).Options
if ($err -band "AllScope" -or (-not ($err -band "Constant"))) {
throw "Error variable is set to AllScope, or is not marked as constant cannot use it to count scopes on this platform."
}
$scope = 0
while ($null -eq (& $safeGetVariable -Name Error -Scope $scope -ErrorAction SilentlyContinue)) {
$scope++
}
$scope - 1 # because we are in a function
}
$flags = [System.Reflection.BindingFlags]'Instance,NonPublic'
$property = [scriptblock].GetProperty('SessionStateInternal', $flags)
$ssi = $property.GetValue($ScriptBlock, $null)
$property.SetValue($sb, $ssi, $null)
&$sb $safeGetVariable
}
function Write-ScriptBlockInvocationHint {
param(
[Parameter(Mandatory = $true)]
[ScriptBlock] $ScriptBlock,
[Parameter(Mandatory = $true)]
[String]
$Hint
)
if ($script:DisableScopeHints) {
return
}
$scope = Get-ScriptBlockHint $ScriptBlock
$count = Count-Scopes -ScriptBlock $ScriptBlock
Write-Hint "Invoking scriptblock from location '$Hint' in state '$scope', $count scopes deep:
{
$ScriptBlock
}`n`n"
}
function Write-Hint ($Hint) {
if ($script:DisableScopeHints) {
return
}
Write-Host -ForegroundColor Cyan $Hint
}
function Test-Hint {
param (
[Parameter(Mandatory = $true)]
$InputObject
)
if ($script:DisableScopeHints) {
return $true
}
$property = $InputObject | Get-Member -Name Hint -MemberType NoteProperty
if ($null -eq $property) {
return $false
}
Test-NullOrWhiteSpace $property.Value
}
function Set-Hint {
param(
[Parameter(Mandatory = $true)]
[String] $Hint,
[Parameter(Mandatory = $true)]
$InputObject,
[Switch] $Force
)
if ($script:DisableScopeHints) {
return
}
if ($InputObject | Get-Member -Name Hint -MemberType NoteProperty) {
$hintIsNotSet = Test-NullOrWhiteSpace $InputObject.Hint
if ($Force -or $hintIsNotSet) {
$InputObject.Hint = $Hint
}
}
else {
# do not change this to be called without the pipeline, it will throw: Cannot evaluate parameter 'InputObject' because its argument is specified as a script block and there is no input. A script block cannot be evaluated without input.
$InputObject | Add-Member -Name Hint -Value $Hint -MemberType NoteProperty
}
}
function Set-SessionStateHint {
param(
[Parameter(Mandatory = $true)]
[String] $Hint,
[Parameter(Mandatory = $true)]
[Management.Automation.SessionState] $SessionState,
[Switch] $PassThru
)
if ($script:DisableScopeHints) {
if ($PassThru) {
return $SessionState
}
return
}
# in all places where we capture SessionState we mark its internal state with a hint
# the internal state does not change and we use it to invoke scriptblock in diferent
# states, setting the hint on SessionState is only secondary to make is easier to debug
$flags = [System.Reflection.BindingFlags]'Instance,NonPublic'
$internalSessionState = $SessionState.GetType().GetProperty('Internal', $flags).GetValue($SessionState, $null)
if ($null -eq $internalSessionState) {
throw "SessionState does not have any internal SessionState, this should never happen."
}
$hashcode = $internalSessionState.GetHashCode()
# optionally sets the hint if there was none, so the hint from the
# function that first captured this session state is preserved
Set-Hint -Hint "$Hint ($hashcode))" -InputObject $internalSessionState
# the public session state should always depend on the internal state
Set-Hint -Hint $internalSessionState.Hint -InputObject $SessionState -Force
if ($PassThru) {
$SessionState
}
}
function Get-SessionStateHint {
param(
[Parameter(Mandatory = $true)]
[Management.Automation.SessionState] $SessionState
)
if ($script:DisableScopeHints) {
return
}
# the hint is also attached to the session state object, but sessionstate objects are recreated while
# the internal state stays static so to see the hint on object that we receive via $PSCmdlet.SessionState we need
# to look at the InternalSessionState. the internal state should be never null so just looking there is enough
$flags = [System.Reflection.BindingFlags]'Instance,NonPublic'
$internalSessionState = $SessionState.GetType().GetProperty('Internal', $flags).GetValue($SessionState, $null)
if (Test-Hint $internalSessionState) {
$internalSessionState.Hint
}
}
function Set-ScriptBlockHint {
param(
[Parameter(Mandatory = $true)]
[ScriptBlock] $ScriptBlock,
[string] $Hint
)
if ($script:DisableScopeHints) {
return
}
$flags = [System.Reflection.BindingFlags]'Instance,NonPublic'
$internalSessionState = $ScriptBlock.GetType().GetProperty('SessionStateInternal', $flags).GetValue($ScriptBlock, $null)
if ($null -eq $internalSessionState) {
if (Test-Hint -InputObject $ScriptBlock) {
# the scriptblock already has a hint and there is not internal state
# so the hint on the scriptblock is enough
# if there was an internal state we would try to copy the hint from it
# onto the scriptblock to keep them in sync
return
}
if ($null -eq $Hint) {
throw "Cannot set ScriptBlock hint because it is unbound ScriptBlock (with null internal state) and no -Hint was provided."
}
# adds hint on the ScriptBlock
# the internal session state is null so we must attach the hint directly
# on the scriptblock
Set-Hint -Hint "$Hint (Unbound)" -InputObject $ScriptBlock -Force
}
else {
if (Test-Hint -InputObject $internalSessionState) {
# there already is hint on the internal state, we take it and sync
# it with the hint on the object
Set-Hint -Hint $internalSessionState.Hint -InputObject $ScriptBlock -Force
return
}
if ($null -eq $Hint) {
throw "Cannot set ScriptBlock hint because it's internal state does not have any Hint and no external -Hint was provided."
}
$hashcode = $internalSessionState.GetHashCode()
$Hint = "$Hint - ($hashCode)"
Set-Hint -Hint $Hint -InputObject $internalSessionState -Force
Set-Hint -Hint $Hint -InputObject $ScriptBlock -Force
}
}
function Get-ScriptBlockHint {
param(
[Parameter(Mandatory = $true)]
[ScriptBlock] $ScriptBlock
)
if ($script:DisableScopeHints) {
return
}
# the hint is also attached to the scriptblock object, but not all scriptblocks are tagged by us,
# the internal state stays static so to see the hint on object that we receive we need to look at the InternalSessionState
$flags = [System.Reflection.BindingFlags]'Instance,NonPublic'
$internalSessionState = $ScriptBlock.GetType().GetProperty('SessionStateInternal', $flags).GetValue($ScriptBlock, $null)
if ($null -ne $internalSessionState -and (Test-Hint $internalSessionState)) {
return $internalSessionState.Hint
}
if (Test-Hint $ScriptBlock) {
return $ScriptBlock.Hint
}
"Unknown unbound ScriptBlock"
}
function Test-NullOrWhiteSpace {
param ([string]$String)
$String -match "^\s*$"
}
function Assert-ValidAssertionName {
param([string]$Name)
if ($Name -notmatch '^\S+$') {
throw "Assertion name '$name' is invalid, assertion name must be a single word."
}
}
function Assert-ValidAssertionAlias {
param([string[]]$Alias)
if ($Alias -notmatch '^\S+$') {
throw "Assertion alias '$string' is invalid, assertion alias must be a single word."
}
}
function Add-AssertionOperator {
<#
.SYNOPSIS
Register an Assertion Operator with Pester
.DESCRIPTION
This function allows you to create custom Should assertions.
.EXAMPLE
```ps
function BeAwesome($ActualValue, [switch] $Negate)
{
[bool] $succeeded = $ActualValue -eq 'Awesome'
if ($Negate) { $succeeded = -not $succeeded }
if (-not $succeeded)
{
if ($Negate)
{
$failureMessage = "{$ActualValue} is Awesome"
}
else
{
$failureMessage = "{$ActualValue} is not Awesome"
}
}
return New-Object psobject -Property @{
Succeeded = $succeeded
FailureMessage = $failureMessage
}
}
Add-AssertionOperator -Name BeAwesome `
-Test $function:BeAwesome `
-Alias 'BA'
PS C:\> "bad" | should -BeAwesome
{bad} is not Awesome
```
.PARAMETER Name
The name of the assertion. This will become a Named Parameter of Should.
.PARAMETER Test
The test function. The function must return a PSObject with a [Bool]succeeded and a [string]failureMessage property.
.PARAMETER Alias
A list of aliases for the Named Parameter.
.PARAMETER SupportsArrayInput
Does the test function support the passing an array of values to test.
.PARAMETER InternalName
If -Name is different from the actual function name, record the actual function name here.
Used by Get-ShouldOperator to pull function help.
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string] $Name,
[Parameter(Mandatory = $true)]
[scriptblock] $Test,
[ValidateNotNullOrEmpty()]
[AllowEmptyCollection()]
[string[]] $Alias = @(),
[Parameter()]
[string] $InternalName,
[switch] $SupportsArrayInput
)
$entry = New-Object psobject -Property @{
Test = $Test
SupportsArrayInput = [bool]$SupportsArrayInput
Name = $Name
Alias = $Alias
InternalName = If ($InternalName) {
$InternalName
}
Else {
$Name
}
}
if (Test-AssertionOperatorIsDuplicate -Operator $entry) {
# This is an exact duplicate of an existing assertion operator.
return
}
$namesToCheck = @(
$Name
$Alias
)
Assert-AssertionOperatorNameIsUnique -Name $namesToCheck
$script:AssertionOperators[$Name] = $entry
foreach ($string in $Alias | Where { -not (Test-NullOrWhiteSpace $_) }) {
Assert-ValidAssertionAlias -Alias $string
$script:AssertionAliases[$string] = $Name
}
Add-AssertionDynamicParameterSet -AssertionEntry $entry
}
function Test-AssertionOperatorIsDuplicate {
param (
[psobject] $Operator
)
$existing = $script:AssertionOperators[$Operator.Name]
if (-not $existing) {
return $false
}
return $Operator.SupportsArrayInput -eq $existing.SupportsArrayInput -and
$Operator.Test.ToString() -eq $existing.Test.ToString() -and
-not (Compare-Object $Operator.Alias $existing.Alias)
}
function Assert-AssertionOperatorNameIsUnique {
param (
[string[]] $Name
)
foreach ($string in $name | Where { -not (Test-NullOrWhiteSpace $_) }) {
Assert-ValidAssertionName -Name $string
if ($script:AssertionOperators.ContainsKey($string)) {
throw "Assertion operator name '$string' has been added multiple times."
}
if ($script:AssertionAliases.ContainsKey($string)) {
throw "Assertion operator name '$string' already exists as an alias for operator '$($script:AssertionAliases[$key])'"
}
}
}
function Add-AssertionDynamicParameterSet {
param (
[object] $AssertionEntry
)
${function:__AssertionTest__} = $AssertionEntry.Test
$commandInfo = Get-Command __AssertionTest__ -CommandType Function
$metadata = [System.Management.Automation.CommandMetadata]$commandInfo
$attribute = New-Object Management.Automation.ParameterAttribute
$attribute.ParameterSetName = $AssertionEntry.Name
$attribute.Mandatory = $true
$attributeCollection = New-Object Collections.ObjectModel.Collection[Attribute]
$null = $attributeCollection.Add($attribute)
if (-not (Test-NullOrWhiteSpace $AssertionEntry.Alias)) {
Assert-ValidAssertionAlias -Alias $AssertionEntry.Alias
$attribute = New-Object System.Management.Automation.AliasAttribute($AssertionEntry.Alias)
$attributeCollection.Add($attribute)
}
$dynamic = New-Object System.Management.Automation.RuntimeDefinedParameter($AssertionEntry.Name, [switch], $attributeCollection)
$null = $script:AssertionDynamicParams.Add($AssertionEntry.Name, $dynamic)
if ($script:AssertionDynamicParams.ContainsKey('Not')) {
$dynamic = $script:AssertionDynamicParams['Not']
}
else {
$dynamic = New-Object System.Management.Automation.RuntimeDefinedParameter('Not', [switch], (New-Object System.Collections.ObjectModel.Collection[Attribute]))
$null = $script:AssertionDynamicParams.Add('Not', $dynamic)
}
$attribute = New-Object System.Management.Automation.ParameterAttribute
$attribute.ParameterSetName = $AssertionEntry.Name
$attribute.Mandatory = $false
$null = $dynamic.Attributes.Add($attribute)
$i = 1
foreach ($parameter in $metadata.Parameters.Values) {
# common parameters that are already defined
if ($parameter.Name -eq 'ActualValue' -or $parameter.Name -eq 'Not' -or $parameter.Name -eq 'Negate') {
continue
}
if ($script:AssertionOperators.ContainsKey($parameter.Name) -or $script:AssertionAliases.ContainsKey($parameter.Name)) {
throw "Test block for assertion operator $($AssertionEntry.Name) contains a parameter named $($parameter.Name), which conflicts with another assertion operator's name or alias."
}
foreach ($alias in $parameter.Aliases) {
if ($script:AssertionOperators.ContainsKey($alias) -or $script:AssertionAliases.ContainsKey($alias)) {
throw "Test block for assertion operator $($AssertionEntry.Name) contains a parameter named $($parameter.Name) with alias $alias, which conflicts with another assertion operator's name or alias."
}
}
if ($script:AssertionDynamicParams.ContainsKey($parameter.Name)) {
$dynamic = $script:AssertionDynamicParams[$parameter.Name]
}
else {
# We deliberately use a type of [object] here to avoid conflicts between different assertion operators that may use the same parameter name.
# We also don't bother to try to copy transformation / validation attributes here for the same reason.
# Because we'll be passing these parameters on to the actual test function later, any errors will come out at that time.
# few years later: using [object] causes problems with switch params (in my case -PassThru), because then we cannot use them without defining a value
# so for switches we must prefer the conflicts over type
if ([switch] -eq $parameter.ParameterType) {
$type = [switch]
}
else {
$type = [object]
}
$dynamic = New-Object System.Management.Automation.RuntimeDefinedParameter($parameter.Name, $type, (New-Object System.Collections.ObjectModel.Collection[Attribute]))
$null = $script:AssertionDynamicParams.Add($parameter.Name, $dynamic)
}
$attribute = New-Object Management.Automation.ParameterAttribute
$attribute.ParameterSetName = $AssertionEntry.Name
$attribute.Mandatory = $false
$attribute.Position = ($i++)
$null = $dynamic.Attributes.Add($attribute)
}
}
function Get-AssertionOperatorEntry([string] $Name) {
return $script:AssertionOperators[$Name]
}
function Get-AssertionDynamicParams {
return $script:AssertionDynamicParams
}
$Script:PesterRoot = & $SafeCommands['Split-Path'] -Path $MyInvocation.MyCommand.Path
"$PesterRoot\Functions\*.ps1", "$PesterRoot\Functions\Assertions\*.ps1" |
& $script:SafeCommands['Resolve-Path'] |
& $script:SafeCommands['Where-Object'] { -not ($_.ProviderPath.ToLower().Contains(".tests.")) } |
& $script:SafeCommands['ForEach-Object'] { . $_.ProviderPath }
if (& $script:SafeCommands['Test-Path'] "$PesterRoot\Dependencies") {
# sub-modules
& $script:SafeCommands['Get-ChildItem'] "$PesterRoot\Dependencies\*\*.psm1" |
& $script:SafeCommands['ForEach-Object'] { & $script:SafeCommands['Import-Module'] $_.FullName -Force -DisableNameChecking }
}
Add-Type -TypeDefinition @"
using System;
namespace Pester
{
[Flags]
public enum OutputTypes
{
None = 0,
Default = 1,
Passed = 2,
Failed = 4,
Pending = 8,
Skipped = 16,
Inconclusive = 32,
Describe = 64,
Context = 128,
Summary = 256,
Header = 512,
All = Default | Passed | Failed | Pending | Skipped | Inconclusive | Describe | Context | Summary | Header,
Fails = Default | Failed | Pending | Skipped | Inconclusive | Describe | Context | Summary | Header
}
}
"@
function Has-Flag {
param
(
[Parameter(Mandatory = $true)]
[Pester.OutputTypes]
$Setting,
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
[Pester.OutputTypes]
$Value
)
0 -ne ($Setting -band $Value)
}
function Invoke-Pester {
<#
.SYNOPSIS
Runs Pester tests
.DESCRIPTION
The Invoke-Pester function runs Pester tests, including *.Tests.ps1 files and
Pester tests in PowerShell scripts.
You can run scripts that include Pester tests just as you would any other
Windows PowerShell script, including typing the full path at the command line
and running in a script editing program. Typically, you use Invoke-Pester to run
all Pester tests in a directory, or to use its many helpful parameters,
including parameters that generate custom objects or XML files.
By default, Invoke-Pester runs all *.Tests.ps1 files in the current directory
and all subdirectories recursively. You can use its parameters to select tests
by file name, test name, or tag.
To run Pester tests in scripts that take parameter values, use the Script
parameter with a hash table value.
Also, by default, Pester tests write test results to the console host, much like
Write-Host does, but you can use the Show parameter set to None to suppress the host
messages, use the PassThru parameter to generate a custom object
(PSCustomObject) that contains the test results, use the OutputXml and
OutputFormat parameters to write the test results to an XML file, and use the
EnableExit parameter to return an exit code that contains the number of failed
tests.
You can also use the Strict parameter to fail all pending and skipped tests.
This feature is ideal for build systems and other processes that require success
on every test.
To help with test design, Invoke-Pester includes a CodeCoverage parameter that
lists commands, classes, functions, and lines of code that did not run during test
execution and returns the code that ran as a percentage of all tested code.
Invoke-Pester, and the Pester module that exports it, are products of an
open-source project hosted on GitHub. To view, comment, or contribute to the
repository, see https://github.com/Pester.
.PARAMETER Script
Specifies the test files that Pester runs. You can also use the Script parameter
to pass parameter names and values to a script that contains Pester tests. The
value of the Script parameter can be a string, a hash table, or a collection
of hash tables and strings. Wildcard characters are supported.
The Script parameter is optional. If you omit it, Invoke-Pester runs all
*.Tests.ps1 files in the local directory and its subdirectories recursively.
To run tests in other files, such as .ps1 files, enter the path and file name of
the file. (The file name is required. Name patterns that end in "*.ps1" run only
*.Tests.ps1 files.)
To run a Pester test with parameter names and/or values, use a hash table as the
value of the script parameter. The keys in the hash table are:
-- Path [string] (required): Specifies a test to run. The value is a path\file
name or name pattern. Wildcards are permitted. All hash tables in a Script
parameter value must have a Path key.
-- Parameters [hashtable]: Runs the script with the specified parameters. The
value is a nested hash table with parameter name and value pairs, such as
@{UserName = 'User01'; Id = '28'}.
-- Arguments [array]: An array or comma-separated list of parameter values
without names, such as 'User01', 28. Use this key to pass values to positional
parameters.
.PARAMETER TestName
Runs only tests in Describe blocks that have the specified name or name pattern.
Wildcard characters are supported.
If you specify multiple TestName values, Invoke-Pester runs tests that have any
of the values in the Describe name (it ORs the TestName values).
.PARAMETER EnableExit
Will cause Invoke-Pester to exit with a exit code equal to the number of failed
tests once all tests have been run. Use this to "fail" a build when any tests fail.
.PARAMETER OutputFile
The path where Invoke-Pester will save formatted test results log file.
The path must include the location and name of the folder and file name with
the xml extension.
If this path is not provided, no log will be generated.
.PARAMETER OutputFormat
The format of output. Two formats of output are supported: NUnitXml and
JUnitXml.
.PARAMETER Tag
Runs only tests in Describe blocks with the specified Tag parameter values.
Wildcard characters are supported. Tag values that include spaces or whitespace
will be split into multiple tags on the whitespace.
When you specify multiple Tag values, Invoke-Pester runs tests that have any
of the listed tags (it ORs the tags). However, when you specify TestName
and Tag values, Invoke-Pester runs only describe blocks that have one of the
specified TestName values and one of the specified Tag values.
If you use both Tag and ExcludeTag, ExcludeTag takes precedence.
.PARAMETER ExcludeTag
Omits tests in Describe blocks with the specified Tag parameter values. Wildcard
characters are supported. Tag values that include spaces or whitespace
will be split into multiple tags on the whitespace.
When you specify multiple ExcludeTag values, Invoke-Pester omits tests that have
any of the listed tags (it ORs the tags). However, when you specify TestName
and ExcludeTag values, Invoke-Pester omits only describe blocks that have one
of the specified TestName values and one of the specified Tag values.
If you use both Tag and ExcludeTag, ExcludeTag takes precedence
.PARAMETER PassThru
Returns a custom object (PSCustomObject) that contains the test results.
By default, Invoke-Pester writes to the host program, not to the output stream (stdout).
If you try to save the result in a variable, the variable is empty unless you
use the PassThru parameter.
To suppress the host output, use the Show parameter set to None.
.PARAMETER CodeCoverage
Adds a code coverage report to the Pester tests. Takes strings or hash table values.
A code coverage report lists the lines of code that did and did not run during
a Pester test. This report does not tell whether code was tested; only whether
the code ran during the test.
By default, the code coverage report is written to the host program
(like Write-Host). When you use the PassThru parameter, the custom object
that Invoke-Pester returns has an additional CodeCoverage property that contains
a custom object with detailed results of the code coverage test, including lines
hit, lines missed, and helpful statistics.
However, NUnitXml and JUnitXml output (OutputXML, OutputFormat) do not include
any code coverage information, because it's not supported by the schema.
Enter the path to the files of code under test (not the test file).
Wildcard characters are supported. If you omit the path, the default is local
directory, not the directory specified by the Script parameter. Pester test files
are by default excluded from code coverage when a directory is provided. When you
provide a test file directly using string, code coverage will be measured. To include
tests in code coverage of a directory, use the dictionary syntax and provide
IncludeTests = $true option, as shown below.
To run a code coverage test only on selected classes, functions or lines in a script,
enter a hash table value with the following keys:
-- Path (P)(mandatory) <string>: Enter one path to the files. Wildcard characters
are supported, but only one string is permitted.
-- IncludeTests <bool>: Includes code coverage for Pester test files (*.tests.ps1).
Default is false.
One of the following: Class/Function or StartLine/EndLine
-- Class (C) <string>: Enter the class name. Wildcard characters are
supported, but only one string is permitted. Default is *.
-- Function (F) <string>: Enter the function name. Wildcard characters are
supported, but only one string is permitted. Default is *.
-or-
-- StartLine (S): Performs code coverage analysis beginning with the specified
line. Default is line 1.
-- EndLine (E): Performs code coverage analysis ending with the specified line.
Default is the last line of the script.
.PARAMETER CodeCoverageOutputFile
The path where Invoke-Pester will save formatted code coverage results file.
The path must include the location and name of the folder and file name with
a required extension (usually the xml).
If this path is not provided, no file will be generated.
.PARAMETER CodeCoverageOutputFileEncoding
The encoding in which Invoke-Pester will save the code coverage results file
as. Defaults to 'utf8'.
Supported encodings in the respective PowerShell version are the same as
those supported by the cmdlet Out-File in that PowerShell version.
.PARAMETER CodeCoverageOutputFileFormat
The name of a code coverage report file format.
Default value is: JaCoCo.
Currently supported formats are:
- JaCoCo - this XML file format is compatible with the VSTS/TFS
.PARAMETER Strict
Makes Pending and Skipped tests to Failed tests. Useful for continuous
integration where you need to make sure all tests passed.
.PARAMETER Quiet
The parameter Quiet is deprecated since Pester v. 4.0 and will be deleted
in the next major version of Pester. Please use the parameter Show
with value 'None' instead.
The parameter Quiet suppresses the output that Pester writes to the host program,
including the result summary and CodeCoverage output.
This parameter does not affect the PassThru custom object or the XML output that
is written when you use the Output parameters.
.PARAMETER Show
Customizes the output Pester writes to the screen. Available options are None, Default,
Passed, Failed, Pending, Skipped, Inconclusive, Describe, Context, Summary, Header, All, Fails.
The options can be combined to define presets.
Common use cases are:
None - to write no output to the screen.
All - to write all available information (this is default option).
Fails - to write everything except Passed (but including Describes etc.).
A common setting is also Failed, Summary, to write only failed tests and test summary.
This parameter does not affect the PassThru custom object or the XML output that
is written when you use the Output parameters.
.PARAMETER PesterOption
Sets advanced options for the test execution. Enter a PesterOption object,
such as one that you create by using the New-PesterOption cmdlet, or a hash table
in which the keys are option names and the values are option values.
For more information on the options available, see the help for New-PesterOption.
.Example
Invoke-Pester
This command runs all *.Tests.ps1 files in the current directory and its subdirectories.
.Example
Invoke-Pester -Script .\Util*
This commands runs all *.Tests.ps1 files in subdirectories with names that begin
with 'Util' and their subdirectories.
.Example
Invoke-Pester -Script D:\MyModule, @{ Path = '.\Tests\Utility\ModuleUnit.Tests.ps1'; Parameters = @{ Name = 'User01' }; Arguments = srvNano16 }
This command runs all *.Tests.ps1 files in D:\MyModule and its subdirectories.
It also runs the tests in the ModuleUnit.Tests.ps1 file using the following
parameters: .\Tests\Utility\ModuleUnit.Tests.ps1 srvNano16 -Name User01
.Example
Invoke-Pester -Script @{Script = $scriptText}
This command runs all tests passed as string in $scriptText variable with no aditional parameters and arguments. This notation can be combined with
Invoke-Pester -Script D:\MyModule, @{ Path = '.\Tests\Utility\ModuleUnit.Tests.ps1'; Parameters = @{ Name = 'User01' }; Arguments = srvNano16 }
if needed. This command can be used when tests and scripts are stored not on the FileSystem, but somewhere else, and it is impossible to provide a path to it.
.Example
Invoke-Pester -TestName "Add Numbers"
This command runs only the tests in the Describe block named "Add Numbers".
.EXAMPLE
```ps
$results = Invoke-Pester -Script D:\MyModule -PassThru -Show None
$failed = $results.TestResult | where Result -eq 'Failed'
$failed.Name
cannot find help for parameter: Force : in Compress-Archive
help for Force parameter in Compress-Archive has wrong Mandatory value
help for Compress-Archive has wrong parameter type for Force
help for Update parameter in Compress-Archive has wrong Mandatory value
help for DestinationPath parameter in Expand-Archive has wrong Mandatory value
$failed[0]
Describe : Test help for Compress-Archive in Microsoft.PowerShell.Archive (1.0.0.0)
Context : Test parameter help for Compress-Archive
Name : cannot find help for parameter: Force : in Compress-Archive
Result : Failed
Passed : False
Time : 00:00:00.0193083
FailureMessage : Expected: value to not be empty
StackTrace : at line: 279 in C:\GitHub\PesterTdd\Module.Help.Tests.ps1
279: $parameterHelp.Description.Text | Should Not BeNullOrEmpty
ErrorRecord : Expected: value to not be empty
ParameterizedSuiteName :
Parameters : {}
```
This examples uses the PassThru parameter to return a custom object with the
Pester test results. By default, Invoke-Pester writes to the host program, but not
to the output stream. It also uses the Show parameter set to None to suppress the host output.
The first command runs Invoke-Pester with the PassThru and Show parameters and
saves the PassThru output in the $results variable.
The second command gets only failing results and saves them in the $failed variable.
The third command gets the names of the failing results. The result name is the
name of the It block that contains the test.
The fourth command uses an array index to get the first failing result. The
property values describe the test, the expected result, the actual result, and
useful values, including a stack trace.
.Example
Invoke-Pester -EnableExit -OutputFile ".\artifacts\TestResults.xml" -OutputFormat NUnitXml
This command runs all tests in the current directory and its subdirectories. It
writes the results to the TestResults.xml file using the NUnitXml schema. The
test returns an exit code equal to the number of test failures.
.EXAMPLE
Invoke-Pester -CodeCoverage 'ScriptUnderTest.ps1'
Runs all *.Tests.ps1 scripts in the current directory, and generates a coverage
report for all commands in the "ScriptUnderTest.ps1" file.
.EXAMPLE
Invoke-Pester -CodeCoverage @{ Path = 'ScriptUnderTest.ps1'; Function = 'FunctionUnderTest' }
Runs all *.Tests.ps1 scripts in the current directory, and generates a coverage
report for all commands in the "FunctionUnderTest" function in the "ScriptUnderTest.ps1" file.
.EXAMPLE
Invoke-Pester -CodeCoverage 'ScriptUnderTest.ps1' -CodeCoverageOutputFile '.\artifacts\TestOutput.xml'
Runs all *.Tests.ps1 scripts in the current directory, and generates a coverage
report for all commands in the "ScriptUnderTest.ps1" file, and writes the coverage report to TestOutput.xml
file using the JaCoCo XML Report DTD.
.EXAMPLE
Invoke-Pester -CodeCoverage @{ Path = 'ScriptUnderTest.ps1'; StartLine = 10; EndLine = 20 }
Runs all *.Tests.ps1 scripts in the current directory, and generates a coverage
report for all commands on lines 10 through 20 in the "ScriptUnderTest.ps1" file.
.EXAMPLE
Invoke-Pester -Script C:\Tests -Tag UnitTest, Newest -ExcludeTag Bug
This command runs *.Tests.ps1 files in C:\Tests and its subdirectories. In those
files, it runs only tests that have UnitTest or Newest tags, unless the test
also has a Bug tag.
.LINK
https://pester.dev/docs/commands/Describe
.LINK
https://pester.dev/docs/commands/New-PesterOption
#>
[CmdletBinding(DefaultParameterSetName = 'Default')]
param(
[Parameter(Position = 0, Mandatory = 0)]
[Alias('Path', 'relative_path')]
[object[]]$Script = '.',
[Parameter(Position = 1, Mandatory = 0)]
[Alias("Name")]
[string[]]$TestName,
[Parameter(Position = 2, Mandatory = 0)]
[switch]$EnableExit,
[Parameter(Position = 4, Mandatory = 0)]
[Alias('Tags')]
[string[]]$Tag,
[string[]]$ExcludeTag,
[switch]$PassThru,
[object[]] $CodeCoverage = @(),
[string] $CodeCoverageOutputFile,
[Parameter()]
[ValidateSet('ascii', 'bigendianunicode', 'oem', 'unicode', 'utf7', 'utf8', 'utf8BOM', 'utf8NoBOM', 'utf32')]
[string] $CodeCoverageOutputFileEncoding = 'utf8',
[ValidateSet('JaCoCo')]
[String]$CodeCoverageOutputFileFormat = "JaCoCo",
[Switch]$Strict,
[Parameter(Mandatory = $true, ParameterSetName = 'NewOutputSet')]
[string] $OutputFile,
[Parameter(ParameterSetName = 'NewOutputSet')]
[ValidateSet('NUnitXml', 'JUnitXml')]
[string] $OutputFormat = 'NUnitXml',
[Switch]$Quiet,
[object]$PesterOption,
[Pester.OutputTypes]$Show = 'All'
)
begin {
# Ensure when running Pester that we're using RSpec strings
& $script:SafeCommands['Import-LocalizedData'] -BindingVariable Script:ReportStrings -BaseDirectory $PesterRoot -FileName RSpec.psd1 -ErrorAction SilentlyContinue
# Fallback to en-US culture strings
If ([String]::IsNullOrEmpty($ReportStrings)) {
& $script:SafeCommands['Import-LocalizedData'] -BaseDirectory $PesterRoot -BindingVariable Script:ReportStrings -UICulture 'en-US' -FileName RSpec.psd1 -ErrorAction Stop
}
}
end {
if ($PSBoundParameters.ContainsKey('Quiet')) {
& $script:SafeCommands['Write-Warning'] 'The -Quiet parameter has been deprecated; please use the new -Show parameter instead. To get no output use -Show None.'
& $script:SafeCommands['Start-Sleep'] -Seconds 2
if (!$PSBoundParameters.ContainsKey('Show')) {
$Show = [Pester.OutputTypes]::None
}
}
$script:mockTable = @{ }
Remove-MockFunctionsAndAliases
$sessionState = Set-SessionStateHint -PassThru -Hint "Caller - Captured in Invoke-Pester" -SessionState $PSCmdlet.SessionState
$pester = New-PesterState -TestNameFilter $TestName -TagFilter $Tag -ExcludeTagFilter $ExcludeTag -SessionState $SessionState -Strict:$Strict -Show:$Show -PesterOption $PesterOption -RunningViaInvokePester
try {
Enter-CoverageAnalysis -CodeCoverage $CodeCoverage -PesterState $pester
Write-PesterStart $pester $Script
$invokeTestScript = {
param (
[Parameter(Position = 0)]
[string] $Path,
[string] $Script,
$Set_ScriptBlockHint,
[object[]] $Arguments = @(),
[System.Collections.IDictionary] $Parameters = @{ }
)
if (-not [string]::IsNullOrEmpty($Path)) {
& $Path @Parameters @Arguments
}
elseif (-not [string]::IsNullOrEmpty($Script)) {
$scriptBlock = [scriptblock]::Create($Script)
& $Set_ScriptBlockHint -Hint "Unbound ScriptBlock from Invoke-Pester" -ScriptBlock $scriptBlock
Invoke-Command -ScriptBlock ($scriptBlock)
}
}
Set-ScriptBlockScope -ScriptBlock $invokeTestScript -SessionState $sessionState
$testScripts = @(ResolveTestScripts $Script)
foreach ($testScript in $testScripts) {
#Get test description for better output
if (-not [string]::IsNullOrEmpty($testScript.Path)) {
$testDescription = $testScript.Path
}
elseif (-not [string]::IsNullOrEmpty($testScript.Script)) {
$testDescription = $testScript.Script
}
try {
$pester.EnterTestGroup($testDescription, 'Script')
Write-Describe $testDescription -CommandUsed Script
do {
$testOutput = & $invokeTestScript -Path $testScript.Path -Script $testScript.Script -Arguments $testScript.Arguments -Parameters $testScript.Parameters -Set_ScriptBlockHint $script:SafeCommands['Set-ScriptBlockHint']
} until ($true)
}
catch {
$firstStackTraceLine = $null
if (($_ | & $SafeCommands['Get-Member'] -Name ScriptStackTrace) -and $null -ne $_.ScriptStackTrace) {
$firstStackTraceLine = $_.ScriptStackTrace -split '\r?\n' | & $script:SafeCommands['Select-Object'] -First 1
}
$pester.AddTestResult("Error occurred in test script '$($testDescription)'", "Failed", $null, $_.Exception.Message, $firstStackTraceLine, $null, $null, $_)
# This is a hack to ensure that XML output is valid for now. The test-suite names come from the Describe attribute of the TestResult
# objects, and a blank name is invalid NUnit XML. This will go away when we promote test scripts to have their own test-suite nodes,
# planned for v4.0
$pester.TestResult[-1].Describe = "Error in $($testDescription)"
$pester.TestResult[-1] | Write-PesterResult
}
finally {
Exit-MockScope
$pester.LeaveTestGroup($testDescription, 'Script')
}
}
$pester | Write-PesterReport
$coverageReport = Get-CoverageReport -PesterState $pester
Write-CoverageReport -CoverageReport $coverageReport
if ((& $script:SafeCommands['Get-Variable'] -Name CodeCoverageOutputFile -ValueOnly -ErrorAction $script:IgnoreErrorPreference) `
-and (& $script:SafeCommands['Get-Variable'] -Name CodeCoverageOutputFileFormat -ValueOnly -ErrorAction $script:IgnoreErrorPreference) -eq 'JaCoCo') {
$jaCoCoReport = Get-JaCoCoReportXml -PesterState $pester -CoverageReport $coverageReport
$jaCoCoReport | & $SafeCommands['Out-File'] $CodeCoverageOutputFile -Encoding $CodeCoverageOutputFileEncoding
}
Exit-CoverageAnalysis -PesterState $pester
}
finally {
Exit-MockScope
}
Set-PesterStatistics
if (& $script:SafeCommands['Get-Variable'] -Name OutputFile -ValueOnly -ErrorAction $script:IgnoreErrorPreference) {
Export-PesterResults -PesterState $pester -Path $OutputFile -Format $OutputFormat
}
if ($PassThru) {
# Remove all runtime properties like current* and Scope
$properties = @(
"TagFilter", "ExcludeTagFilter", "TestNameFilter", "ScriptBlockFilter", "TotalCount", "PassedCount", "FailedCount", "SkippedCount", "PendingCount", 'InconclusiveCount', "Time", "TestResult"
if ($CodeCoverage) {
@{ Name = 'CodeCoverage'; Expression = { $coverageReport } }
}
)
$pester | & $script:SafeCommands['Select-Object'] -Property $properties
}
if ($EnableExit) {
Exit-WithCode -FailedCount $pester.FailedCount
}
}
}
function New-PesterOption {
<#
.SYNOPSIS
Creates an object that contains advanced options for Invoke-Pester
.DESCRIPTION
By using New-PesterOption you can set options what allow easier integration with external applications or
modifies output generated by Invoke-Pester.
The result of New-PesterOption need to be assigned to the parameter 'PesterOption' of the Invoke-Pester function.
.PARAMETER IncludeVSCodeMarker
When this switch is set, an extra line of output will be written to the console for test failures, making it easier
for VSCode's parser to provide highlighting / tooltips on the line where the error occurred.
.PARAMETER TestSuiteName
When generating NUnit XML output, this controls the name assigned to the root "test-suite" element. Defaults to "Pester".
.PARAMETER ScriptBlockFilter
Filters scriptblock based on the path and line number. This is intended for integration with external tools so we don't rely on names (strings) that can have expandable variables in them.
.PARAMETER Experimental
Enables experimental features of Pester to be enabled.
.PARAMETER ShowScopeHints
EXPERIMENTAL: Enables debugging output for debugging tranisition among scopes. (Experimental flag needs to be used to enable this.)
.INPUTS
None
You cannot pipe input to this command.
.OUTPUTS
System.Management.Automation.PSObject
.EXAMPLE
```ps
$Options = New-PesterOption -TestSuiteName "Tests - Set A"
Invoke-Pester -PesterOption $Options -Outputfile ".\Results-Set-A.xml" -OutputFormat NUnitXML
```
The result of commands will be execution of tests and saving results of them in a NUnitMXL file where the root "test-suite"
will be named "Tests - Set A".
.LINK
https://pester.dev/docs/commands/Invoke-Pester
#>
[CmdletBinding()]
param (
[switch] $IncludeVSCodeMarker,
[ValidateNotNullOrEmpty()]
[string] $TestSuiteName = 'Pester',
[switch] $Experimental,
[switch] $ShowScopeHints,
[hashtable[]] $ScriptBlockFilter
)
# in PowerShell 2 Add-Member can attach properties only to
# PSObjects, I could work around this by capturing all instances
# in checking them during runtime, but that would bring a lot of
# object management problems - so let's just not allow this in PowerShell 2
if ($Experimental -and $ShowScopeHints) {
if ($PSVersionTable.PSVersion.Major -lt 3) {
throw "Scope hints cannot be used on PowerShell 2 due to limitations of Add-Member."
}
$script:DisableScopeHints = $false
}
else {
$script:DisableScopeHints = $true
}
return & $script:SafeCommands['New-Object'] psobject -Property @{
IncludeVSCodeMarker = [bool] $IncludeVSCodeMarker
TestSuiteName = $TestSuiteName
ShowScopeHints = $ShowScopeHints
Experimental = $Experimental
ScriptBlockFilter = $ScriptBlockFilter
}
}
function ResolveTestScripts {
param ([object[]] $Path)
$resolvedScriptInfo = @(
foreach ($object in $Path) {
if ($object -is [System.Collections.IDictionary]) {
$unresolvedPath = Get-DictionaryValueFromFirstKeyFound -Dictionary $object -Key 'Path', 'p'
$script = Get-DictionaryValueFromFirstKeyFound -Dictionary $object -Key 'Script'
$arguments = @(Get-DictionaryValueFromFirstKeyFound -Dictionary $object -Key 'Arguments', 'args', 'a')
$parameters = Get-DictionaryValueFromFirstKeyFound -Dictionary $object -Key 'Parameters', 'params'
if ($null -eq $Parameters) {
$Parameters = @{ }
}
if ($unresolvedPath -isnot [string] -or $unresolvedPath -notmatch '\S' -and ($script -isnot [string] -or $script -notmatch '\S')) {
throw 'When passing hashtables to the -Path parameter, the Path key is mandatory, and must contain a single string.'
}
if ($null -ne $parameters -and $parameters -isnot [System.Collections.IDictionary]) {
throw 'When passing hashtables to the -Path parameter, the Parameters key (if present) must be assigned an IDictionary object.'
}
}
else {
$unresolvedPath = [string] $object
$script = [string] $object
$arguments = @()
$parameters = @{ }
}
if (-not [string]::IsNullOrEmpty($unresolvedPath)) {
if ($unresolvedPath -notmatch '[\*\?\[\]]' -and
(& $script:SafeCommands['Test-Path'] -LiteralPath $unresolvedPath -PathType Leaf) -and
(& $script:SafeCommands['Get-Item'] -LiteralPath $unresolvedPath) -is [System.IO.FileInfo]) {
$extension = [System.IO.Path]::GetExtension($unresolvedPath)
if ($extension -ne '.ps1') {
& $script:SafeCommands['Write-Error'] "Script path '$unresolvedPath' is not a ps1 file."
}
else {
& $script:SafeCommands['New-Object'] psobject -Property @{
Path = $unresolvedPath
Script = $null
Arguments = $arguments
Parameters = $parameters
}
}
}
else {
# World's longest pipeline?
& $script:SafeCommands['Resolve-Path'] -Path $unresolvedPath |
& $script:SafeCommands['Where-Object'] { $_.Provider.Name -eq 'FileSystem' } |
& $script:SafeCommands['Select-Object'] -ExpandProperty ProviderPath |
& $script:SafeCommands['Get-ChildItem'] -Include *.Tests.ps1 -Recurse |
& $script:SafeCommands['Where-Object'] { -not $_.PSIsContainer } |
& $script:SafeCommands['Select-Object'] -ExpandProperty FullName -Unique |
& $script:SafeCommands['ForEach-Object'] {
& $script:SafeCommands['New-Object'] psobject -Property @{
Path = $_
Script = $null
Arguments = $arguments
Parameters = $parameters
}
}
}
}
elseif (-not [string]::IsNullOrEmpty($script)) {
& $script:SafeCommands['New-Object'] psobject -Property @{
Path = $null
Script = $script
Arguments = $arguments
Parameters = $parameters
}
}
}
)
# Here, we have the option of trying to weed out duplicate file paths that also contain identical
# Parameters / Arguments. However, we already make sure that each object in $Path didn't produce
# any duplicate file paths, and if the caller happens to pass in a set of parameters that produce
# dupes, maybe that's not our problem. For now, just return what we found.
$resolvedScriptInfo
}
function Get-DictionaryValueFromFirstKeyFound {
param ([System.Collections.IDictionary] $Dictionary, [object[]] $Key)
foreach ($keyToTry in $Key) {
if ($Dictionary.Contains($keyToTry)) {
return $Dictionary[$keyToTry]
}
}
}
function Set-ScriptBlockScope {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[scriptblock]
$ScriptBlock,
[Parameter(Mandatory = $true, ParameterSetName = 'FromSessionState')]
[System.Management.Automation.SessionState]
$SessionState,
[Parameter(Mandatory = $true, ParameterSetName = 'FromSessionStateInternal')]
[AllowNull()]
$SessionStateInternal
)
$flags = [System.Reflection.BindingFlags]'Instance,NonPublic'
if ($PSCmdlet.ParameterSetName -eq 'FromSessionState') {
$SessionStateInternal = $SessionState.GetType().GetProperty('Internal', $flags).GetValue($SessionState, $null)
}
$property = [scriptblock].GetProperty('SessionStateInternal', $flags)
$scriptBlockSessionState = $property.GetValue($ScriptBlock, $null)
if (-not $script:DisableScopeHints) {
# hint can be attached on the internal state (preferable) when the state is there.
# if we are given unbound scriptblock with null internal state then we hope that
# the source cmdlet set the hint directly on the ScriptBlock,
# otherwise the origin is unknown and the cmdlet that allowed this scriptblock in
# should be found and add hint
$hint = $scriptBlockSessionState.Hint
if ($null -eq $hint) {
if ($null -ne $ScriptBlock.Hint) {
$hint = $ScriptBlock.Hint
}
else {
$hint = 'Unknown unbound ScriptBlock'
}
}
Write-Hint "Setting ScriptBlock state from source state '$hint' to '$($SessionStateInternal.Hint)'"
}
$property.SetValue($ScriptBlock, $SessionStateInternal, $null)
if (-not $script:DisableScopeHints) {
Set-ScriptBlockHint -ScriptBlock $ScriptBlock
}
}
function Get-ScriptBlockScope {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[scriptblock]
$ScriptBlock
)
$flags = [System.Reflection.BindingFlags]'Instance,NonPublic'
$sessionStateInternal = [scriptblock].GetProperty('SessionStateInternal', $flags).GetValue($ScriptBlock, $null)
if (-not $script:DisableScopeHints) {
Write-Hint "Getting scope from ScriptBlock '$($sessionStateInternal.Hint)'"
}
$sessionStateInternal
}
function SafeGetCommand {
<#
.SYNOPSIS
This command is used by Pester's Mocking framework. You do not need to call it directly.
#>
return $script:SafeCommands['Get-Command']
}
function Set-PesterStatistics($Node) {
if ($null -eq $Node) {
$Node = $pester.TestActions
}
foreach ($action in $Node.Actions) {
if ($action.Type -eq 'TestGroup') {
Set-PesterStatistics -Node $action
$Node.TotalCount += $action.TotalCount
$Node.PassedCount += $action.PassedCount
$Node.FailedCount += $action.FailedCount
$Node.SkippedCount += $action.SkippedCount
$Node.PendingCount += $action.PendingCount
$Node.InconclusiveCount += $action.InconclusiveCount
}
elseif ($action.Type -eq 'TestCase') {
$node.TotalCount++
switch ($action.Result) {
Passed {
$Node.PassedCount++; break;
}
Failed {
$Node.FailedCount++; break;
}
Skipped {
$Node.SkippedCount++; break;
}
Pending {
$Node.PendingCount++; break;
}
Inconclusive {
$Node.InconclusiveCount++; break;
}
}
}
}
}
function Contain-AnyStringLike ($Filter, $Collection) {
foreach ($item in $Collection) {
foreach ($value in $Filter) {
if ($item -like $value) {
return $true
}
}
}
return $false
}
$snippetsDirectoryPath = "$PSScriptRoot\Snippets"
if ((& $script:SafeCommands['Test-Path'] -Path Variable:\psise) -and
($null -ne $psISE) -and
($PSVersionTable.PSVersion.Major -ge 3) -and
(& $script:SafeCommands['Test-Path'] $snippetsDirectoryPath)) {
Import-IseSnippet -Path $snippetsDirectoryPath
}
function Assert-VerifiableMocks {
<#
.SYNOPSIS
The function is for backward compatibility only. Please update your code and use 'Assert-VerifiableMock' instead.
.DESCRIPTION
The function was reintroduced in the version 4.0.8 of Pester to avoid loading older version of Pester when Assert-VerifiableMocks is called.
The function will be removed finally in the next major version of Pester.
.LINK
https://pester.dev/docs/migrations/v3-to-v4
.LINK
https://github.com/pester/Pester/issues/880
#>
[CmdletBinding()]
param()
Throw "This command has been renamed to 'Assert-VerifiableMock' (without the 's' at the end), please update your code. For more information see: https://pester.dev/docs/migrations/v3-to-v4"
}
$script:SafeCommands['Set-ScriptBlockHint'] = & $script:SafeCommands['Get-Command'] -Name Set-ScriptBlockHint -ErrorAction Stop
Set-SessionStateHint -Hint Pester -SessionState $ExecutionContext.SessionState
# in the future rename the function to Add-ShouldOperator
Set-Alias -Name Add-ShouldOperator -Value Add-AssertionOperator
$script:ConflictingParameterNames = Initialize-ConflictingParameterNames
& $script:SafeCommands['Export-ModuleMember'] Describe, Context, It, In, Mock, Assert-VerifiableMock, Assert-VerifiableMocks, Assert-MockCalled, Set-TestInconclusive, Set-ItResult
& $script:SafeCommands['Export-ModuleMember'] New-Fixture, Get-TestDriveItem, Should, Invoke-Pester, Setup, InModuleScope, Invoke-Mock
& $script:SafeCommands['Export-ModuleMember'] BeforeEach, AfterEach, BeforeAll, AfterAll
& $script:SafeCommands['Export-ModuleMember'] Get-MockDynamicParameter, Set-DynamicParameterVariable
& $script:SafeCommands['Export-ModuleMember'] SafeGetCommand, New-PesterOption
& $script:SafeCommands['Export-ModuleMember'] Invoke-Gherkin, Find-GherkinStep, BeforeEachFeature, BeforeEachScenario, AfterEachFeature, AfterEachScenario, GherkinStep, Set-StepPending -Alias Given, When, Then, And, But
& $script:SafeCommands['Export-ModuleMember'] New-MockObject, Add-AssertionOperator, Get-ShouldOperator -Alias Add-ShouldOperator
# SIG # Begin signature block
# MIIZbgYJKoZIhvcNAQcCoIIZXzCCGVsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUOF7f1KzKUdA9pFsPpwzYEPuZ
# lPCgghR8MIIE/jCCA+agAwIBAgIQDUJK4L46iP9gQCHOFADw3TANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgVGltZXN0YW1waW5nIENBMB4XDTIxMDEwMTAwMDAwMFoXDTMxMDEw
# NjAwMDAwMFowSDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMu
# MSAwHgYDVQQDExdEaWdpQ2VydCBUaW1lc3RhbXAgMjAyMTCCASIwDQYJKoZIhvcN
# AQEBBQADggEPADCCAQoCggEBAMLmYYRnxYr1DQikRcpja1HXOhFCvQp1dU2UtAxQ
# tSYQ/h3Ib5FrDJbnGlxI70Tlv5thzRWRYlq4/2cLnGP9NmqB+in43St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sl6LoD67jFxPh5/hCOdhmB4YZYyAJ9mkQSrRkTdr/t6+fi9u2AddCRlIzjPf
# H9YP47Amgf4nQtol1/lBbawsARzLqbGBOKkyaMfZ2q+A13ZdxuvlfkF9NAObQKGC
# AjAwggIsBgkqhkiG9w0BCQYxggIdMIICGQIBATCBhjByMQswCQYDVQQGEwJVUzEV
# MBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29t
# MTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgVGltZXN0YW1waW5n
# IENBAhANQkrgvjqI/2BAIc4UAPDdMA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcN
# AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwNTI5MTIyNzU4WjAv
# BgkqhkiG9w0BCQQxIgQgbCZb84Wg7vYRd5RoaqJqqI9nKk+5X1tOCvIGTnHVAzEw
# DQYJKoZIhvcNAQEBBQAEggEAXlM3z4okuijg3Rvjy7PLfdXDnpVigFgo3PdC9ApP
# XX+bi4WY5kS3Z/2jSM7Hhu6BsEV4jV3kS+qeuYRTR40YC9KS3a3rF8VRTchRo2uQ
# fpEqjIB/jE12cj9kFEihKNifvIaP/alcFMvLHblwp6XwZ1vr6PXl8nmP+UtvdoUk
# 0HiPbTMeV8kyMU1KoZZYmLIJSV6wH5EQRmxO87+K1RoHpm8ZMXvx4g6RZdjOAWH4
# WfX1H7e9Hgxugkqg6m3bv93yRofblP0qYiWxFyeinwU9vA2Sc94a0SJc7DLxJtgw
# ZnmVW7ULhIoo+9HkYpFwjeirZ46ewJlLFlAlXEI1XjIURA==
# SIG # End signature block
VERIFICATION
Verification is intended to assist the Chocolatey moderators and community
in verifying that this package's contents are trustworthy.
You can use one of the following methods to obtain the checksum
- Use powershell function 'Get-Filehash'
- Use chocolatey utility 'checksum.exe'
CHECKSUMS
file: lib\Gherkin\core\Gherkin.dll
checksum: 352A6A598BA8D1E350F497791A9FB9AC64BA11E977FF6CCB7432D8516DDF7685
algorithm: sha256
file: lib\Gherkin\legacy\Gherkin.dll
checksum: 2BF80E108FC1A112D9AC9E631D29903028EEBABD2A7831ACFCE88CCBEFDF773E
algorithm: sha256
file: lib\Gherkin\legacy\Newtonsoft.Json.dll
checksum: EFD8CF9A3BC2AB4E15FA33D42771E18D78539759CBF30652DF4C43E6825CE5F0
algorithm: sha256
file: lib\Gherkin\gherkin-languages.json
checksum: 8201E11FEF81C3320FA8845B85E9850F2547415C27DCD9F0D07C5E2E3D104CF3
algorithm: sha256
Log in or click on link to see number of positives.
- pester.4.10.2-beta1.nupkg (ef5fb8eb4771) - ## / 63
- Gherkin.dll (5fe4e79e120c) - ## / 67
- Newtonsoft.Json.dll (551de308c034) - ## / 68
- Gherkin.dll (35551f5cba29) - ## / 66
In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).
Chocolatey Pro provides runtime protection from possible malware.
Add to Builder | Version | Downloads | Last Updated | Status |
---|---|---|---|---|
Pester 5.6.1 | 20399 | Monday, July 1, 2024 | Approved | |
Pester 5.6.0 | 4870 | Wednesday, June 5, 2024 | Approved | |
Pester 5.5.0 | 19268 | Tuesday, June 27, 2023 | Approved | |
Pester 5.4.1 | 5106 | Wednesday, April 5, 2023 | Approved | |
Pester 5.4.0 | 5257 | Tuesday, January 10, 2023 | Approved | |
Pester 5.3.3 | 22033 | Friday, April 29, 2022 | Approved | |
Pester 5.3.2 | 907 | Friday, April 22, 2022 | Approved | |
Pester 5.3.1 | 13015 | Tuesday, September 21, 2021 | Approved | |
Pester 5.3.0 | 3819 | Tuesday, August 17, 2021 | Approved | |
Pester 5.2.2 | 9272 | Thursday, May 27, 2021 | Approved | |
Pester 5.2.1 | 1369 | Thursday, May 13, 2021 | Approved | |
Pester 5.2.0 | 976 | Thursday, May 6, 2021 | Approved | |
Pester 5.1.1 | 6031 | Wednesday, February 10, 2021 | Approved | |
Pester 5.1.0 | 150 | Wednesday, February 10, 2021 | Approved | |
Pester 5.0.4 | 2786 | Wednesday, February 10, 2021 | Approved | |
Pester 5.0.4-beta1 | 317 | Thursday, August 13, 2020 | Exempted | |
Pester 4.10.2-beta1 | 99 | Saturday, May 29, 2021 | Approved | |
Pester 4.10.1 | 21542 | Friday, February 7, 2020 | Approved | |
Pester 4.9.0 | 10974 | Sunday, September 8, 2019 | Approved | |
Pester 4.8.1 | 8468 | Saturday, May 11, 2019 | Approved | |
Pester 4.8.0 | 1134 | Wednesday, May 1, 2019 | Approved | |
Pester 4.7.3 | 3513 | Saturday, March 23, 2019 | Approved | |
Pester 4.7.2 | 1386 | Friday, March 8, 2019 | Approved | |
Pester 4.7.1 | 645 | Tuesday, March 5, 2019 | Approved | |
Pester 4.7.0 | 633 | Sunday, March 3, 2019 | Approved | |
Pester 4.4.1 | 9044 | Thursday, September 20, 2018 | Approved | |
Pester 4.4.0 | 5061 | Friday, July 20, 2018 | Approved | |
Pester 4.4.0-beta2 | 336 | Sunday, July 8, 2018 | Approved | |
Pester 4.4.0-beta | 445 | Sunday, May 6, 2018 | Approved | |
Pester 4.3.1 | 7612 | Tuesday, February 20, 2018 | Approved | |
Pester 4.3.0 | 435 | Tuesday, February 20, 2018 | Approved | |
Pester 4.2.0 | 543 | Sunday, February 18, 2018 | Approved | |
Pester 4.2.0-alpha3 | 420 | Sunday, December 17, 2017 | Exempted | |
Pester 4.2.0-alpha2 | 435 | Tuesday, December 12, 2017 | Exempted | |
Pester 4.1.0 | 6086 | Sunday, November 26, 2017 | Approved | |
Pester 4.0.6-rc | 601 | Thursday, August 17, 2017 | Approved | |
Pester 4.0.5-rc | 491 | Tuesday, July 25, 2017 | Approved | |
Pester 4.0.3-rc | 521 | Wednesday, March 22, 2017 | Approved | |
Pester 4.0.2-rc | 551 | Wednesday, January 18, 2017 | Approved | |
Pester 4.0.1-rc | 425 | Wednesday, January 18, 2017 | Approved | |
Pester 4.0.0-rc1 | 490 | Wednesday, January 18, 2017 | Approved | |
Pester 3.4.6 | 28688 | Friday, January 13, 2017 | Approved | |
Pester 3.4.3 | 15507 | Friday, August 26, 2016 | Approved | |
Pester 3.4.2 | 1351 | Tuesday, August 2, 2016 | Approved | |
Pester 3.4.1 | 8938 | Friday, July 22, 2016 | Approved | |
Pester 3.4.0 | 5951 | Tuesday, March 1, 2016 | Approved | |
Pester 3.3.14 | 5532 | Wednesday, December 16, 2015 | Approved | |
Pester 3.3.13 | 9983 | Thursday, December 10, 2015 | Approved | |
Pester 3.3.12 | 634 | Tuesday, December 8, 2015 | Approved | |
Pester 3.3.11 | 7067 | Tuesday, September 8, 2015 | Approved | |
Pester 3.3.10 | 2364 | Friday, August 14, 2015 | Approved | |
Pester 3.3.9 | 6696 | Sunday, May 24, 2015 | Approved | |
Pester 3.3.8 | 5036 | Wednesday, April 15, 2015 | Approved | |
Pester 3.3.7 | 502 | Wednesday, April 15, 2015 | Approved | |
Pester 3.3.6 | 1896 | Thursday, March 19, 2015 | Approved | |
Pester 3.3.5 | 2816 | Friday, January 23, 2015 | Approved | |
Pester 3.3.4 | 515 | Thursday, January 22, 2015 | Approved | |
Pester 3.3.3 | 462 | Thursday, January 22, 2015 | Approved | |
Pester 3.3.2 | 494 | Monday, January 19, 2015 | Approved | |
Pester 3.3.1 | 528 | Monday, January 12, 2015 | Approved | |
Pester 3.3.0 | 440 | Saturday, January 10, 2015 | Approved | |
Pester 3.2.0 | 667 | Saturday, December 13, 2014 | Approved | |
Pester 3.1.1 | 656 | Wednesday, October 29, 2014 | Approved | |
Pester 3.0.3 | 478 | Monday, October 13, 2014 | Approved | |
Pester 3.0.2 | 669 | Monday, September 8, 2014 | Approved | |
Pester 3.0.1.1 | 538 | Thursday, August 28, 2014 | Approved | |
Pester 3.0.0 | 470 | Thursday, August 21, 2014 | Approved | |
Pester 3.0.0-beta2 | 548 | Friday, July 4, 2014 | Approved | |
Pester 3.0.0-beta | 556 | Wednesday, June 25, 2014 | Approved | |
Pester 2.1.0 | 598 | Sunday, June 15, 2014 | Approved | |
Pester 2.0.4 | 664 | Sunday, March 9, 2014 | Approved | |
Pester 2.0.3 | 979 | Tuesday, April 16, 2013 | Approved | |
Pester 2.0.2 | 6078 | Thursday, February 28, 2013 | Approved | |
Pester 2.0.1 | 568 | Sunday, February 3, 2013 | Approved | |
Pester 1.2.1 | 559 | Sunday, February 3, 2013 | Approved | |
Pester 1.1.0 | 611 | Sunday, November 4, 2012 | Approved | |
Pester 1.0.7-alpha-0 | 575 | Tuesday, October 2, 2012 | Approved | |
Pester 1.0.6 | 566 | Sunday, August 12, 2012 | Approved |
This package has no dependencies.
Ground Rules:
- This discussion is only about Pester and the Pester package. If you have feedback for Chocolatey, please contact the Google Group.
- This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
- The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
- Tell us what you love about the package or Pester, or tell us what needs improvement.
- Share your experiences with the package, or extra configuration or gotchas that you've found.
- If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.