Breaking down help tests for CI and Feature test runs

This commit is contained in:
Francisco Gamino 2016-08-09 17:03:32 -07:00
parent 3ed7201e21
commit 233e75657a
2 changed files with 41 additions and 16 deletions

View file

@ -17,6 +17,7 @@
},
"runtimes": {
"ubuntu.16.04-x64": { },
"ubuntu.14.04-x64": { },
"debian.8-x64": { },
"centos.7-x64": { },

View file

@ -1,25 +1,49 @@
Describe 'Basic help system tests' -Tags "CI" {
#
# Validates Get-Help for cmdlets in Microsoft.PowerShell.Core.
Context "Validate help content for cmdlets in Microsof.PowerShell.Core" {
function RunTestCase
{
param ([string]$tag = "CI")
$cmdlets = get-command -module "Microsoft.PowerShell.Core"
$cmdletsToSkip = @(
"Get-PSHostProcessInfo",
"Out-Default",
"Register-ArgumentCompleter"
)
$cmdlets = get-command -module "Microsoft.PowerShell.Core"
foreach ($cmdletName in $cmdlets)
$cmdletsToSkip = @(
"Get-PSHostProcessInfo",
"Out-Default",
"Register-ArgumentCompleter"
)
$testCaseExecuted = $false
foreach ($cmdletName in $cmdlets)
{
if ($cmdletsToSkip -notcontains $cmdletName)
{
if ($cmdletsToSkip -notcontains $cmdletName)
{
It "Validate -Description and -Examples sections in help content. Run 'Get-help -name $cmdletName'" {
It "Validate -Description and -Examples sections in help content. Run 'Get-help -name $cmdletName'" {
$help = get-help -name $cmdletName
$help.Description | Out-String | Should Match $cmdletName
$help.Examples | Out-String | Should Match $cmdletName
}
$help = get-help -name $cmdletName
$help.Description | Out-String | Should Match $cmdletName
$help.Examples | Out-String | Should Match $cmdletName
$testCaseExecuted = $true
}
if (($tag -eq "CI") -and $testCaseExecuted)
{
# For a CI test run, we are only interested in validating one cmdlet to ensure that
# get-help <cmdletName> works.
break
}
}
}
}
Describe "Validate that get-help <cmdletName> works" -Tags "CI" {
RunTestCase -tag "CI"
}
Describe "Validate Get-Help for all cmdlets in 'Microsoft.PowerShell.Core'" -Tags "Feature" {
RunTestCase
}