Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Pester tests with dynamic names result in no output from Invoke-OperationValidation #15

Open
@ChrisMagnuson

Description

@ChrisMagnuson

The following results in no output:

Invoke-OperationValidation -ModuleName tervisactivedirectory -IncludePesterOutput

File Simple.tests.ps1 in TervisActiveDirectory\Diagnostics\Simple

$ADUsers = Get-ADUser -Filter * -SearchBase "OU=Departments,DC=tervis,DC=prv" -Properties HomeDirectory, Manager, EmployeeID

foreach ($ADUser in $ADUsers) {
    Describe "Active Directory User $($ADUser.Name) ($($ADUser.samaccountname))" {
        It "Has an employee ID" {
            $ADUSer.EmployeeID | Should Not BeNullOrEmpty
        }

        It "Has a manager set" {
            $ADUSer.Manager | Should Not BeNullOrEmpty
        }
    }
}

Running directly Invoke-Pester without using OVF works and results in the output of the pester tests with the Describe statement dynamically including the name of the AD user being tested.

I think the problem is with line 375 of OperationValidation.psm1:
$testResult = Invoke-pester -Path $ti.FilePath -TestName $tName -quiet:$quiet -PassThru

The $tName variable contains "Active Directory User $($ADUser.Name) ($($ADUser.samaccountname))" and pester isn't able to find and run that named test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions