1"use strict";(self.webpackChunkpester_docs=self.webpackChunkpester_docs||[]).push([["5509"],{9220(e,n,s){s.r(n),s.d(n,{metadata:()=>t,default:()=>u,frontMatter:()=>a,contentTitle:()=>r,toc:()=>d,assets:()=>o});var t=JSON.parse('{"id":"commands/Set-ItResult","title":"Set-ItResult","description":"Help for Pester command \'Set-ItResult\'. Set-ItResult is used inside the It block to explicitly set the test result","source":"@site/versioned_docs/version-v5/commands/Set-ItResult.mdx","sourceDirName":"commands","slug":"/commands/Set-ItResult","permalink":"/docs/v5/commands/Set-ItResult","draft":false,"unlisted":false,"editUrl":null,"tags":[],"version":"v5","frontMatter":{"id":"Set-ItResult","title":"Set-ItResult","description":"Help for Pester command \'Set-ItResult\'. Set-ItResult is used inside the It block to explicitly set the test result","keywords":["PowerShell","Pester","Help","Documentation"],"hide_title":false,"hide_table_of_contents":false,"custom_edit_url":null},"sidebar":"commands","previous":{"title":"New-PesterContainer","permalink":"/docs/v5/commands/New-PesterContainer"},"next":{"title":"Should","permalink":"/docs/v5/commands/Should"}}'),l=s(1987),i=s(7008);let a={id:"Set-ItResult",title:"Set-ItResult",description:"Help for Pester command 'Set-ItResult'. Set-ItResult is used inside the It block to explicitly set the test result",keywords:["PowerShell","Pester","Help","Documentation"],hide_title:!1,hide_table_of_contents:!1,custom_edit_url:null},r,o={},d=[{value:"SYNOPSIS",id:"synopsis",level:2},{value:"SYNTAX",id:"syntax",level:2},{value:"Inconclusive",id:"inconclusive",level:3},{value:"Pending",id:"pending",level:3},{value:"Skipped",id:"skipped",level:3},{value:"DESCRIPTION",id:"description",level:2},{value:"EXAMPLES",id:"examples",level:2},{value:"EXAMPLE 1",id:"example-1",level:3},{value:"PARAMETERS",id:"parameters",level:2},{value:"-Because",id:"-because",level:3},{value:"-Inconclusive",id:"-inconclusive",level:3},{value:"-Pending",id:"-pending",level:3},{value:"-Skipped",id:"-skipped",level:3},{value:"CommonParameters",id:"commonparameters",level:3},{value:"INPUTS",id:"inputs",level:2},{value:"OUTPUTS",id:"outputs",level:2},{value:"NOTES",id:"notes",level:2},{value:"RELATED LINKS",id:"related-links",level:2},{value:"VERSION",id:"version",level:2}];function c(e){let n={a:"a",admonition:"admonition",code:"code",em:"em",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(n.admonition,{title:"This page was generated",type:"info",children:(0,l.jsxs)(n.p,{children:["Contributions are welcome in ",(0,l.jsx)(n.a,{href:"https://github.com/pester/Pester/tree/rel/5.x.x",children:"Pester v5-repo"}),"."]})}),"\n",(0,l.jsx)(n.h2,{id:"synopsis",children:"SYNOPSIS"}),"\n",(0,l.jsx)(n.p,{children:"Set-ItResult is used inside the It block to explicitly set the test result"}),"\n",(0,l.jsx)(n.h2,{id:"syntax",children:"SYNTAX"}),"\n",(0,l.jsx)(n.h3,{id:"inconclusive",children:"Inconclusive"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-powershell",children:"Set-ItResult [-Inconclusive] [-Because <string>]\n"})}),"\n",(0,l.jsx)(n.h3,{id:"pending",children:"Pending"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-powershell",children:"Set-ItResult [-Pending] [-Because <string>]\n"})}),"\n",(0,l.jsx)(n.h3,{id:"skipped",children:"Skipped"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-powershell",children:"Set-ItResult [-Skipped] [-Because <string>]\n"})}),"\n",(0,l.jsx)(n.h2,{id:"description",children:"DESCRIPTION"}),"\n",(0,l.jsx)(n.p,{children:"Sometimes a test shouldn't be executed, sometimes the condition cannot be evaluated.\nBy default such tests would typically fail and produce a big red message.\nUsing Set-ItResult it is possible to set the result from the inside of the It script\nblock to either inconclusive, pending or skipped."}),"\n",(0,l.jsx)(n.p,{children:'As of Pester 5, there is no "Inconclusive" or "Pending" test state, so all tests will now go to state skipped,\nhowever the test result notes will include information about being inconclusive or testing to keep this command\nbackwards compatible'}),"\n",(0,l.jsx)(n.h2,{id:"examples",children:"EXAMPLES"}),"\n",(0,l.jsx)(n.h3,{id:"example-1",children:"EXAMPLE 1"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-powershell",children:'Describe "Example" {\n It "Inconclusive test" {\n Set-ItResult -Inconclusive -Because "we want it to be inconclusive"\n }\n It "Skipped test" {\n Set-ItResult -Skipped -Because "we want it to be skipped"\n }\n}\n'})}),"\n",(0,l.jsx)(n.p,{children:"the output should be"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-powershell",children:"Describing Example\n [?] Inconclusive test is inconclusive, because we want it to be inconclusive 35ms (32ms|3ms)\n [!] Skipped test is skipped, because we want it to be skipped 3ms (2ms|1ms)\nTests completed in 78ms\nTests Passed: 0, Failed: 0, Skipped: 1, Inconclusive: 1, NotRun: 0\n"})}),"\n",(0,l.jsx)(n.h2,{id:"parameters",children:"PARAMETERS"}),"\n",(0,l.jsx)(n.h3,{id:"-because",children:"-Because"}),"\n",(0,l.jsx)(n.p,{children:"Similarly to failing tests, skipped and inconclusive tests should have reason.\nIt allows\nto provide information to the user why the test is neither successful nor failed."}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-yaml",children:"Type: System.String\nDefaultValue: ''\nSupportsWildcards: false\nAliases: []\nParameterSets:\n- N
1ame: (All)\n Position: Named\n IsRequired: false\n ValueFromPipeline: false\n ValueFromPipelineByPropertyName: false\n ValueFromRemainingArguments: false\nDontShow: false\nAcceptedValues: []\nHelpMessage: ''\n"})}),"\n",(0,l.jsx)(n.h3,{id:"-inconclusive",children:"-Inconclusive"}),"\n",(0,l.jsx)(n.p,{children:"Sets the test result to inconclusive.\nCannot be used at the same time as -Pending or -Skipped"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-yaml",children:"Type: System.Management.Automation.SwitchParameter\nDefaultValue: False\nSupportsWildcards: false\nAliases: []\nParameterSets:\n- Name: Inconclusive\n Position: Named\n IsRequired: false\n ValueFromPipeline: false\n ValueFromPipelineByPropertyName: false\n ValueFromRemainingArguments: false\nDontShow: false\nAcceptedValues: []\nHelpMessage: ''\n"})}),"\n",(0,l.jsx)(n.h3,{id:"-pending",children:"-Pending"}),"\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.strong,{children:"DEPRECATED"})," Sets the test result to pending.\nCannot be used at the same time as -Inconclusive or -Skipped"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-yaml",children:"Type: System.Management.Automation.SwitchParameter\nDefaultValue: False\nSupportsWildcards: false\nAliases: []\nParameterSets:\n- Name: Pending\n Position: Named\n IsRequired: false\n ValueFromPipeline: false\n ValueFromPipelineByPropertyName: false\n ValueFromRemainingArguments: false\nDontShow: false\nAcceptedValues: []\nHelpMessage: ''\n"})}),"\n",(0,l.jsx)(n.h3,{id:"-skipped",children:"-Skipped"}),"\n",(0,l.jsx)(n.p,{children:"Sets the test result to skipped.\nCannot be used at the same time as -Inconclusive or -Pending"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-yaml",children:"Type: System.Management.Automation.SwitchParameter\nDefaultValue: False\nSupportsWildcards: false\nAliases: []\nParameterSets:\n- Name: Skipped\n Position: Named\n IsRequired: false\n ValueFromPipeline: false\n ValueFromPipelineByPropertyName: false\n ValueFromRemainingArguments: false\nDontShow: false\nAcceptedValues: []\nHelpMessage: ''\n"})}),"\n",(0,l.jsx)(n.h3,{id:"commonparameters",children:"CommonParameters"}),"\n",(0,l.jsxs)(n.p,{children:["This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,\n-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,\n-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see\n",(0,l.jsx)(n.a,{href:"https://go.microsoft.com/fwlink/?LinkID=113216",children:"about_CommonParameters"}),"."]}),"\n",(0,l.jsx)(n.h2,{id:"inputs",children:"INPUTS"}),"\n",(0,l.jsx)(n.h2,{id:"outputs",children:"OUTPUTS"}),"\n",(0,l.jsx)(n.h2,{id:"notes",children:"NOTES"}),"\n",(0,l.jsx)(n.h2,{id:"related-links",children:"RELATED LINKS"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.a,{href:"https://pester.dev/docs/v5/commands/Set-ItResult",children:"https://pester.dev/docs/v5/commands/Set-ItResult"})}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"version",children:"VERSION"}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsxs)(n.em,{children:["This page was generated using comment-based help in ",(0,l.jsx)(n.a,{href:"https://github.com/pester/Pester/tree/rel/5.x.x",children:"Pester 5.9.1"}),"."]})})]})}function u(e={}){let{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(c,{...e})}):c(e)}},7008(e,n,s){s.d(n,{R:()=>a,x:()=>r});var t=s(1763);let l={},i=t.createContext(l);function a(e){let n=t.useContext(i);return t.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function r(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(l):e.components||l:a(e.components),t.createElement(i.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.