PowerShell / Operation-Validation-Framework

MIT License
225 stars 32 forks source link

Add support for filtering on Pester tags #16

Closed devblackops closed 7 years ago

devblackops commented 7 years ago

Description

This PR adds support for specifying Pester tags when searching for or invoking OVF tests via two new parameters (-Tag and -ExcludeTag) to Get-OperationValidation and Invoke-OperationValidation. It also addresses some PSScriptAnalyzer rule failures and some minor code cleanup.

Related Issue

Fixes #10

Motivation and Context

Since Pester includes the ability to attach tags to Describe blocks and filter test execution based on them, that ability is needed in OVF as well.

How Has This Been Tested?

Associated Pester tests have been created to validate OVF can retrieve tests based on a tag or exclude tests with a tag.

Since we're using AST to inspect the Pester test script and pull out the Describe block name and any tags, the Pester script is not actually executed when Get-OperationValidation searches for matching tests. Therefore expressions will not work when defining tags.

This will work

describe 'Service Checks' -Tags 'services' {
    ...
}

This will NOT work

$myTag = 'services'
describe 'Service Checks' -Tags $myTag {
    ...
}

Types of changes


This change is Reviewable