-
-
Notifications
You must be signed in to change notification settings - Fork 476
Open
Labels
Description
Summary of the feature request
Hey, I wonder if you can add What is the reason a test was skipped
the current return object you will get if you using -PassThru
doesn't contain any info on this
maybe you can add parameter name -Reason
'the reason it skipped'
PS D:\Github\pwshchakraui> $results.Skipped[0]
Name : Has help comment block
Path : {New-Tab, Comment Base Help, Has help comment block}
Data :
ExpandedName : Has help comment block
ExpandedPath : New-Tab.Comment Base Help.Has help comment block
Result : Skipped
ErrorRecord : {}
StandardOutput :
Duration : 00:00:00.0054751
ItemType : Test
Id :
ScriptBlock :
$FilePath | Should -FileContentMatch "<#"
$FilePath | Should -FileContentMatch "#>"
Tag :
Focus : False
Skip : True
Block : [!] Comment Base Help
First : True
Last : False
Include : False
Exclude : False
Explicit : False
ShouldRun : True
StartLine : 9
Executed : True
ExecutedAt : 8/14/2021 11:43:21 AM
Passed : True
Skipped : True
UserDuration : 00:00:00
FrameworkDuration : 00:00:00.0054751
PluginData :
FrameworkData :
How should it work? (optional)
Describe "describe1" {
Context "with one skipped test" {
It "test 1" -Skip -Reason 'i want it to skip' {
1 | Should -Be 2
}
It "test 2" {
1 | Should -Be 1
}
}
Describe "that is skipped" -Skip -Reason 'i want it to skip all the tests' {
It "test 3" {
1 | Should -Be 2
}
}
Context "that is skipped and has skipped test" -Skip -Reason 'i want all the It tests to skip' {
It "test 3" -Skip {
1 | Should -Be 2
}
It "test 3" {
1 | Should -Be 2
}
}
}
So the return object will look something like this.
Name : Has help comment block
Path : {New-Tab, Comment Base Help, Has help comment block}
Data :
ExpandedName : Has help comment block
ExpandedPath : New-Tab.Comment Base Help.Has help comment block
Result : Skipped
ErrorRecord : {}
StandardOutput :
Duration : 00:00:00.0054751
ItemType : Test
Id :
ScriptBlock :
$FilePath | Should -FileContentMatch "<#"
$FilePath | Should -FileContentMatch "#>"
Tag :
Focus : False
Skip : True
Block : [!] Comment Base Help
First : True
Last : False
Include : False
Exclude : False
Explicit : False
ShouldRun : True
StartLine : 9
Executed : True
ExecutedAt : 8/14/2021 11:43:21 AM
Passed : True
Skipped : True
SkippedReason : I want it to skip
UserDuration : 00:00:00
FrameworkDuration : 00:00:00.0054751
PluginData :
FrameworkData :
corbob
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
fflaten commentedon Jul 17, 2022
If implemented, NUnit3-console stores it in the xml-report as both a property and reason-element:
corbob commentedon Dec 6, 2024
If someone were to submit a PR to implement this, is it something that the project would be interested in reviewing and merging? This is a feature that I would very much like to see, and would be willing to attempt to implement.
corbob commentedon Jan 9, 2025
I've taken a stab at implementing something for this in #2607, as well as updating Set-ItResult so that it's reasons are also exported to the rest results. It is currently WIP as I have to cleanup the commit messages, and remove some extraneous files.