Skip to content

Script Tests

Andrew Davidson edited this page Jan 21, 2021 · 6 revisions

Script Tests

Test Tag Description
All Script Run all test (this is the default option)
check script has valid PowerShell syntax ValidSyntax Check that the script file is a valid
check help must contain required elements HelpMustContainRequiredElements Using the HelpElementRules.psd1 validates that all the required elements specified exist in the help comments
check help must not contain unspecified elements HelpMustContainUnspecifiedElements Using the HelpElementRules.psd1 validates that all help comments don't contain any unspecified
check help elements text is not empty HelpElementsNotEmpty Check that the help elements are not empty
check help elements Min/Max counts are valid HelpElementsMinMaxCount Check that the elements are within min/max boundaries
check script contains [CmdletBinding] attribute ContainsCmdletBinding Check that function contains the [CmdletBinding] attribute
check script contains [OutputType] attribute ContainsOutputType Check that function contains the [OutputType] attribute
check script [OutputType] attribute is not empty OutputTypeNotEmpty Check that [OutputType] attribute is not empty
check script contains param attribute ContainsParam Check that the functions contains param block
check script param block variables have type ParamVariablesHaveType Check that each parameter has a type
check .PARAMETER help matches variables in param block HelpMatchesParamVariables Check that the Parameters help matches param block
check script contains no PSScriptAnalyzer suppressions NoScriptAnalyzerSuppressions Check that there are no PSScriptAnalyzer suppressions
check script contains no PSScriptAnalyser failures NoScriptAnalyzerFailures Check that there are no PSScriptAnalyzer failures
check script contains no PSScriptAnalyser Extra rules failures NoScriptAnalyzerExtraRulesFailures Check that there are no PSScriptAnalyzer failures with the any extra rules
check Import-Module statements have valid format ValidImportModuleStatements Check that the Import-Module statements include the Name and either RequiredVersion or MinimumVersion parameters
Clone this wiki locally