Replies: 1 comment 3 replies
-
My solution is to change param(
[Parameter(Mandatory)]
$Param
)
BeforeDiscovery {
# Gather initial values for generating tests
$ExtraParam = 'value'
}
Describe 'Test Container' -ForEach @(@{Param = $Param; ExtraParam = $ExtraParam }) {
BeforeAll {
}
BeforeEach {
}
AfterEach {
}
AfterAll {
}
It 'Test with value <Param>' {
$Param | Should -Not -Be $null
$ExtraParam | Should -Not -Be $null
}
} Invoke-ExternalData.Tests.ps1 BeforeDiscovery {
$values = ,'value', 'not value'
}
Describe 'Test with value <value>' -ForEach $values {
& "$PSScriptRoot/ExternalData.ps1" $_
} |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to set up tests using Pester with both external and non-external data. I've created separate test files for these scenarios and used Invoke-Pester with containers, but I'm facing a couple of issues:
Split Summaries: When I run the tests with external data, the summaries are split, and it doesn't provide a clear overall picture of test results.
rather than
Passing Configuration: I'm unsure how to pass a configuration (-Configuration) into the inner Invoke-Pester call (
Invoke-ExternalData.Tests.ps1
)Here's the structure I'm using:
NonDataExternal.Tests.ps1:
ExternalData.ps1:
Invoke-ExternalData.Tests.ps1:
I would appreciate guidance on how to structure these tests to achieve a unified summary and how to pass a configuration into the inner Invoke-Pester call. Is there a way to "hand-off" the PesterContainer objects without invoking Pester again?
Beta Was this translation helpful? Give feedback.
All reactions