|
Within my test script, I return the server name as a Tag e.g. In my script that executes my tests, I pull back values from my scripts like this: My question is, how can I pull back the Context, It and Because for Passed tests? For failed tests, it's straightforward as the ErrorRecord is returned: Many thanks |
Answered by
nohwnd
Aug 15, 2026
Replies: 2 comments 4 replies
|
You should get tags like this (even though the code above looks like it won't work in pester 5, because you use $_ in the it, but there is no -ForEach provided) $r = Invoke-Pester -Container (New-PesterContainer -ScriptBlock {
Context "Checking path is set" -Tag "CCCCCCC" {
It "should be set to the server name" -Tag "TTTTTTTTT" {
}
}
}) -PassThru
$r.Containers.Blocks.Tag
$r.Containers.Blocks.Tests.Tag |
4 replies
|
You can get the test and its parent blocks from a passed test,
|
0 replies
Answer selected by
nohwnd
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can get the test and its parent blocks from a passed test,
$r.Passed.Name,$r.Passed.Block.ExpandedName,$r.Passed.Tag.Becauseyou cannot get, we don't store anything from passing assertions.