This repository has been archived on 2022-11-03. You can view files and clone it, but cannot push or open issues or pull requests.
DevOpsOpenHack/iac/terraform/smokeTest.ps1

35 lines
826 B
PowerShell
Raw Normal View History

2022-11-03 20:41:13 +00:00
param(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string[]] $HostNames = @()
)
if (!(Get-Module -Name Pester)) {
Write-Host "Pester module does not exist. Installing ..."
try {
Install-Module Pester -AllowClobber -Force -Confirm:$False -SkipPublisherCheck
}
catch [Exception] {
$_.message
exit
}
}
Import-Module Pester
$container = New-PesterContainer `
-Path 'appService.Test.ps1' `
-Data @{ HostNames = $HostNames }
$config = New-PesterConfiguration
$config.Run.PassThru = $true
$config.Run.Container = $container
$config.TestResult.Enabled = $true
$config.TestResult.OutputFormat = 'NUnitXml'
$config.TestResult.OutputPath = 'testResultsNunit.xml'
$p = Invoke-Pester -Configuration $config
$p | Export-JUnitReport -Path 'testResultsJunit.xml'