You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.
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.
The text was updated successfully, but these errors were encountered:
This is because OVF is inspecting the Pester test and parsing the contents of the script not actually executing it. This function is how OVF determines the name for the Describe block.
Since OVF doesn't actually execute the Pester script when it searches for test names, there is no way for it to handle expressions in the Describe block like your case above.
You CAN however generate dynamic names for your Context blocks since OVF doesn't not deal with those directly.
Describe 'This is a static describe name' {
(1..10) |ForEach-Object {
context "This is dynamic test number [$_]" {
it 'Always works' {
$true| should be $true
}
}
}
}
The following results in no output:
Invoke-OperationValidation -ModuleName tervisactivedirectory -IncludePesterOutput
File Simple.tests.ps1 in TervisActiveDirectory\Diagnostics\Simple
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.
The text was updated successfully, but these errors were encountered: