Files
PowerCLI-Example-Scripts/Modules/VMware.vSphere.SsoAdmin/src/test/RunTests.ps1
Dimitar Milov ef804e6a05 Migrated to Pester 5.1
Migrated to netcoreapp3.1
2021-02-16 19:10:43 +02:00

51 lines
1.2 KiB
PowerShell

# **************************************************************************
# Copyright 2020 VMware, Inc.
# **************************************************************************
param(
[Parameter(Mandatory = $true)]
[string]
$VcAddress,
[Parameter(Mandatory = $true)]
[string]
$User,
[Parameter(Mandatory = $true)]
[string]
$Password
)
function Test-PesterIsAvailable() {
$pesterModules = Get-Module Pester -ListAvailable
$pesterModule = $null
# Search for Pester 4.X
foreach ($p in $pesterModules) {
if ($p.Version -ge [version]"5.0.0") {
$pesterModule = $p
break
}
}
if ($pesterModule -eq $null) {
throw "Pester Module version 5.X is not available"
}
Import-Module -Name $pesterModule.Name -RequiredVersion $pesterModule.RequiredVersion
}
Test-PesterIsAvailable
$testsData = @{
VcAddress = $VcAddress
User = $User
Password = $Password
}
$pesterContainer = New-PesterContainer -Path $PSScriptRoot -Data $testsData
$pesterConfiguration = [PesterConfiguration]::Default
$pesterConfiguration.Run.Path = $PSScriptRoot
$pesterConfiguration.Run.Container = $pesterContainer
Invoke-Pester -Configuration $pesterConfiguration